forlogic-core 1.4.7 → 1.4.8
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.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -7
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as e from"react";import t,{useMemo as r,useCallback as n,useState as o,useEffect as a,createContext as i,useContext as s,forwardRef as l,useRef as c,Component as u}from"react";import{Slot as d,createSlot as f}from"@radix-ui/react-slot";import{cva as p}from"class-variance-authority";import{clsx as h}from"clsx";import{twMerge as m}from"tailwind-merge";import{parseISO as y,isValid as g,format as v}from"date-fns";import*as b from"@radix-ui/react-label";import*as x from"@radix-ui/react-dialog";import{X as w,ChevronDown as N,ChevronUp as j,Check as _,Loader2 as k,AlertCircle as O,Search as E,FileX as S,ChevronRight as A,Circle as T,Edit as C,PowerOff as P,Power as q,Trash2 as R,EllipsisVertical as L,ArrowUpDown as I,ArrowUp as M,ArrowDown as D,Target as F,Trophy as B,Award as z,Sparkles as U,Flame as $,Zap as H,Key as V,Shield as K,EyeOff as W,Eye as Z,Unlock as G,Lock as Y,Archive as Q,FolderOpen as X,Folder as J,FileText as ee,Save as te,Copy as re,Share as ne,Upload as oe,Download as ae,HelpCircle as ie,Info as se,Bell as le,Clock as ce,ArrowRight as ue,ArrowLeft as de,ChevronLeft as fe,Minus as pe,Plus as he,Filter as me,Bookmark as ye,Book as ge,Video as ve,Music as be,Image as xe,Camera as we,MapPin as Ne,Calendar as je,Phone as _e,Mail as ke,Settings as Oe,User as Ee,Home as Se,Heart as Ae,Star as Te,ChevronsLeft as Ce,ChevronsRight as Pe,RefreshCw as qe,MoreHorizontal as Re,MessageCircle as Le,Dot as Ie,PanelLeft as Me,ExternalLink as De,Building2 as Fe,LogOut as Be,AlertTriangle as ze}from"lucide-react";import{useFormContext as Ue,FormProvider as $e,Controller as He}from"react-hook-form";import*as Ve from"@radix-ui/react-select";import*as Ke from"@radix-ui/react-checkbox";import*as We from"@radix-ui/react-toast";import{createClient as Ze}from"@supabase/supabase-js";import{useQueryClient as Ge,useQuery as Ye,useMutation as Qe,QueryClient as Xe}from"@tanstack/react-query";import{useSearchParams as Je,useLocation as et,useNavigate as tt,Link as rt}from"react-router-dom";import{toast as nt,Toaster as ot}from"sonner";export{toast as sonnerToast}from"sonner";import*as at from"@radix-ui/react-alert-dialog";import*as it from"@radix-ui/react-dropdown-menu";import*as st from"@radix-ui/react-popover";import*as lt from"@radix-ui/react-scroll-area";import*as ct from"@radix-ui/react-accordion";import*as ut from"@radix-ui/react-aspect-ratio";import*as dt from"@radix-ui/react-avatar";import{DayPicker as ft}from"react-day-picker";import pt from"embla-carousel-react";import*as ht from"recharts";import{OTPInput as
|
|
1
|
+
import*as e from"react";import t,{useMemo as r,useCallback as n,useState as o,useEffect as a,createContext as i,useContext as s,forwardRef as l,useRef as c,Component as u}from"react";import{Slot as d,createSlot as f}from"@radix-ui/react-slot";import{cva as p}from"class-variance-authority";import{clsx as h}from"clsx";import{twMerge as m}from"tailwind-merge";import{parseISO as y,isValid as g,format as v}from"date-fns";import*as b from"@radix-ui/react-label";import*as x from"@radix-ui/react-dialog";import{X as w,ChevronDown as N,ChevronUp as j,Check as _,Loader2 as k,AlertCircle as O,Search as E,FileX as S,ChevronRight as A,Circle as T,Edit as C,PowerOff as P,Power as q,Trash2 as R,EllipsisVertical as L,ArrowUpDown as I,ArrowUp as M,ArrowDown as D,Target as F,Trophy as B,Award as z,Sparkles as U,Flame as $,Zap as H,Key as V,Shield as K,EyeOff as W,Eye as Z,Unlock as G,Lock as Y,Archive as Q,FolderOpen as X,Folder as J,FileText as ee,Save as te,Copy as re,Share as ne,Upload as oe,Download as ae,HelpCircle as ie,Info as se,Bell as le,Clock as ce,ArrowRight as ue,ArrowLeft as de,ChevronLeft as fe,Minus as pe,Plus as he,Filter as me,Bookmark as ye,Book as ge,Video as ve,Music as be,Image as xe,Camera as we,MapPin as Ne,Calendar as je,Phone as _e,Mail as ke,Settings as Oe,User as Ee,Home as Se,Heart as Ae,Star as Te,ChevronsLeft as Ce,ChevronsRight as Pe,RefreshCw as qe,MoreHorizontal as Re,MessageCircle as Le,Dot as Ie,PanelLeft as Me,ExternalLink as De,Building2 as Fe,LogOut as Be,AlertTriangle as ze}from"lucide-react";import{useFormContext as Ue,FormProvider as $e,Controller as He}from"react-hook-form";import*as Ve from"@radix-ui/react-select";import*as Ke from"@radix-ui/react-checkbox";import*as We from"@radix-ui/react-toast";import{createClient as Ze}from"@supabase/supabase-js";import{useQueryClient as Ge,useQuery as Ye,useMutation as Qe,QueryClient as Xe}from"@tanstack/react-query";import{useSearchParams as Je,useLocation as et,useNavigate as tt,Link as rt}from"react-router-dom";import{toast as nt,Toaster as ot}from"sonner";export{toast as sonnerToast}from"sonner";import*as at from"@radix-ui/react-alert-dialog";import*as it from"@radix-ui/react-dropdown-menu";import*as st from"@radix-ui/react-popover";import*as lt from"@radix-ui/react-scroll-area";import*as ct from"@radix-ui/react-accordion";import*as ut from"@radix-ui/react-aspect-ratio";import*as dt from"@radix-ui/react-avatar";import{DayPicker as ft}from"react-day-picker";import pt from"embla-carousel-react";import*as ht from"recharts";import*as mt from"@radix-ui/react-collapsible";import{OTPInput as yt,OTPInputContext as gt}from"input-otp";import*as vt from"@radix-ui/react-progress";import*as bt from"@radix-ui/react-radio-group";import xt from"react-dom";import*as wt from"@radix-ui/react-separator";import*as Nt from"@radix-ui/react-tooltip";import*as jt from"@radix-ui/react-slider";import{useTheme as _t}from"next-themes";import*as kt from"@radix-ui/react-tabs";import*as Ot from"@radix-ui/react-toggle";import*as Et from"@radix-ui/react-toggle-group";var St="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function At(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tt,Ct={exports:{}},Pt={};var qt,Rt,Lt={};
|
|
2
2
|
/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.development.js
|
|
@@ -7,11 +7,11 @@ import*as e from"react";import t,{useMemo as r,useCallback as n,useState as o,us
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/function Lt(){return Pt||(Pt=1,"production"!==process.env.NODE_ENV&&function(){var e=t,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator;var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=y.ReactDebugCurrentFrame,o=n.getStackAddendum();""!==o&&(t+="%s",r=r.concat([o]));var a=r.map(function(e){return String(e)});a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}("error",e,r)}var v;function b(e){return e.displayName||"Context"}function x(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return b(e)+".Consumer";case s:return b(e._context)+".Provider";case c:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case f:var t=e.displayName||null;return null!==t?t:x(e.type)||"Memo";case p:var r=e,h=r._payload,m=r._init;try{return x(m(h))}catch(e){return null}}return null}v=Symbol.for("react.module.reference");var w,N,j,_,k,O,E,S=Object.assign,A=0;function T(){}T.__reactDisabledLog=!0;var C,P=y.ReactCurrentDispatcher;function q(e,t,r){if(void 0===C)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);C=n&&n[1]||""}return"\n"+C+e}var R,L=!1,I="function"==typeof WeakMap?WeakMap:Map;function M(e,t){if(!e||L)return"";var r,n=R.get(e);if(void 0!==n)return n;L=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=P.current,P.current=null,function(){if(0===A){w=console.log,N=console.info,j=console.warn,_=console.error,k=console.group,O=console.groupCollapsed,E=console.groupEnd;var e={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){r=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){r=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),l=r.stack.split("\n"),c=s.length-1,u=l.length-1;c>=1&&u>=0&&s[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(s[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||s[c]!==l[u]){var d="\n"+s[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&R.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{L=!1,P.current=o,function(){if(0===--A){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},e,{value:w}),info:S({},e,{value:N}),warn:S({},e,{value:j}),error:S({},e,{value:_}),group:S({},e,{value:k}),groupCollapsed:S({},e,{value:O}),groupEnd:S({},e,{value:E})})}A<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?q(f):"";return"function"==typeof e&&R.set(e,p),p}function D(e,t,r){if(null==e)return"";if("function"==typeof e)return M(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return q(e);switch(e){case u:return q("Suspense");case d:return q("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return M(e.render,!1);case f:return D(e.type,t,r);case p:var n=e,o=n._payload,a=n._init;try{return D(a(o),t,r)}catch(e){}}return""}R=new I;var F=Object.prototype.hasOwnProperty,B={},z=y.ReactDebugCurrentFrame;function U(e){if(e){var t=e._owner,r=D(e.type,e._source,t?t.type:null);z.setExtraStackFrame(r)}else z.setExtraStackFrame(null)}var $=Array.isArray;function H(e){return $(e)}function V(e){return""+e}function K(e){if(function(e){try{return V(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var W,Z,G=y.ReactCurrentOwner,Y={key:!0,ref:!0,__self:!0,__source:!0};function Q(e,t,n,o,a){var i,s={},l=null,c=null;for(i in void 0!==n&&(K(n),l=""+n),function(e){if(F.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(K(t.key),l=""+t.key),function(e){if(F.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e){"string"==typeof e.ref&&G.current}(t)),t)F.call(t,i)&&!Y.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===s[i]&&(s[i]=u[i])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var r=function(){W||(W=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(s,d),c&&function(e,t){var r=function(){Z||(Z=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(s,d)}return function(e,t,n,o,a,i,s){var l={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,a,o,G.current,s)}var X,J=y.ReactCurrentOwner,ee=y.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,r=D(e.type,e._source,t?t.type:null);ee.setExtraStackFrame(r)}else ee.setExtraStackFrame(null)}function re(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function ne(){if(J.current){var e=x(J.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}X=!1;var oe={};function ae(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=ne();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!oe[r]){oe[r]=!0;var n="";e&&e._owner&&e._owner!==J.current&&(n=" It was passed a child from "+x(e._owner.type)+"."),te(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),te(null)}}}function ie(e,t){if("object"==typeof e)if(H(e))for(var r=0;r<e.length;r++){var n=e[r];re(n)&&ae(n,t)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)re(a.value)&&ae(a.value,t)}}function se(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==f)return;t=r.propTypes}if(t){var n=x(r);!function(e,t,r,n,o){var a=Function.call.bind(F);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var l=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}s=e[i](t,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(U(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof s),U(null)),s instanceof Error&&!(s.message in B)&&(B[s.message]=!0,U(o),g("Failed %s type: %s",r,s.message),U(null))}}(t,e.props,"prop",n,e)}else if(void 0!==r.PropTypes&&!X){X=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(r)||"Unknown")}"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ce(e,t,n,m,y,b){var w=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===i||e===a||e===u||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===s||e.$$typeof===l||e.$$typeof===c||e.$$typeof===v||void 0!==e.getModuleId)}(e);if(!w){var N="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(N+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j;N+=ne(),null===e?j="null":H(e)?j="array":void 0!==e&&e.$$typeof===r?(j="<"+(x(e.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):j=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",j,N)}var _=Q(e,t,n,y,b);if(null==_)return _;if(w){var k=t.children;if(void 0!==k)if(m)if(H(k)){for(var O=0;O<k.length;O++)ie(k[O],e);Object.freeze&&Object.freeze(k)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ie(k,e)}if(F.call(t,"key")){var E=x(e),S=Object.keys(t).filter(function(e){return"key"!==e}),A=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!le[E+A])g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',A,E,S.length>0?"{"+S.join(": ..., ")+": ...}":"{}",E),le[E+A]=!0}return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){te(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),te(null);break}}null!==e.ref&&(te(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(_):se(_),_}var ue=function(e,t,r){return ce(e,t,r,!1)},de=function(e,t,r){return ce(e,t,r,!0)};Rt.Fragment=o,Rt.jsx=ue,Rt.jsxs=de}()),Rt}var It=(qt||(qt=1,"production"===process.env.NODE_ENV?Tt.exports=function(){if(At)return Ct;At=1;var e=t,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var s,l={},c=null,u=null;for(s in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,s)&&!i.hasOwnProperty(s)&&(l[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===l[s]&&(l[s]=t[s]);return{$$typeof:r,type:e,key:c,ref:u,props:l,_owner:a.current}}return Ct.Fragment=n,Ct.jsx=s,Ct.jsxs=s,Ct}():Tt.exports=Lt()),Tt.exports);function Mt(...e){return m(h(e))}const Dt=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Dt);if("object"==typeof e&&e.constructor===Object){const t={};for(const[r,n]of Object.entries(e))t[r]=Dt(n);return t}return e},Ft=e=>{if(!e)return"";const t=y(e);if(!g(t))return"Data inválida";return`${t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})} ${t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}`},Bt=e=>null==e?"R$ 0,00":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:2,maximumFractionDigits:2}).format(e),zt=(e,t)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}},Ut=p("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6"}},defaultVariants:{variant:"default",size:"default"}}),$t=e.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},a)=>{const i=n?d:"button";return It.jsx(i,{className:Mt(Ut({variant:t,size:r,className:e})),ref:a,...o})});$t.displayName="Button";const Ht=e.forwardRef(({className:e,type:t,...r},n)=>It.jsx("input",{type:t,className:Mt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));Ht.displayName="Input";const Vt=p("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Kt=e.forwardRef(({className:e,...t},r)=>It.jsx(b.Root,{ref:r,className:Mt(Vt(),e),...t}));Kt.displayName=b.Root.displayName;const Wt=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Wt.displayName="Card";const Zt=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("flex flex-col space-y-1.5 p-6",e),...t}));Zt.displayName="CardHeader";const Gt=e.forwardRef(({className:e,...t},r)=>It.jsx("h3",{ref:r,className:Mt("text-2xl font-semibold leading-none tracking-tight",e),...t}));Gt.displayName="CardTitle";const Yt=e.forwardRef(({className:e,...t},r)=>It.jsx("p",{ref:r,className:Mt("text-sm text-muted-foreground",e),...t}));Yt.displayName="CardDescription";const Qt=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("p-6 pt-0",e),...t}));Qt.displayName="CardContent";const Xt=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("flex items-center p-6 pt-0",e),...t}));Xt.displayName="CardFooter";const Jt=x.Root,er=x.Trigger,tr=x.Portal,rr=x.Close,nr=e.forwardRef(({className:e,...t},r)=>It.jsx(x.Overlay,{ref:r,className:Mt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));nr.displayName=x.Overlay.displayName;const or=e.forwardRef(({className:e,children:t,...r},n)=>It.jsxs(tr,{children:[It.jsx(nr,{}),It.jsxs(x.Content,{ref:n,className:Mt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg overflow-hidden",e),...r,children:[t,It.jsxs(x.Close,{className:"absolute right-4 top-4 z-10 rounded-sm text-white opacity-70 ring-offset-background transition-opacity hover:opacity-100 hover:text-white focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[It.jsx(w,{className:"h-4 w-4"}),It.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));or.displayName=x.Content.displayName;const ar=({className:e,...t})=>It.jsx("div",{className:Mt("flex flex-col space-y-1.5 text-center sm:text-left bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-3 rounded-t-lg",e),...t});ar.displayName="DialogHeader";const ir=({className:e,...t})=>It.jsx("div",{className:Mt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ir.displayName="DialogFooter";const sr=e.forwardRef(({className:e,...t},r)=>It.jsx(x.Title,{ref:r,className:Mt("text-lg font-semibold leading-none tracking-tight",e),...t}));sr.displayName=x.Title.displayName;const lr=e.forwardRef(({className:e,...t},r)=>It.jsx(x.Description,{ref:r,className:Mt("text-sm text-muted-foreground",e),...t}));lr.displayName=x.Description.displayName;const cr=$e,ur=e.createContext({}),dr=({...e})=>It.jsx(ur.Provider,{value:{name:e.name},children:It.jsx(He,{...e})}),fr=()=>{const t=e.useContext(ur),r=e.useContext(pr),{getFieldState:n,formState:o}=Ue(),a=n(t.name,o);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:i}=r;return{id:i,name:t.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...a}},pr=e.createContext({}),hr=e.forwardRef(({className:t,...r},n)=>{const o=e.useId();return It.jsx(pr.Provider,{value:{id:o},children:It.jsx("div",{ref:n,className:Mt("space-y-2",t),...r})})});hr.displayName="FormItem";const mr=e.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:o}=fr();return It.jsx(Kt,{ref:r,className:Mt(n&&"text-destructive",e),htmlFor:o,...t})});mr.displayName="FormLabel";const yr=e.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:o,formMessageId:a}=fr();return It.jsx(d,{ref:t,id:n,"aria-describedby":r?`${o} ${a}`:`${o}`,"aria-invalid":!!r,...e})});yr.displayName="FormControl";e.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=fr();return It.jsx("p",{ref:r,id:n,className:Mt("text-sm text-muted-foreground",e),...t})}).displayName="FormDescription";const gr=e.forwardRef(({className:e,children:t,...r},n)=>{const{error:o,formMessageId:a}=fr(),i=o?String(o?.message):t;return i?It.jsx("p",{ref:n,id:a,className:Mt("text-sm font-medium text-destructive",e),...r,children:i}):null});gr.displayName="FormMessage";const vr=Ve.Root,br=Ve.Value,xr=e.forwardRef(({className:e,children:t,...r},n)=>It.jsxs(Ve.Trigger,{ref:n,className:Mt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,It.jsx(Ve.Icon,{asChild:!0,children:It.jsx(N,{className:"h-4 w-4 opacity-50"})})]}));xr.displayName=Ve.Trigger.displayName;const wr=e.forwardRef(({className:e,...t},r)=>It.jsx(Ve.ScrollUpButton,{ref:r,className:Mt("flex cursor-default items-center justify-center py-1",e),...t,children:It.jsx(j,{className:"h-4 w-4"})}));wr.displayName=Ve.ScrollUpButton.displayName;const Nr=e.forwardRef(({className:e,...t},r)=>It.jsx(Ve.ScrollDownButton,{ref:r,className:Mt("flex cursor-default items-center justify-center py-1",e),...t,children:It.jsx(N,{className:"h-4 w-4"})}));Nr.displayName=Ve.ScrollDownButton.displayName;const jr=e.forwardRef(({className:e,children:t,position:r="popper",...n},o)=>It.jsx(Ve.Portal,{children:It.jsxs(Ve.Content,{ref:o,className:Mt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[It.jsx(wr,{}),It.jsx(Ve.Viewport,{className:Mt("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),It.jsx(Nr,{})]})}));jr.displayName=Ve.Content.displayName;e.forwardRef(({className:e,...t},r)=>It.jsx(Ve.Label,{ref:r,className:Mt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=Ve.Label.displayName;const _r=e.forwardRef(({className:e,children:t,...r},n)=>It.jsxs(Ve.Item,{ref:n,className:Mt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[It.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:It.jsx(Ve.ItemIndicator,{children:It.jsx(_,{className:"h-4 w-4"})})}),It.jsx(Ve.ItemText,{children:t})]}));_r.displayName=Ve.Item.displayName;e.forwardRef(({className:e,...t},r)=>It.jsx(Ve.Separator,{ref:r,className:Mt("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=Ve.Separator.displayName;const kr=e.forwardRef(({className:e,...t},r)=>It.jsx(Ke.Root,{ref:r,className:Mt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:It.jsx(Ke.Indicator,{className:Mt("flex items-center justify-center text-current"),children:It.jsx(_,{className:"h-4 w-4"})})}));kr.displayName=Ke.Root.displayName;const Or=e.forwardRef(({className:e,...t},r)=>It.jsx("textarea",{className:Mt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Or.displayName="Textarea";const Er=p("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white hover:bg-green-600",warning:"border-transparent bg-yellow-500 text-white hover:bg-yellow-600",info:"border-transparent bg-blue-500 text-white hover:bg-blue-600"}},defaultVariants:{variant:"default"}}),Sr=e.forwardRef(({className:e,variant:t,...r},n)=>It.jsx("div",{ref:n,className:Mt(Er({variant:t}),e),...r}));Sr.displayName="Badge";const Ar={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Tr({size:e="md",className:t}){return It.jsx(k,{className:Mt("animate-spin text-muted-foreground",Ar[e],t)})}function Cr({isLoading:e,children:t,className:r,type:n="spinner",size:o="md"}){return e?"overlay"===n?It.jsxs("div",{className:Mt("relative",r),children:[t,It.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:It.jsx(Tr,{size:o})})]}):"skeleton"===n?It.jsx("div",{className:Mt("animate-pulse",r),children:It.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):It.jsx("div",{className:Mt("flex items-center justify-center py-8",r),children:It.jsx(Tr,{size:o})}):It.jsx(It.Fragment,{children:t})}let Pr=0;const qr=new Map,Rr=e=>{if(qr.has(e))return;const t=setTimeout(()=>{qr.delete(e),Dr({type:"REMOVE_TOAST",toastId:e})},1e6);qr.set(e,t)},Lr=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Rr(r):e.toasts.forEach(e=>{Rr(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},Ir=[];let Mr={toasts:[]};function Dr(e){Mr=Lr(Mr,e),Ir.forEach(e=>{e(Mr)})}function Fr({...e}){const t=(Pr=(Pr+1)%Number.MAX_SAFE_INTEGER,Pr.toString()),r=()=>Dr({type:"DISMISS_TOAST",toastId:t});return Dr({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>Dr({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function Br(){const[t,r]=e.useState(Mr);return e.useEffect(()=>(Ir.push(r),()=>{const e=Ir.indexOf(r);e>-1&&Ir.splice(e,1)}),[t]),{...t,toast:Fr,dismiss:e=>Dr({type:"DISMISS_TOAST",toastId:e})}}const zr=We.Provider,Ur=e.forwardRef(({className:e,...t},r)=>It.jsx(We.Viewport,{ref:r,className:Mt("fixed top-4 left-1/2 transform -translate-x-1/2 z-[100] flex max-h-screen w-full max-w-[420px] flex-col p-4",e),...t}));Ur.displayName=We.Viewport.displayName;const $r=p("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Hr=e.forwardRef(({className:e,variant:t,...r},n)=>It.jsx(We.Root,{ref:n,className:Mt($r({variant:t}),e),...r}));Hr.displayName=We.Root.displayName;const Vr=e.forwardRef(({className:e,...t},r)=>It.jsx(We.Action,{ref:r,className:Mt("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));Vr.displayName=We.Action.displayName;const Kr=e.forwardRef(({className:e,...t},r)=>It.jsx(We.Close,{ref:r,className:Mt("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:It.jsx(w,{className:"h-4 w-4"})}));Kr.displayName=We.Close.displayName;const Wr=e.forwardRef(({className:e,...t},r)=>It.jsx(We.Title,{ref:r,className:Mt("text-sm font-semibold",e),...t}));Wr.displayName=We.Title.displayName;const Zr=e.forwardRef(({className:e,...t},r)=>It.jsx(We.Description,{ref:r,className:Mt("text-sm opacity-90",e),...t}));function Gr(){const{toasts:e}=Br();return It.jsxs(zr,{children:[e.map(function({id:e,title:t,description:r,action:n,...o}){return It.jsxs(Hr,{...o,children:[It.jsxs("div",{className:"grid gap-1",children:[t&&It.jsx(Wr,{children:t}),r&&It.jsx(Zr,{children:r})]}),n,It.jsx(Kr,{})]},e)}),It.jsx(Ur,{})]})}Zr.displayName=We.Description.displayName;const Yr="qualiex_access_token",Qr="qualiex_id_token",Xr="supabase_token",Jr="oauth_state",en="oauth_nonce",tn="selected_alias",rn="manual_logout",nn={setAccessToken:e=>localStorage.setItem(Yr,e),getAccessToken:()=>localStorage.getItem(Yr),setIdToken:e=>localStorage.setItem(Qr,e),getIdToken:()=>localStorage.getItem(Qr),getSupabaseToken:()=>localStorage.getItem(Xr),setOAuthState:e=>sessionStorage.setItem(Jr,e),getOAuthState:()=>sessionStorage.getItem(Jr),clearOAuthState:()=>sessionStorage.removeItem(Jr),setOAuthNonce:e=>sessionStorage.setItem(en,e),getOAuthNonce:()=>sessionStorage.getItem(en),clearOAuthNonce:()=>sessionStorage.removeItem(en),setSelectedAlias:e=>localStorage.setItem(tn,e),getSelectedAlias:()=>localStorage.getItem(tn),clearSelectedAlias:()=>localStorage.removeItem(tn),generateOAuthState:()=>"Lw==",generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!nn.getAccessToken()||!nn.getIdToken()),setSupabaseToken:e=>{localStorage.setItem(Xr,e),nn._clearValidationCache()},areAllTokensValid:()=>{const e=nn.getAccessToken(),t=nn.getIdToken(),r=nn.getSupabaseToken();return!(!e||!t)&&(!nn.isTokenExpired(e)&&!nn.isTokenExpired(t)&&(!r||!nn.isTokenExpired(r)))},clearExpiredTokens:()=>{let e=!1;const t=nn.getAccessToken(),r=nn.getIdToken(),n=nn.getSupabaseToken();return t&&nn.isTokenExpired(t)&&(localStorage.removeItem(Yr),e=!0),r&&nn.isTokenExpired(r)&&(localStorage.removeItem(Qr),e=!0),n&&nn.isTokenExpired(n)&&(localStorage.removeItem(Xr),e=!0),e},clearAll:()=>{localStorage.removeItem(Yr),localStorage.removeItem(Qr),localStorage.removeItem(Xr),localStorage.removeItem(tn),localStorage.removeItem(rn),sessionStorage.removeItem(Jr),sessionStorage.removeItem(en)},setManualLogout:()=>localStorage.setItem(rn,"true"),isManualLogout:()=>"true"===localStorage.getItem(rn),clearManualLogout:()=>localStorage.removeItem(rn),isTokenExpired:e=>{try{return 1e3*JSON.parse(atob(e.split(".")[1])).exp<Date.now()}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{nn._validationCache.isValid=!1,nn._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=nn.getSupabaseToken();if(!e)return!1;if(nn.isTokenExpired(e))return nn._clearValidationCache(),nn._handleExpiredToken(),!1;const t=Date.now();return t-nn._validationCache.timestamp<nn._validationCache.cacheValidityMs?nn._validationCache.isValid:(nn._validationCache.isValid=!0,nn._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>nn.isSupabaseTokenValid()?nn.getSupabaseToken():null,_handleExpiredToken:()=>{console.warn("[TokenManager] Token expirado detectado - limpando sessão"),nn.clearAll(),"undefined"!=typeof window&&(window.location.href="/")},extractTokenData:()=>{if(!nn.isSupabaseTokenValid())return console.warn("[TokenManager] Tentativa de extrair dados de token inválido/expirado"),null;const e=nn.getSupabaseToken();if(!e)return null;try{const t=JSON.parse(atob(e.split(".")[1])),r=t.alias||t.default||t.user_alias;let n=t.company_id;if(!n&&r)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const o=t[e];if(o&&"string"==typeof o){const e=o.split(";");if(e.length>7&&e[0]===r){n=e[7];break}}}return{alias:r,companyId:n,payload:t}}catch(e){return console.error("[TokenManager] Erro ao extrair dados do token:",e),nn._handleExpiredToken(),null}},getCompanyId:e=>{const t=nn.extractTokenData();if(!t)return null;if(!e)return t.companyId;const r=nn.getIdToken();if(!r)return null;try{const t=JSON.parse(atob(r.split(".")[1]));for(const r in t)if(r.startsWith("co")&&/^co\d+$/.test(r)){const n=t[r];if(n&&"string"==typeof n){const t=n.split(";");if(t.length>7&&t[0]===e)return t[7]}}}catch{return null}return null},getCurrentCompanyId:()=>{const e=nn.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=nn.getIdToken();if(!e)return[];try{const t=JSON.parse(atob(e.split(".")[1])),r=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const n=t[e];if(n&&"string"==typeof n){const e=n.split(";");e.length>=4&&r.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return r}catch{return[]}}};var on=Object.defineProperty,an=(e,t,r)=>((e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const sn=new class{constructor(){an(this,"errors",[]),an(this,"toastCount",0),an(this,"lastToastTime",0)}handleError(e,t=!0){const r="string"==typeof e?e:e.message;this.errors.push({id:Date.now().toString(),message:r,timestamp:Date.now(),count:1}),t&&this.shouldShowToast()&&Fr({title:"Erro",description:r,variant:"destructive"})}success(e,t){Fr({title:e,description:t,variant:"default"})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};var ln=Object.defineProperty,cn=(e,t,r)=>((e,t,r)=>t in e?ln(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const un=import.meta.env.VITE_SUPABASE_URL,dn=import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY,fn=class e{constructor(){cn(this,"client"),cn(this,"currentToken",null),cn(this,"instanceCount",0),cn(this,"isRegenerating",!1),this.instanceCount++,this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:dn};return e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`),Ze(un,dn,{auth:{persistSession:!1,autoRefreshToken:!1,storage:void 0},global:{headers:t}})}static getInstance(){return e.instance||(e.instance=new e),e.instance}getClient(){nn.getValidSupabaseToken()||!nn.areAllTokensValid()||this.isRegenerating||this.attemptTokenRegeneration();const e=nn.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}async attemptTokenRegeneration(){if(!this.isRegenerating){this.isRegenerating=!0;try{const e=nn.getAccessToken(),t=nn.getSelectedAlias();if(!e||!t)return;const{AuthService:r}=await Promise.resolve().then(function(){return Mo}),n=await r.generateSupabaseToken(e,t);n&&nn.setSupabaseToken(n)}catch(e){console.error("[Supabase] Erro ao regenerar token:",e)}finally{this.isRegenerating=!1}}}isTokenValid(e){try{const t=JSON.parse(atob(e.split(".")[1])),r=Math.floor(Date.now()/1e3);return t.exp>r}catch(e){return sn.handleError(e instanceof Error?e:"❌ Supabase - Error validating token",!1),!1}}};cn(fn,"instance");let pn=fn;const hn=()=>pn.getInstance().getClient();var mn=Object.defineProperty,yn=(e,t,r)=>((e,t,r)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);const gn=new class{constructor(){yn(this,"baseUrl",import.meta.env.VITE_QUALIEX_API_URL)}async makeApiCall(e,t,r){const n=nn.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!r||""===r.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const o=new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,t)});const a=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":r}});if(!a.ok)throw new Error(`API call failed: ${a.status} ${a.statusText}`);return await a.json()}mapToQualiexUser(e){return{userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível"}}async fetchUsers(e,t){try{const r=await this.makeApiCall("/api/common/v1/companiesusers",{companyId:t,search:"",filterStatus:"active"},e);let n=r;if(r.data)n=r.data;else{if(!Array.isArray(r))return sn.handleError("[QualiexApi] Unexpected response format",!1),[];n=r}if(!Array.isArray(n))return sn.handleError("[QualiexApi] Response is not an array",!1),[];return n.map(this.mapToQualiexUser)}catch(e){return sn.handleError(e instanceof Error?e:"[QualiexApi] Error fetching users"),[]}}async fetchUserById(e,t,r){try{return(await this.fetchUsers(t,r)).find(t=>t.userId===e)||null}catch(e){return sn.handleError(e instanceof Error?e:"[QualiexApi] Error fetching user by ID"),null}}async getUsers(e){const t=nn.extractTokenData();return t&&t.companyId?this.fetchUsers(e,t.companyId):(sn.handleError("[QualiexApi] CompanyId não encontrado no token Supabase",!1),[])}};class vn{static async extractTokenData(){const e=nn.extractTokenData();return e||(sn.handleError("[QualiexEnrichment] ❌ Token Supabase não encontrado",!1),null)}static async enrichWithResponsibleNames(e,t){if(!e||0===e.length)return sn.handleError(`[QualiexEnrichment.${t.entityName}] Nenhuma entidade encontrada`,!1),e;try{const r=await this.extractTokenData();if(!r)return e.map(e=>({...e,responsible_name:e.id_user?"Token não encontrado":null}));const{alias:n,companyId:o}=r;if(!n||!o)return sn.handleError(`[QualiexEnrichment.${t.entityName}] DADOS OBRIGATÓRIOS FALTANDO - alias: ${!!n}, companyId: ${!!o}`,!1),e.map(e=>({...e,responsible_name:e.id_user?`Configuração incompleta (alias: ${!!n}, companyId: ${!!o})`:null}));const a=await gn.getUsers(n),i=e.map(e=>{if(e.id_user){const t=a.find(t=>t.userId===e.id_user);return{...e,responsible_name:t?.userName||`ID não encontrado: ${e.id_user}`}}return{...e,responsible_name:null}});i.filter(e=>e.responsible_name&&!e.responsible_name.includes("ID não encontrado")&&!e.responsible_name.includes("Erro:")&&!e.responsible_name.includes("Token não encontrado")&&!e.responsible_name.includes("Configuração incompleta")).length;return i}catch(r){return sn.handleError(r instanceof Error?r:`[QualiexEnrichment.${t.entityName}] 💥 ERRO CRÍTICO`),e.map(e=>({...e,responsible_name:e.id_user?`Erro: ${r.message}`:null}))}}}const bn={oauth:{authUrl:import.meta.env.VITE_OAUTH_AUTH_URL,clientId:import.meta.env.VITE_OAUTH_CLIENT_ID,responseType:"id_token token",scope:"openid profile email"}},xn={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},wn={debounceDelay:500},Nn=()=>{const e=window.location.origin;return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("id-preview")||e.includes("lovable.dev")||import.meta.env.DEV},jn={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]};let _n={enableUserEnrichment:!1,enableUsersApi:!1};const kn=()=>_n,On=e=>{_n={..._n,...e}},En={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},Sn=["responsible_name"];function An(e,t,r){const n="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:r||"central"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"central",...e},{tableName:o,searchFields:a,selectFields:i,schemaName:s,entityName:l,enableQualiexEnrichment:c=!1}=n,u=()=>{if(!nn.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return hn().schema(s).from(o)};return{async getAll(e={}){const{search:t="",sortField:r="updated_at",sortDirection:n="desc",page:s=1,limit:d=25,...f}=e;let p=u().select(i||"*",{count:"exact"});p=p.eq("is_removed",!1),Object.entries(f).forEach(([e,t])=>{null!=t&&""!==t&&(p=Array.isArray(t)?p.in(e,t):"object"==typeof t&&t&&"operator"in t&&"not_null"===t.operator?p.not(e,"is",null):p.eq(e,t))}),p=((e,t)=>{if(t&&a.length>0){const r=a.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(r)}return e})(p,t),p=p.order(r,{ascending:"asc"===n}),p=((e,t,r)=>{const n=(t-1)*r,o=n+r-1;return e.range(n,o)})(p,s,d);const{data:h,error:m,count:y}=await p;if(m)throw new Error(`Error fetching ${o}: ${m.message}`);let g=((e,t,r,n)=>{const o=Math.ceil((t||0)/n);return{data:e,currentPage:r,totalPages:o,totalItems:t||0,itemsPerPage:n,hasNextPage:r<o,hasPreviousPage:r>1}})(h||[],y,s,d);const v=kn();if(c&&v.enableUserEnrichment&&l&&g.data.length>0){if(g.data.some(e=>e.id_user)){if(r&&(b=r,Sn.includes(b))){const t={...e,page:1,limit:500,sortField:void 0,sortDirection:void 0},o=await this.getAll(t);if(!o?.data?.length)return o;const a=((e,t,r)=>[...e].sort((e,n)=>{const o=e[t]||"",a=n[t]||"",i=o.localeCompare(a,"pt-BR",{sensitivity:"base"});return"asc"===r?i:-i}))(await vn.enrichWithResponsibleNames(o.data,{entityName:l}),r,n),i=((e,t=1,r=25)=>{const n=(t-1)*r,o=n+r,a=e.slice(n,o);return{data:a,pagination:{currentPage:t,totalPages:Math.ceil(e.length/r),totalItems:a.length,totalCount:e.length,itemsPerPage:r,hasNextPage:o<e.length,hasPreviousPage:t>1}}})(a,s,d);return{data:i.data,currentPage:i.pagination.currentPage,totalPages:i.pagination.totalPages,totalItems:i.pagination.totalItems,itemsPerPage:i.pagination.itemsPerPage,hasNextPage:i.pagination.hasNextPage,hasPreviousPage:i.pagination.hasPreviousPage}}const t=await vn.enrichWithResponsibleNames(g.data,{entityName:l});g={...g,data:t}}}var b;return g},async getById(e){const{data:t,error:r}=await u().select(i||"*").eq("id",e).maybeSingle();if(r)throw new Error(`Error fetching ${o}: ${r.message}`);return t},async create(e){const t=Dt(e),r=Object.entries(t).reduce((e,[t,r])=>(void 0!==r&&(e[t]=r),e),{}),{data:n,error:a}=await u().insert(r).select().single();if(a)throw new Error(`Error creating ${o}: ${a.message}`);if(!n)throw new Error(`No data returned from create ${o} operation`);return n},async update(e,t){const r={...Dt(t),updated_at:(new Date).toISOString()},{data:n,error:a}=await u().update(r).eq("id",e).select().single();if(a)throw new Error(`Error updating ${o}: ${a.message}`);if(!n)throw new Error(`No data returned from update ${o} operation`);return n},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:r}=await u().update(t).eq("id",e);if(r)throw new Error(`Error soft deleting ${o}: ${r.message}`)}}}function Tn({queryKey:e,service:t,entityName:o,searchFields:a,additionalFilters:i={},onSuccess:s}){const[l,c]=Je(),u=Ge(),d=l.get("search")||"",f=l.get("sortField")||xn.sorting.defaultField,p=l.get("sortDirection")||xn.sorting.defaultDirection,h=parseInt(l.get("page")||"1"),m=parseInt(l.get("limit")||String(xn.pagination.defaultPageSize)),y=d,g=r(()=>({search:y,sortField:f,sortDirection:p,page:h,limit:m,...i}),[y,f,p,h,m,i]),v=n(()=>t.getAll(g),[t,g]),b=Ye({queryKey:[e,g],queryFn:v}),x=Qe({mutationFn:t.create,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),nt.success(En.success.created(o)),s?.()},onError:e=>{nt.error(`${En.error.create(o)}: ${e.message}`)}}),w=Qe({mutationFn:({id:e,data:r})=>t.update(e,r),onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),nt.success(En.success.updated(o)),s?.()},onError:e=>{nt.error(`${En.error.update(o)}: ${e.message}`)}}),N=Qe({mutationFn:t.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),nt.success(En.success.deleted(o))},onError:e=>{nt.error(`${En.error.delete(o)}: ${e.message}`)}}),j=n(e=>{const t={...Object.fromEntries(l)};Object.entries(e).forEach(([e,r])=>{""===r||0===r?delete t[e]:t[e]=String(r)}),c(t)},[l,c]),_=n(e=>{j({search:e,page:1})},[j]),k=n(e=>{j({sortField:e,sortDirection:f===e&&"asc"===p?"desc":"asc",page:1})},[f,p,j]),O=n(e=>{j({page:e})},[j]),E=n(e=>{j({limit:e,page:1})},[j]),S=n(()=>{c({})},[c]);return{entities:b.data?.data||[],pagination:{currentPage:b.data?.currentPage||1,totalPages:b.data?.totalPages||1,totalItems:b.data?.totalItems||0,itemsPerPage:b.data?.itemsPerPage||xn.pagination.defaultPageSize,hasNextPage:b.data?.hasNextPage||!1,hasPreviousPage:b.data?.hasPreviousPage||!1},isLoading:b.isLoading,isCreating:x.isPending,isUpdating:w.isPending,isDeleting:N.isPending,error:b.error,searchTerm:d,sortField:f,sortDirection:p,currentPage:h,itemsPerPage:m,createEntity:x.mutate,updateEntity:(e,t)=>w.mutate({id:e,data:t}),deleteEntity:N.mutate,handleSearch:_,handleSort:k,handlePageChange:O,handleItemsPerPageChange:E,clearFilters:S,refetch:b.refetch}}function Cn(e){const t=An({tableName:e.tableName,searchFields:e.searchFields||["title"],schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment||!0});return{service:t,useCrudHook:r=>Tn({queryKey:e.tableName,service:{...t,getAll:async(e={})=>await t.getAll({...e})},entityName:e.entityName,onSuccess:r})}}const Pn=at.Root,qn=at.Trigger,Rn=at.Portal,Ln=e.forwardRef(({className:e,...t},r)=>It.jsx(at.Overlay,{className:Mt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));Ln.displayName=at.Overlay.displayName;const In=e.forwardRef(({className:e,...t},r)=>It.jsxs(Rn,{children:[It.jsx(Ln,{}),It.jsx(at.Content,{ref:r,className:Mt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));In.displayName=at.Content.displayName;const Mn=({className:e,...t})=>It.jsx("div",{className:Mt("flex flex-col space-y-2 text-center sm:text-left bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-6 rounded-t-lg",e),...t});Mn.displayName="AlertDialogHeader";const Dn=({className:e,...t})=>It.jsx("div",{className:Mt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Dn.displayName="AlertDialogFooter";const Fn=e.forwardRef(({className:e,...t},r)=>It.jsx(at.Title,{ref:r,className:Mt("text-lg font-semibold",e),...t}));Fn.displayName=at.Title.displayName;const Bn=e.forwardRef(({className:e,...t},r)=>It.jsx(at.Description,{ref:r,className:Mt("text-sm text-muted-foreground",e),...t}));Bn.displayName=at.Description.displayName;const zn=e.forwardRef(({className:e,...t},r)=>It.jsx(at.Action,{ref:r,className:Mt(Ut(),e),...t}));zn.displayName=at.Action.displayName;const Un=e.forwardRef(({className:e,...t},r)=>It.jsx(at.Cancel,{ref:r,className:Mt(Ut({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Un.displayName=at.Cancel.displayName;const $n=({open:e,onOpenChange:t,item:r,onConfirm:n,entityName:i="item",isDeleting:s=!1})=>{const[l,c]=o("");a(()=>{e||c("")},[e]);const u=()=>{c(""),t(!1)},d=l===r?.title;return r?It.jsx(Pn,{open:e,onOpenChange:u,children:It.jsxs(In,{className:"sm:max-w-[500px]",children:[It.jsx(Mn,{children:It.jsxs("div",{className:"flex items-center space-x-2",children:[It.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-destructive/10 flex items-center justify-center",children:It.jsx("span",{className:"text-destructive font-semibold text-sm",children:"!"})}),It.jsx("div",{className:"flex-1",children:It.jsx(Fn,{className:"text-lg font-semibold",children:"Confirmar Exclusão"})})]})}),It.jsx(Bn,{asChild:!0,children:It.jsxs("div",{className:"space-y-4",children:[It.jsxs("div",{className:"text-sm text-muted-foreground",children:[It.jsxs("p",{className:"mb-2",children:["Você está prestes a excluir permanentemente o ",i,":"]}),It.jsx("div",{className:"p-3 bg-muted rounded-md border-l-4 border-l-destructive",children:It.jsx("p",{className:"font-medium text-foreground",children:r.title})})]}),It.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-md p-3",children:It.jsxs("div",{className:"flex items-start space-x-2",children:[It.jsx("div",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-orange-500 flex items-center justify-center mt-0.5",children:It.jsx("span",{className:"text-white font-bold text-xs",children:"!"})}),It.jsxs("div",{className:"text-sm text-orange-800",children:[It.jsx("p",{className:"font-medium mb-1",children:"Atenção!"}),It.jsxs("p",{children:["Esta ação não pode ser desfeita. O ",i," será removido permanentemente do sistema."]})]})]})}),It.jsxs("div",{className:"space-y-2",children:[It.jsxs(Kt,{htmlFor:"confirmation",className:"text-sm font-medium",children:["Para confirmar, digite ",It.jsxs("strong",{children:['"',r.title,'"']})," abaixo:"]}),It.jsx(Ht,{id:"confirmation",type:"text",value:l,onChange:e=>c(e.target.value),placeholder:`Digite: ${r.title}`,className:"w-full"})]})]})}),It.jsxs(Dn,{children:[It.jsx(Un,{onClick:u,children:"Cancelar"}),It.jsx(zn,{onClick:()=>{r&&l===r.title&&(n(r),c(""),t(!1))},disabled:!d||s,className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:s?"Removendo...":`Excluir ${i}`})]})]})}):null},Hn=e.forwardRef(({className:e,...t},r)=>It.jsx("table",{ref:r,className:Mt("w-full caption-bottom text-sm",e),...t}));Hn.displayName="Table";const Vn=e.forwardRef(({className:e,...t},r)=>It.jsx("thead",{ref:r,className:Mt("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));Vn.displayName="TableHeader";const Kn=e.forwardRef(({className:e,...t},r)=>It.jsx("tbody",{ref:r,className:Mt("[&_tr:last-child]:border-0",e),...t}));Kn.displayName="TableBody";const Wn=e.forwardRef(({className:e,...t},r)=>It.jsx("tfoot",{ref:r,className:Mt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Wn.displayName="TableFooter";const Zn=e.forwardRef(({className:e,...t},r)=>It.jsx("tr",{ref:r,className:Mt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Zn.displayName="TableRow";const Gn=e.forwardRef(({className:e,...t},r)=>It.jsx("th",{ref:r,className:Mt("h-12 px-4 py-3 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...t}));Gn.displayName="TableHead";const Yn=e.forwardRef(({className:e,...t},r)=>It.jsx("td",{ref:r,className:Mt("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Yn.displayName="TableCell";const Qn=e.forwardRef(({className:e,...t},r)=>It.jsx("caption",{ref:r,className:Mt("mt-4 text-sm text-muted-foreground",e),...t}));function Xn({className:e,...t}){return It.jsx("div",{className:Mt("animate-pulse rounded-md bg-muted",e),...t})}function Jn({rows:e=5,columns:t=4}){return It.jsx("div",{className:"w-full",children:It.jsxs("div",{className:"rounded-md border",children:[It.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:It.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>It.jsx(Xn,{className:"h-4 w-24"},t))})}),It.jsx("div",{children:Array.from({length:e}).map((e,r)=>It.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:It.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>It.jsx(Xn,{className:"h-4 w-20"},t))})},r))})]})})}function eo({count:e=3}){return It.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>It.jsxs(Wt,{children:[It.jsxs(Zt,{children:[It.jsx(Xn,{className:"h-4 w-3/4"}),It.jsx(Xn,{className:"h-3 w-1/2"})]}),It.jsx(Qt,{children:It.jsxs("div",{className:"space-y-2",children:[It.jsx(Xn,{className:"h-3 w-full"}),It.jsx(Xn,{className:"h-3 w-2/3"})]})})]},t))})}function to({fields:e=4}){return It.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,t)=>It.jsxs("div",{className:"space-y-2",children:[It.jsx(Xn,{className:"h-4 w-24"}),It.jsx(Xn,{className:"h-10 w-full"})]},t)),It.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[It.jsx(Xn,{className:"h-10 w-20"}),It.jsx(Xn,{className:"h-10 w-20"})]})]})}function ro(){return It.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[It.jsxs("div",{className:"flex items-center space-x-3",children:[It.jsx(Xn,{className:"h-8 w-8 rounded-full"}),It.jsx(Xn,{className:"h-6 w-32"})]}),It.jsxs("div",{className:"flex items-center space-x-2",children:[It.jsx(Xn,{className:"h-8 w-8"}),It.jsx(Xn,{className:"h-8 w-24"})]})]})}function no(){return It.jsx("div",{className:"w-64 border-r bg-muted/10",children:It.jsxs("div",{className:"p-4",children:[It.jsx(Xn,{className:"h-8 w-32 mb-6"}),It.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>It.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[It.jsx(Xn,{className:"h-4 w-4"}),It.jsx(Xn,{className:"h-4 w-20"})]},t))})]})})}Qn.displayName="TableCaption";const oo={default:S,search:E,error:O};function ao({icon:e,title:t,description:r,action:n,className:o,variant:a="default"}){const i=e?()=>e:oo[a];return It.jsxs("div",{className:Mt("flex flex-col items-center justify-center py-12 px-4 text-center",o),children:[It.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:It.jsx(i,{className:"h-8 w-8 text-muted-foreground"})}),It.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),r&&It.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),n&&It.jsx($t,{onClick:n.onClick,variant:"outline",children:n.label})]})}const io=it.Root,so=it.Trigger,lo=it.Group,co=it.Portal,uo=it.Sub,fo=it.RadioGroup,po=e.forwardRef(({className:e,inset:t,children:r,...n},o)=>It.jsxs(it.SubTrigger,{ref:o,className:Mt("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,It.jsx(A,{className:"ml-auto h-4 w-4"})]}));po.displayName=it.SubTrigger.displayName;const ho=e.forwardRef(({className:e,...t},r)=>It.jsx(it.SubContent,{ref:r,className:Mt("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));ho.displayName=it.SubContent.displayName;const mo=e.forwardRef(({className:e,sideOffset:t=4,...r},n)=>It.jsx(it.Portal,{children:It.jsx(it.Content,{ref:n,sideOffset:t,className:Mt("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-white shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-gray-800 dark:border-gray-700",e),...r})}));mo.displayName=it.Content.displayName;const yo=e.forwardRef(({className:e,inset:t,...r},n)=>It.jsx(it.Item,{ref:n,className:Mt("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));yo.displayName=it.Item.displayName;const go=e.forwardRef(({className:e,children:t,checked:r,...n},o)=>It.jsxs(it.CheckboxItem,{ref:o,className:Mt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[It.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:It.jsx(it.ItemIndicator,{children:It.jsx(_,{className:"h-4 w-4"})})}),t]}));go.displayName=it.CheckboxItem.displayName;const vo=e.forwardRef(({className:e,children:t,...r},n)=>It.jsxs(it.RadioItem,{ref:n,className:Mt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[It.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:It.jsx(it.ItemIndicator,{children:It.jsx(T,{className:"h-2 w-2 fill-current"})})}),t]}));vo.displayName=it.RadioItem.displayName;const bo=e.forwardRef(({className:e,inset:t,...r},n)=>It.jsx(it.Label,{ref:n,className:Mt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));bo.displayName=it.Label.displayName;const xo=e.forwardRef(({className:e,...t},r)=>It.jsx(it.Separator,{ref:r,className:Mt("-mx-1 my-1 h-px bg-muted",e),...t}));xo.displayName=it.Separator.displayName;const wo=({className:e,...t})=>It.jsx("span",{className:Mt("ml-auto text-xs tracking-widest opacity-60",e),...t});wo.displayName="DropdownMenuShortcut";const No=({onEdit:e,onDelete:t,onToggleStatus:r,isActive:n=!0,canDelete:o=!0,renderAs:a})=>{const i=[];if(e){const t={icon:C,label:"Editar",onClick:e};i.push(t)}if(r){const e={icon:n?P:q,label:n?"Inativar":"Ativar",onClick:r};i.push(e)}if(o&&t){const e={icon:R,label:"Remover",onClick:t,destructive:!0};i.push(e)}return"dropdown"===a?It.jsx(It.Fragment,{children:i.map((e,t)=>It.jsxs(yo,{onClick:e.onClick,className:e.destructive?"text-destructive":"",children:[It.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},t))}):It.jsx(It.Fragment,{children:i.map((e,t)=>It.jsxs($t,{variant:"ghost",size:"sm",onClick:e.onClick,className:"w-full justify-start h-auto py-2 px-3 text-sm font-normal "+(e.destructive?"text-destructive hover:text-destructive":""),children:[It.jsx(e.icon,{className:"h-4 w-4 mr-2"}),e.label]},t))})},jo=({onEdit:e,onDelete:t,canDelete:r=!0,onToggleStatus:n,isActive:o=!0})=>It.jsxs(io,{children:[It.jsx(so,{asChild:!0,children:It.jsx($t,{variant:"default",size:"sm",className:"h-7 px-2 text-xs bg-primary text-primary-foreground hover:bg-primary/90",children:It.jsx(L,{size:12})})}),It.jsx(mo,{align:"end",children:It.jsx(No,{onEdit:t=>{t?.stopPropagation(),e?.()},onDelete:e=>{e?.stopPropagation(),t?.()},onToggleStatus:e=>{e?.stopPropagation(),n?.()},isActive:o,canDelete:r,renderAs:"dropdown"})})]}),_o=({manager:e,columns:t,onEdit:r,onView:n,onToggleStatus:i,onDelete:s,renderActions:l})=>{const[c,u]=o(!1),[d,f]=o(null);a(()=>{const e=()=>u(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),a(()=>{const e=()=>f(null);if(d)return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[d]);const p=(()=>{t.length;let e=0;const r=t.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const r=t.minWidth||120,n=t.weight||1;return e+=r,{...t,calculatedWidth:r,weight:n,isFixed:!1}}});return e+=100,r.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})();return c?e.isLoading?It.jsx(eo,{count:3}):0===e.entities.length?It.jsx(ao,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"}):It.jsxs("div",{className:"space-y-4",children:[e.entities.map(e=>It.jsx(Wt,{className:"overflow-hidden cursor-pointer hover:bg-muted/50",onClick:t=>{t.stopPropagation(),r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),f({x:t.clientX,y:t.clientY,item:e})},children:It.jsxs(Qt,{className:"p-4",children:[t.map(t=>It.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[It.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[t.header,":"]}),It.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:t.render?t.render(e):e[t.key]})]},String(t.key))),(r||n||l)&&It.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:l?l(e):It.jsx(jo,{onEdit:r?()=>{r(e)}:void 0,onDelete:s?()=>s(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived})})]})},e.id)),d&&It.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:d.x,top:d.y},onClick:e=>e.stopPropagation(),children:It.jsx(No,{onEdit:r?()=>{r(d.item),f(null)}:void 0,onDelete:s?()=>{s(d.item),f(null)}:void 0,onToggleStatus:i?()=>{i(d.item),f(null)}:void 0,isActive:d.item.is_actived,canDelete:!!s,renderAs:"context"})})]}):It.jsxs("div",{className:"flex flex-col h-full",children:[e.isLoading?It.jsx(Jn,{rows:5,columns:t.length}):It.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:It.jsx("div",{className:"flex-1 overflow-auto",children:It.jsxs(Hn,{className:"table-fixed",children:[It.jsxs("colgroup",{children:[p.map((e,t)=>It.jsx("col",{style:e.style},t)),It.jsx("col",{style:{width:"100px"}})]}),It.jsx(Vn,{children:It.jsxs(Zn,{children:[t.map(t=>{return It.jsx(Gn,{className:`${t.className||""} ${t.sortable?"cursor-pointer hover:bg-muted/50":""}`,onClick:t.sortable?()=>e.handleSort(String(t.key)):void 0,children:It.jsxs("div",{className:"flex items-center "+(t.className?.includes("text-center")?"justify-center":""),children:[t.header,t.sortable&&(r=String(t.key),e.sortField!==r?It.jsx(I,{size:14,className:"ml-1 opacity-50"}):"asc"===e.sortDirection?It.jsx(M,{size:14,className:"ml-1"}):It.jsx(D,{size:14,className:"ml-1"}))]})},String(t.key));var r}),It.jsx(Gn,{className:"w-[100px] text-center",children:"Ações"})]})}),It.jsx(Kn,{children:0===e.entities.length?It.jsx(Zn,{children:It.jsx(Yn,{colSpan:t.length+1,className:"h-32",children:It.jsx(ao,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"})})}):e.entities.map(e=>It.jsxs(Zn,{className:"cursor-pointer hover:bg-muted/50",onClick:t=>{t.stopPropagation(),r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),f({x:t.clientX,y:t.clientY,item:e})},children:[t.map(t=>It.jsx(Yn,{className:t.className,children:t.render?t.render(e):e[t.key]},String(t.key))),It.jsx(Yn,{className:"text-center",children:l?l(e):It.jsx(jo,{onEdit:r?()=>r(e):void 0,onDelete:s?()=>s(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived})})]},e.id))})]})})}),d&&It.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:d.x,top:d.y},onClick:e=>e.stopPropagation(),children:It.jsx(No,{onEdit:r?()=>{r(d.item),f(null)}:void 0,onDelete:s?()=>{s(d.item),f(null)}:void 0,onToggleStatus:i?()=>{i(d.item),f(null)}:void 0,isActive:d.item.is_actived,canDelete:!!s,renderAs:"context"})})]})};function ko(e,t,n,i){const[s,l]=o({}),[c,u]=o({}),d=r(()=>e,[e]),f=e=>e instanceof Date&&!isNaN(e.getTime()),p=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},h=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(t){return p(e)}},m=(e,t,r)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let n;if("function"==typeof e.validation?n=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(n=e.validation.custom),n)try{const e=n(t,r);if(e)return e}catch(e){}}};a(()=>{if(!i)return;const e=t=>{const r=[];return t.forEach(t=>{r.push(t),t.fields&&r.push(...e(t.fields))}),r},r=e(d),o={};r.forEach(e=>{let r;if(t&&void 0!==t[e.name]){if(r=t[e.name],null==r&&(r=""),"date"===e.type&&r)if("string"==typeof r){const e=new Date(r);f(e)&&(r=e.toISOString().split("T")[0])}else f(r)&&(r=r.toISOString().split("T")[0])}else r=p(e);o[e.name]=r}),r.forEach(e=>{const t=h(e,o);void 0!==t&&(o[e.name]=t)}),l(o),u({}),n&&n(o)},[d,t,n,i]);const y=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...y(e.fields))}),t},g=()=>{const e=y(d),t={};return e.forEach(e=>{const r=m(e,s[e.name],s);r&&(t[e.name]=r)}),u(t),0===Object.keys(t).length};return{formData:s,errors:c,updateField:(e,t)=>{l(r=>{const o={...r,[e]:t},a=((e,t)=>{let r={...t};const n=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...n(e.fields))}),t};return n(d).filter(t=>t.dependsOn===e).forEach(e=>{const t=h(e,r);void 0!==t&&(r={...r,[e.name]:t})}),r})(e,o);return n&&n(a),a}),c[e]&&u(t=>{const r={...t};return delete r[e],r});const r=y(d).find(t=>t.name===e);if(r){const n=m(r,t,s);n&&u(t=>({...t,[e]:n}))}},validateForm:g,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),g()&&e(s)}}}const Oo=st.Root,Eo=st.Trigger,So=e.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>It.jsx(st.Portal,{children:It.jsx(st.Content,{ref:o,align:t,sideOffset:r,className:Mt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));So.displayName=st.Content.displayName;const Ao=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#84cc16","#f97316","#ec4899","#6b7280"],To=({value:e="#3b82f6",onChange:t,label:r})=>It.jsxs("div",{className:"space-y-2",children:[r&&It.jsx(Kt,{children:r}),It.jsxs(Oo,{children:[It.jsx(Eo,{asChild:!0,children:It.jsxs($t,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[It.jsx("div",{className:"h-4 w-4 rounded border mr-2",style:{backgroundColor:e}}),e]})}),It.jsx(So,{className:"w-64",children:It.jsxs("div",{className:"space-y-3",children:[It.jsxs("div",{children:[It.jsx(Kt,{htmlFor:"color-input",children:"Cor personalizada"}),It.jsx(Ht,{id:"color-input",type:"color",value:e,onChange:e=>t?.(e.target.value),className:"h-10 w-full"})]}),It.jsxs("div",{children:[It.jsx(Kt,{children:"Cores predefinidas"}),It.jsx("div",{className:"grid grid-cols-5 gap-2 mt-2",children:Ao.map(e=>It.jsx("button",{className:"h-8 w-8 rounded border-2 border-border hover:border-primary",style:{backgroundColor:e},onClick:()=>t?.(e),"aria-label":`Selecionar cor ${e}`},e))})]})]})})]})]}),Co=e.forwardRef(({className:e,children:t,...r},n)=>It.jsxs(lt.Root,{ref:n,className:Mt("relative overflow-hidden",e),...r,children:[It.jsx(lt.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),It.jsx(Po,{}),It.jsx(lt.Corner,{})]}));Co.displayName=lt.Root.displayName;const Po=e.forwardRef(({className:e,orientation:t="vertical",...r},n)=>It.jsx(lt.ScrollAreaScrollbar,{ref:n,orientation:t,className:Mt("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:It.jsx(lt.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Po.displayName=lt.ScrollAreaScrollbar.displayName;const qo={Star:Te,Heart:Ae,Home:Se,User:Ee,Settings:Oe,Mail:ke,Phone:_e,Calendar:je,MapPin:Ne,Camera:we,Image:xe,Music:be,Video:ve,Book:ge,Bookmark:ye,Search:E,Filter:me,Edit:C,Trash2:R,Plus:he,Minus:pe,Check:_,X:w,ChevronDown:N,ChevronUp:j,ChevronLeft:fe,ChevronRight:A,ArrowUp:M,ArrowDown:D,ArrowLeft:de,ArrowRight:ue,Clock:ce,Bell:le,AlertCircle:O,Info:se,HelpCircle:ie,Download:ae,Upload:oe,Share:ne,Copy:re,Save:te,FileText:ee,Folder:J,FolderOpen:X,Archive:Q,Lock:Y,Unlock:G,Eye:Z,EyeOff:W,Shield:K,Key:V,Zap:H,Flame:$,Sparkles:U,Award:z,Trophy:B,Target:F},Ro=({value:e="Star",onChange:t,label:r})=>{const[n,a]=o(""),i=Object.entries(qo).filter(([e])=>e.toLowerCase().includes(n.toLowerCase())),s=qo[e]||Te;return It.jsxs("div",{className:"space-y-2",children:[r&&It.jsx(Kt,{children:r}),It.jsxs(Oo,{children:[It.jsx(Eo,{asChild:!0,children:It.jsxs($t,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[It.jsx(s,{className:"h-4 w-4 mr-2"}),e]})}),It.jsx(So,{className:"w-80",children:It.jsxs("div",{className:"space-y-3",children:[It.jsxs("div",{children:[It.jsx(Kt,{htmlFor:"icon-search",children:"Buscar ícone"}),It.jsx(Ht,{id:"icon-search",placeholder:"Digite o nome do ícone...",value:n,onChange:e=>a(e.target.value)})]}),It.jsx(Co,{className:"h-48",children:It.jsx("div",{className:"grid grid-cols-6 gap-2",children:i.map(([r,n])=>It.jsx("button",{className:"p-2 rounded border-2 hover:border-primary "+(e===r?"border-primary bg-primary/10":"border-border"),onClick:()=>t?.(r),title:r,children:It.jsx(n,{className:"h-4 w-4"})},r))})})]})})]})]})},Lo=()=>{nn.clearManualLogout()};class Io{static async initialize(){try{if(!nn.hasAllTokens()||!nn.areAllTokensValid())return nn.clearExpiredTokens(),{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null};const e=nn.getAccessToken(),t=nn.getIdToken();Lo();const r=this.extractUserFromIdToken(t),n=this.extractCompaniesFromIdToken(t),o=this.extractAliasFromAccessToken(e),a=nn.getSelectedAlias(),i=a&&n.some(e=>e.alias===a)?a:o||n[0]?.alias||null;if(!nn.isSupabaseTokenValid()&&i){const t=await this.generateSupabaseToken(e,i);t&&nn.setSupabaseToken(t)}let s=null;if(i){const e=nn.getCompanyId(i),t=n.find(e=>e.alias===i);t&&(s={id:e||t.id,name:t.name,alias:t.alias})}return{isAuthenticated:!0,isLoading:!1,user:r,alias:i,companies:n,selectedUnit:s,userId:r?.id||null,userAlias:r?.id||null}}catch(e){return console.error("[Auth] Erro na inicialização:",e),{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null}}}static async loginDev(){try{const e=hn(),{data:t,error:r}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(r)return console.error("[Auth] Erro na Edge Function dev-tokens:",r),!1;if(!t?.access_token||!t?.id_token)return console.error("[Auth] Tokens ausentes na resposta"),!1;const n=new URL("/callback",window.location.origin);return n.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=n.toString(),!0}catch(e){return console.error("[Auth] Erro no login dev:",e),!1}}static loginProd(){const e=nn.generateOAuthState();nn.setOAuthState(e);const t=nn.generateOAuthNonce();nn.setOAuthNonce(t);const r=`${window.location.origin}/callback`,n=new URL(bn.oauth.authUrl);n.searchParams.set("client_id",bn.oauth.clientId),n.searchParams.set("response_type",bn.oauth.responseType),n.searchParams.set("scope",bn.oauth.scope),n.searchParams.set("redirect_uri",r),n.searchParams.set("state",e),n.searchParams.set("nonce",t),n.searchParams.set("response_mode","fragment"),Nn(),window.location.href=n.toString()}static async processCallback(){try{if(nn.hasAllTokens()){if(!nn.getValidSupabaseToken()){const e=nn.getAccessToken(),t=this.extractAliasFromAccessToken(e),r=this.extractCompaniesFromIdToken(nn.getIdToken())[0]?.alias,n=t||r;if(n){const t=await this.generateSupabaseToken(e,n);t&&nn.setSupabaseToken(t)}}return!0}const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),r=r=>e.get(r)||t.get(r),n=r("access_token"),o=r("id_token"),a=r("error");if(a)throw new Error(`Erro OAuth: ${a}`);if(!n||!o)throw new Error("Tokens não encontrados na URL de callback");nn.setAccessToken(n),nn.setIdToken(o),Lo();const i=this.extractAliasFromAccessToken(n);if(i){const e=await this.generateSupabaseToken(n,i);if(!e)throw new Error("Falha ao gerar token Supabase");nn.setSupabaseToken(e)}else{const e=this.extractCompaniesFromIdToken(o);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");const t=e[0].alias,r=await this.generateSupabaseToken(n,t);if(!r)throw new Error("Falha ao gerar token Supabase");nn.setSupabaseToken(r)}return nn.clearOAuthState(),nn.clearOAuthNonce(),!0}catch(e){throw console.error("❌ [CallbackPage] Erro ao processar callback:",e),e}}static logout(){nn.setManualLogout(),nn.clearAll(),window.location.href="/login"}static decodeToken(e){try{const t=e.split(".")[1],r=atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);const o=new TextDecoder("utf-8").decode(n);return JSON.parse(o)}catch{return null}}static extractUserFromIdToken(e){const t=this.decodeToken(e);return t?{id:t.subNewId,email:t.email,name:t.name,identifier:t.identifier}:null}static extractCompaniesFromIdToken(e){const t=this.decodeToken(e);if(!t)return[];const r=[];return Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const n=t[e].split(";");if(n.length>=4)r.push({id:n.length>7?n[7].trim():"",alias:n[0].trim(),name:n[3].trim()});else{const[n,o]=t[e].split("|");n&&o&&r.push({id:"",alias:n.trim(),name:o.trim()})}}}),r}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}static async generateSupabaseToken(e,t){try{const r=hn(),{data:n,error:o}=await r.functions.invoke("validate-token",{body:{access_token:e,alias:t}});return o?(console.error("[Auth] Erro na Edge Function validate-token:",o),o.message?.includes("401")||o.message?.includes("Unauthorized")?(console.warn("[Auth] Tokens Qualiex expirados, forçando logout"),this.logout(),null):null):n?.access_token?n.access_token:(console.error("[Auth] Token Supabase ausente na resposta"),null)}catch(e){return console.error("[Auth] Erro ao gerar token Supabase:",e),e instanceof Error&&(e.message.includes("401")||e.message.includes("Unauthorized"))&&(console.warn("[Auth] Possível token expirado, forçando logout"),this.logout()),null}}}var Mo=Object.freeze({__proto__:null,AuthService:Io});class Do{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(console.warn("[AuthErrorInterceptor] Erro de autenticação detectado, limpando tokens e forçando logout"),nn.clearAll(),window.location.href="/",!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const r=t.toLowerCase();return["401","unauthorized","token","expired","invalid","authentication","login","session"].some(e=>r.includes(e))}static async wrapAsync(e){try{return await e}catch(e){if(!this.handleError(e))throw e;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}const Fo=i(void 0),Bo=({children:e})=>{const[t,i]=o({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null}),s=Ge(),[l,c]=o(!1),[u,d]=o(0),f=n(e=>{i(t=>({...t,...e}))},[]),p=n(e=>{i(t=>({...t,isLoading:e}))},[]),h=n(()=>{i({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null})},[]),m=n(async e=>{try{p(!0);const t=nn.getAccessToken();if(!t)return void console.error("[AuthContext] Access token não encontrado para trocar unidade");const r=await Io.generateSupabaseToken(t,e.alias);if(!r)return void console.error("[AuthContext] Erro ao gerar token Supabase para nova unidade");nn.setSupabaseToken(r),nn.setSelectedAlias(e.alias);const n={id:nn.getCompanyId(e.alias)||e.id,name:e.name,alias:e.alias};f({alias:e.alias,selectedUnit:n}),await s.invalidateQueries()}catch(t){console.error("[AuthContext] Erro ao trocar unidade",t,e)}finally{p(!1)}},[f,s,p]),y=n(async()=>await Io.processCallback(),[]),g=n(async()=>{Io.logout(),h(),await s.clear()},[h,s]),v=n(e=>{c(e)},[]),b=n(()=>{d(e=>e+1)},[]),x=n(()=>{d(e=>e+1)},[]);a(()=>{if(!t.isAuthenticated)return;let e=!0;const r=setInterval(()=>{e&&(nn.areAllTokensValid()||(console.warn("[AuthContext] Tokens expirados detectados, fazendo logout"),e&&g()))},6e5);return()=>{e=!1,clearInterval(r)}},[t.isAuthenticated,g]),a(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await Io.initialize();if(!e)return;t&&t.isAuthenticated?f({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias}):e&&p(!1)}catch(t){console.error("[AuthContext] Erro na inicialização da autenticação",t),e&&(Do.handleError(t),p(!1))}})(),()=>{e=!1}},[f,p,g]);const w=r(()=>({...t,logout:g,processCallback:y,switchUnit:m,availableUnits:t.companies,isSearchVisible:l,setSearchVisible:v,clearSearch:b,refreshData:x}),[t,g,y,m,l,v,b,x]);return It.jsx(Fo.Provider,{value:w,children:e})},zo=()=>{const e=s(Fo);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e},Uo=(e={})=>{const{user:t,alias:r}=zo(),n=kn(),{enabled:o=n.enableUsersApi}=e;return Ye({queryKey:["qualiex-users",r],queryFn:()=>gn.getUsers(r),enabled:o&&!!r&&!!t,retry:2,retryDelay:1e3})},$o=({value:e="",onChange:t,placeholder:r="Selecionar usuário",disabled:n,className:o,enabled:a})=>{const{data:i=[],isLoading:s,error:l}=Uo({enabled:a});return s?It.jsx(Xn,{className:Mt("h-10 w-full",o)}):l?It.jsxs("div",{className:`flex items-center gap-2 p-2 border border-destructive/20 rounded-md ${o}`,children:[It.jsx(O,{className:"h-4 w-4 text-destructive"}),It.jsx("span",{className:"text-sm text-destructive",children:"Erro ao carregar usuários"})]}):It.jsxs(vr,{value:e,onValueChange:t,disabled:n||0===i.length,children:[It.jsx(xr,{className:o,children:It.jsx(br,{placeholder:r})}),It.jsx(jr,{children:0===i.length?It.jsx(_r,{value:"no-users",disabled:!0,children:"Nenhum usuário encontrado"}):i.map(e=>It.jsx(_r,{value:e.userId,children:e.userName},e.userId))})]})},Ho=({value:e,onChange:t,placeholder:r="Selecionar responsável",disabled:n,className:o})=>It.jsxs(vr,{value:e,onValueChange:t,disabled:n,children:[It.jsx(xr,{className:o,children:It.jsx(br,{placeholder:r})}),It.jsx(jr,{children:It.jsx(_r,{value:"placeholder",children:"Responsável placeholder"})})]});function Vo({title:e,sections:a,initialData:i,onSubmit:s,onCancel:l,open:c,submitButtonText:u="Salvar",isLoading:d=!1,usersData:f}){const[p,h]=o(a?.[0]?.id||""),m=r(()=>a&&Array.isArray(a)?a.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[a]),{formData:y,errors:g,updateField:v,handleSubmit:b}=ko(m,i,void 0,c),x=r(()=>a&&Array.isArray(a)?a.map(e=>({...e,disabled:e.condition?!e.condition(y):e.disabled||!1})):[],[a,y]),w=r(()=>{const e=x.find(e=>e.id===p);if(e&&!e.disabled)return p;const t=x.find(e=>!e.disabled);return t?.id||p},[x,p]);t.useEffect(()=>{w!==p&&h(w)},[w,p]);const N=x.find(e=>e.id===w),j=e=>{const t=(e.computedValue,y[e.name]),r=void 0!==t?t:"",n=g[e.name];switch(e.type){case"group":return It.jsxs("div",{className:"space-y-2",children:[e.label,It.jsx("div",{className:e.className||("horizontal"===e.layout?"flex gap-3":"space-y-3"),children:e.fields?.map(e=>j(e))})]},e.name);case"user-select":return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx($o,{value:r||"",onChange:t=>v(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:n?"border-red-500":""}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"textarea":return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx(Or,{id:e.name,value:r||"",onChange:t=>{v(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"select":return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsxs(vr,{value:String(r),onValueChange:t=>{v(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[It.jsx(xr,{className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,children:It.jsx(br,{placeholder:e.placeholder})}),It.jsx(jr,{children:e.options?.map(e=>It.jsx(_r,{value:e.value,children:e.label},e.value))})]}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"date":return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx(Ht,{id:e.name,type:"date",value:String(r),onChange:t=>v(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Mt("w-full",n?"border-red-500":"",e.disabled?"bg-gray-100 cursor-not-allowed":"")}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"single-responsible-select":return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx(Ho,{value:String(r),onChange:t=>v(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:n?"border-red-500":""}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"simple-qualiex-user-field":const t=kn();return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx($o,{value:r??"",onChange:t=>v(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:n?"border-red-500":"",enabled:t.enableUsersApi}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"color":return It.jsxs("div",{children:[It.jsxs(Kt,{htmlFor:e.name,children:[e.label," ",e.required&&It.jsx("span",{className:"text-destructive",children:"*"})]}),It.jsx(Ht,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:t=>v(e.name,t.target.value),className:"h-10"}),n&&It.jsx("p",{className:"text-sm text-destructive mt-1",children:n})]},e.name);case"color-picker":return It.jsxs("div",{children:[It.jsx(To,{label:`${e.label} ${e.required?"*":""}`,value:r||e.defaultValue||"#3b82f6",onChange:t=>v(e.name,t)}),n&&It.jsx("p",{className:"text-sm text-destructive mt-1",children:n})]},e.name);case"icon-picker":return It.jsxs("div",{children:[It.jsx(Ro,{label:`${e.label} ${e.required?"*":""}`,value:r||e.defaultValue||"Star",onChange:t=>v(e.name,t)}),n&&It.jsx("p",{className:"text-sm text-destructive mt-1",children:n})]},e.name);case"number":return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx(Ht,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:t=>{const r=t.target.value,n=""===r?null:Number(r);v(e.name,n)},placeholder:e.placeholder,disabled:e.disabled,className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);default:return It.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[It.jsx(Kt,{htmlFor:e.name,children:e.label}),It.jsx(Ht,{id:e.name,type:"text",value:r||"",onChange:t=>{v(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,readOnly:e.disabled}),n&&It.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name)}},_=n(()=>{if(!N)return null;if(N.disabled)return It.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[It.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:It.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:It.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),It.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),It.jsx("p",{className:"text-muted-foreground max-w-sm",children:'Complete as informações obrigatórias na seção "Informações Gerais" para acessar esta seção.'})]});if(N.component){const e=N.component;return It.jsx(e,{formData:y,updateField:v,errors:g,users:f,disabled:N.disabled})}return It.jsx("div",{className:"space-y-3",children:N.fields.map(j)})},[N,y,v,g,f,j]),k=It.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[x.length>1&&It.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:It.jsx("div",{className:"flex space-x-2",children:x.map(e=>It.jsx($t,{variant:w===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=x.find(t=>t.id===e);t&&!t.disabled&&h(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),It.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 pt-0 pb-2 md:pb-4",children:d?It.jsx("div",{className:"flex items-center justify-center py-12",children:It.jsx("div",{className:"text-muted-foreground",children:"Carregando dados..."})}):It.jsxs("form",{onSubmit:b(s),className:"space-y-3 md:space-y-4",children:[_(),It.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[It.jsx($t,{type:"button",variant:"outline",onClick:l,children:"Cancelar"}),It.jsx($t,{type:"submit",disabled:d,children:u})]})]})})]});return It.jsx(Jt,{open:c,onOpenChange:e=>{!1===e&&!0===c&&l()},children:It.jsxs(or,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[It.jsxs(ar,{className:"bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-4",children:[It.jsx(sr,{className:"text-white",children:e}),It.jsx(lr,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),k]})})}function Ko({open:e,title:t,sections:r,initialData:n,onSubmit:o,onCancel:a,isLoading:i=!1,submitButtonText:s="Salvar"}){return It.jsx(Vo,{open:e,title:t,sections:r,initialData:n,onSubmit:o,onCancel:a,isLoading:i,submitButtonText:s})}const Wo=({manager:e})=>{const{pagination:t={totalItems:0,totalPages:1},currentPage:r=1,itemsPerPage:n=10,handlePageChange:o=()=>{},handleItemsPerPageChange:a=()=>{}}=e,{totalItems:i=0,totalPages:s=1}=t,l=i>0?(r-1)*n+1:0,c=Math.min(r*n,i);return It.jsxs("div",{className:"px-4 h-12 flex items-center justify-between text-sm text-muted-foreground bg-muted/50 border-t border-border flex-shrink-0 mt-auto",children:[It.jsxs("div",{className:"flex items-center space-x-3",children:[It.jsx("span",{children:"Itens por página"}),It.jsxs(vr,{value:n.toString(),onValueChange:e=>a(Number(e)),children:[It.jsx(xr,{className:"w-20 h-8 border-border",children:It.jsx(br,{})}),It.jsxs(jr,{children:[It.jsx(_r,{value:"10",children:"10"}),It.jsx(_r,{value:"25",children:"25"}),It.jsx(_r,{value:"50",children:"50"}),It.jsx(_r,{value:"100",children:"100"})]})]})]}),It.jsx("div",{className:"flex-1 flex justify-center",children:It.jsx("span",{children:i>0?`${l}-${c} de ${i} itens (página ${r} de ${s})`:"0 itens"})}),It.jsxs("div",{className:"flex items-center space-x-1",children:[It.jsx($t,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:1===r,children:It.jsx(Ce,{className:"h-4 w-4"})}),It.jsx($t,{variant:"outline",size:"sm",onClick:()=>o(Math.max(1,r-1)),disabled:1===r,children:It.jsx(fe,{className:"h-4 w-4"})}),It.jsx($t,{variant:"outline",size:"sm",onClick:()=>o(Math.min(s,r+1)),disabled:r===s,children:It.jsx(A,{className:"h-4 w-4"})}),It.jsx($t,{variant:"outline",size:"sm",onClick:()=>o(s),disabled:r===s,children:It.jsx(Pe,{className:"h-4 w-4"})})]})]})};function Zo({manager:e,config:t,formSections:r,onSave:n,FormComponent:a,TableComponent:i,onToggleStatus:s}){const[l,c]=o(!1),[u,d]=o(null),[f,p]=o({isOpen:!1,entityId:null,entityName:""}),h=e=>{t.onEdit?t.onEdit(e):(d(e),c(!0))},m=()=>{c(!1),d(null)},y=e=>{n(e),c(!1),d(null)},g=e=>{p({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})};return It.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[It.jsx("div",{className:"flex-shrink-0 flex justify-between items-center px-4 py-1.5 bg-muted/50 border-b",children:It.jsx("div",{className:"flex items-center gap-4",children:It.jsxs($t,{onClick:()=>{t.onNew?t.onNew():(d(null),c(!0))},className:"flex items-center gap-2",children:[It.jsx(he,{size:16}),t.newButtonText||"Novo"]})})}),It.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:i?It.jsx(i,{manager:e,onEdit:h,onDelete:g,onToggleStatus:s}):It.jsx(_o,{manager:e,columns:t.columns,onEdit:h,onDelete:g,onToggleStatus:s})}),It.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:It.jsx(Wo,{manager:e})}),!t.useCustomRouting&&(a?It.jsx(a,{open:l,onCancel:m,onSubmit:y,editingEntity:u,isLoading:e.isLoading}):It.jsx(Ko,{open:l,title:u?`Editar ${t.entityName}`:`Novo ${t.entityName}`,sections:r,initialData:u||void 0,onSubmit:y,onCancel:m,isLoading:e.isLoading,submitButtonText:u?"Atualizar":"Criar"})),It.jsx($n,{open:f.isOpen,onOpenChange:()=>{p({isOpen:!1,entityId:null,entityName:""})},onConfirm:t=>{f.entityId&&(e.deleteEntity(f.entityId),p({isOpen:!1,entityId:null,entityName:""}))},item:f.entityId?{id:f.entityId,title:f.entityName}:void 0,entityName:t.entityName,isDeleting:e.isDeleting})]})}function Go({manager:e,config:t,formSections:r,onSave:n,FormComponent:o,TableComponent:i,onToggleStatus:s}){const{setSearchVisible:l,refreshData:c}=zo();return a(()=>(l(!0),()=>{l(!1)}),[l]),It.jsx(Zo,{manager:e,config:t,formSections:r,onSave:n,FormComponent:o,TableComponent:i,onToggleStatus:s})}function Yo(e){return()=>{const{manager:t,config:r,onSave:n,onToggleStatus:o,FormComponent:a}=e,i={entityName:r.entityName,entityNamePlural:r.entityNamePlural,filters:r.filters||[],columns:r.columns,cardFields:r.cardFields||[]};return It.jsx(Go,{manager:t,config:i,formSections:r.formSections,onSave:n,FormComponent:a,onToggleStatus:o})}}function Qo(e,t,r){return n=>{if(n.id){const t=r(n);e.updateEntity(n.id,t)}else{const r=t(n);e.createEntity(r)}}}function Xo(e,t,r={}){const n=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const r=t[e],o={key:e,header:ea(e),label:ea(e),...Jo(e,r),sortable:!0,searchable:"string"==typeof r};n.push(o)}}),{title:e,columns:n,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...r}}function Jo(e,t){const r=e.toLowerCase();return r.includes("email")?{type:"email",required:!0}:r.includes("phone")||r.includes("tel")?{type:"tel"}:r.includes("description")||r.includes("content")||r.includes("notes")?{type:"textarea"}:r.includes("status")||r.includes("type")||r.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function ea(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const ta={user:{title:"Usuários",searchPlaceholder:"Buscar usuários...",enableDelete:!1},product:{title:"Produtos",searchPlaceholder:"Buscar produtos...",enableFilters:!0},order:{title:"Pedidos",searchPlaceholder:"Buscar pedidos...",enableCreate:!1},category:{title:"Categorias",searchPlaceholder:"Buscar categorias...",itemsPerPage:20}};function ra(e,t,r={}){const n=ta[e];return Xo(n.title,t,{...n,...r})}const na=({children:e})=>{const{isAuthenticated:r,isLoading:n}=zo();if(t.useEffect(()=>{if(!r)return;const e=()=>{nn.areAllTokensValid()||(console.warn("[ProtectedRoute] Tokens expirados detectados, forçando logout"),Io.logout())};e();const t=setInterval(e,3e5);return()=>clearInterval(t)},[r]),t.useEffect(()=>{if(n)return;if(r)return;if(nn.isManualLogout())return void(window.location.href="/login");const e=new URLSearchParams(window.location.search),t=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,o=new URLSearchParams(t);if(e.has("access_token")||o.has("access_token"))return;const a=Nn();(async()=>{a?await Io.loginDev():Io.loginProd()})()},[r,n]),n)return It.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsx(Zt,{className:"text-center",children:It.jsx(Gt,{className:"text-xl font-semibold",children:"Carregando..."})}),It.jsxs(Qt,{className:"text-center",children:[It.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),It.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!r){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?It.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsx(Zt,{className:"text-center",children:It.jsx(Gt,{className:"text-xl font-semibold",children:"Processando..."})}),It.jsxs(Qt,{className:"text-center",children:[It.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),It.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):It.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsx(Zt,{className:"text-center",children:It.jsx(Gt,{className:"text-xl font-semibold",children:"Iniciando..."})}),It.jsxs(Qt,{className:"text-center",children:[It.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),It.jsx("p",{className:"text-muted-foreground",children:Nn()?"Fazendo login automático...":"Redirecionando para autenticação..."})]})]})})}return It.jsx(It.Fragment,{children:e})},oa=p("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),aa=e.forwardRef(({className:e,variant:t,...r},n)=>It.jsx("div",{ref:n,role:"alert",className:Mt(oa({variant:t}),e),...r}));aa.displayName="Alert";const ia=e.forwardRef(({className:e,...t},r)=>It.jsx("h5",{ref:r,className:Mt("mb-1 font-medium leading-none tracking-tight",e),...t}));ia.displayName="AlertTitle";const sa=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("text-sm [&_p]:leading-relaxed",e),...t}));sa.displayName="AlertDescription";const la=()=>{const{processCallback:e}=zo(),[t,r]=o(null),[n,i]=o(!1);a(()=>{(async()=>{try{if(await e()){window.history.replaceState({},document.title,"/");const e=localStorage.getItem("auth_return_url");e?(localStorage.removeItem("auth_return_url"),window.location.href=e):window.location.href="/"}else r("Falha na autenticação. Tente novamente.")}catch(e){console.error("❌ [CallbackPage] Erro no processamento:",e),r(e?.message||"Erro durante a autenticação. Tente novamente.")}})()},[e]);const s=async()=>{i(!0),r(null);try{await e()||r("Falha na autenticação. Tente novamente.")}catch(e){r(e?.message||"Erro ao tentar novamente.")}finally{i(!1)}},l=()=>{window.location.href="/"};return t?It.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsx(Zt,{className:"text-center",children:It.jsxs(Gt,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[It.jsx(O,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),It.jsxs(Qt,{className:"space-y-4",children:[It.jsx(aa,{variant:"destructive",children:It.jsx(sa,{children:t})}),It.jsx("div",{className:"text-sm text-muted-foreground",children:It.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),It.jsxs("div",{className:"flex gap-2",children:[It.jsx($t,{onClick:s,disabled:n,className:"flex-1",children:n?It.jsxs(It.Fragment,{children:[It.jsx(Tr,{size:"sm",className:"mr-2"}),"Tentando..."]}):It.jsxs(It.Fragment,{children:[It.jsx(qe,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),It.jsx($t,{onClick:l,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):It.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsx(Zt,{className:"text-center",children:It.jsx(Gt,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),It.jsxs(Qt,{className:"text-center",children:[It.jsx("div",{className:"flex justify-center mb-4",children:It.jsx(Tr,{size:"lg"})}),It.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},ca=()=>It.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsx(Zt,{className:"text-center",children:It.jsx(Gt,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),It.jsxs(Qt,{className:"text-center space-y-4",children:[It.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),It.jsx($t,{onClick:async()=>{Nn()?await Io.loginDev():Io.loginProd()},className:"w-full",size:"lg",children:Nn()?"Login Desenvolvimento":"Entrar com Qualiex"})]})]})});function ua(e){return{queryClient:e.queryClient||new Xe({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}}const da=ct.Root,fa=e.forwardRef(({className:e,...t},r)=>It.jsx(ct.Item,{ref:r,className:Mt("border-b",e),...t}));fa.displayName="AccordionItem";const pa=e.forwardRef(({className:e,children:t,...r},n)=>It.jsx(ct.Header,{className:"flex",children:It.jsxs(ct.Trigger,{ref:n,className:Mt("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,It.jsx(N,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));pa.displayName=ct.Trigger.displayName;const ha=e.forwardRef(({className:e,children:t,...r},n)=>It.jsx(ct.Content,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:It.jsx("div",{className:Mt("pb-4 pt-0",e),children:t})}));ha.displayName=ct.Content.displayName;const ma=ut.Root,ya=e.forwardRef(({className:e,...t},r)=>It.jsx(dt.Root,{ref:r,className:Mt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ya.displayName=dt.Root.displayName;const ga=e.forwardRef(({className:e,...t},r)=>It.jsx(dt.Image,{ref:r,className:Mt("aspect-square h-full w-full",e),...t}));ga.displayName=dt.Image.displayName;const va=e.forwardRef(({className:e,...t},r)=>It.jsx(dt.Fallback,{ref:r,className:Mt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));va.displayName=dt.Fallback.displayName;const ba=e.forwardRef(({...e},t)=>It.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));ba.displayName="Breadcrumb";const xa=e.forwardRef(({className:e,...t},r)=>It.jsx("ol",{ref:r,className:Mt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));xa.displayName="BreadcrumbList";const wa=e.forwardRef(({className:e,...t},r)=>It.jsx("li",{ref:r,className:Mt("inline-flex items-center gap-1.5",e),...t}));wa.displayName="BreadcrumbItem";const Na=e.forwardRef(({asChild:t,className:r,...n},o)=>{const a=t?e.Fragment:"a";return It.jsx(a,{ref:o,className:Mt("transition-colors hover:text-foreground",r),...n})});Na.displayName="BreadcrumbLink";const ja=e.forwardRef(({className:e,...t},r)=>It.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Mt("font-normal text-foreground",e),...t}));ja.displayName="BreadcrumbPage";const _a=({children:e,className:t,...r})=>It.jsx("li",{role:"presentation","aria-hidden":"true",className:Mt("[&>svg]:size-3.5",t),...r,children:e??It.jsx(A,{})});_a.displayName="BreadcrumbSeparator";const ka=({className:e,...t})=>It.jsxs("span",{role:"presentation","aria-hidden":"true",className:Mt("flex h-9 w-9 items-center justify-center",e),...t,children:[It.jsx(Re,{className:"h-4 w-4"}),It.jsx("span",{className:"sr-only",children:"More"})]});function Oa(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function Ea(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=r?.width?String(r.width):t;n=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=r?.width?String(r.width):e.defaultWidth;n=e.values[o]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function Sa(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const i=a[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r;return}(s,e=>e.test(i)):function(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r;return}(s,e=>e.test(i));let c;c=e.valueCallback?e.valueCallback(l):l,c=r.valueCallback?r.valueCallback(c):c;return{value:c,rest:t.slice(i.length)}}}ka.displayName="BreadcrumbEllipsis";const Aa={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Ta={date:Oa({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:Oa({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Oa({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ca={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"};var Pa;const qa={code:"pt-BR",formatDistance:(e,t,r)=>{let n;const o=Aa[e];return n="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",String(t)),r?.addSuffix?r.comparison&&r.comparison>0?"em "+n:"há "+n:n},formatLong:Ta,formatRelative:(e,t,r,n)=>{const o=Ca[e];return"function"==typeof o?o(t):o},localize:{ordinalNumber:(e,t)=>{const r=Number(e);return"week"===t?.unit?r+"ª":r+"º"},era:Ea({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:Ea({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Ea({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:Ea({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:Ea({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(Pa={matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const r=e.match(Pa.matchPattern);if(!r)return null;const n=r[0],o=e.match(Pa.parsePattern);if(!o)return null;let a=Pa.valueCallback?Pa.valueCallback(o[0]):o[0];return a=t.valueCallback?t.valueCallback(a):a,{value:a,rest:e.slice(n.length)}}),era:Sa({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:Sa({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Sa({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:Sa({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:Sa({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ra({className:e,classNames:t,showOutsideDays:r=!0,...n}){return It.jsx(ft,{showOutsideDays:r,className:Mt("p-3",e),locale:qa,classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Mt(Ut({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Mt(Ut({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...e})=>It.jsx(fe,{className:"h-4 w-4"}),IconRight:({...e})=>It.jsx(A,{className:"h-4 w-4"})},...n})}Ra.displayName="Calendar";const La=e.createContext(null);function Ia(){const t=e.useContext(La);if(!t)throw new Error("useCarousel must be used within a <Carousel />");return t}const Ma=e.forwardRef(({orientation:t="horizontal",opts:r,setApi:n,plugins:o,className:a,children:i,...s},l)=>{const[c,u]=pt({...r,axis:"horizontal"===t?"x":"y"},o),[d,f]=e.useState(!1),[p,h]=e.useState(!1),m=e.useCallback(e=>{e&&(f(e.canScrollPrev()),h(e.canScrollNext()))},[]),y=e.useCallback(()=>{u?.scrollPrev()},[u]),g=e.useCallback(()=>{u?.scrollNext()},[u]),v=e.useCallback(e=>{"ArrowLeft"===e.key?(e.preventDefault(),y()):"ArrowRight"===e.key&&(e.preventDefault(),g())},[y,g]);return e.useEffect(()=>{u&&n&&n(u)},[u,n]),e.useEffect(()=>{if(u)return m(u),u.on("reInit",m),u.on("select",m),()=>{u?.off("select",m)}},[u,m]),It.jsx(La.Provider,{value:{carouselRef:c,api:u,opts:r,orientation:t||("y"===r?.axis?"vertical":"horizontal"),scrollPrev:y,scrollNext:g,canScrollPrev:d,canScrollNext:p},children:It.jsx("div",{ref:l,onKeyDownCapture:v,className:Mt("relative",a),role:"region","aria-roledescription":"carousel",...s,children:i})})});Ma.displayName="Carousel";const Da=e.forwardRef(({className:e,...t},r)=>{const{carouselRef:n,orientation:o}=Ia();return It.jsx("div",{ref:n,className:"overflow-hidden",children:It.jsx("div",{ref:r,className:Mt("flex","horizontal"===o?"-ml-4":"-mt-4 flex-col",e),...t})})});Da.displayName="CarouselContent";const Fa=e.forwardRef(({className:e,...t},r)=>{const{orientation:n}=Ia();return It.jsx("div",{ref:r,role:"group","aria-roledescription":"slide",className:Mt("min-w-0 shrink-0 grow-0 basis-full","horizontal"===n?"pl-4":"pt-4",e),...t})});Fa.displayName="CarouselItem";const Ba=e.forwardRef(({className:e,variant:t="outline",size:r="icon",...n},o)=>{const{orientation:a,scrollPrev:i,canScrollPrev:s}=Ia();return It.jsxs($t,{ref:o,variant:t,size:r,className:Mt("absolute h-8 w-8 rounded-full","horizontal"===a?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!s,onClick:i,...n,children:[It.jsx(de,{className:"h-4 w-4"}),It.jsx("span",{className:"sr-only",children:"Previous slide"})]})});Ba.displayName="CarouselPrevious";const za=e.forwardRef(({className:e,variant:t="outline",size:r="icon",...n},o)=>{const{orientation:a,scrollNext:i,canScrollNext:s}=Ia();return It.jsxs($t,{ref:o,variant:t,size:r,className:Mt("absolute h-8 w-8 rounded-full","horizontal"===a?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!s,onClick:i,...n,children:[It.jsx(ue,{className:"h-4 w-4"}),It.jsx("span",{className:"sr-only",children:"Next slide"})]})});za.displayName="CarouselNext";const Ua={light:"",dark:".dark"},$a=e.createContext(null);function Ha(){const t=e.useContext($a);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const Va=e.forwardRef(({id:t,className:r,children:n,config:o,...a},i)=>{const s=e.useId(),l=`chart-${t||s.replace(/:/g,"")}`;return It.jsx($a.Provider,{value:{config:o},children:It.jsxs("div",{"data-chart":l,ref:i,className:Mt("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",r),...a,children:[It.jsx(Ka,{id:l,config:o}),It.jsx(ht.ResponsiveContainer,{children:n})]})})});Va.displayName="Chart";const Ka=({id:e,config:t})=>{const r=Object.entries(t).filter(([e,t])=>t.theme||t.color);return r.length?It.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Ua).map(([t,n])=>`\n${n} [data-chart=${e}] {\n${r.map(([e,r])=>{const n=r.theme?.[t]||r.color;return n?` --color-${e}: ${n};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Wa=ht.Tooltip,Za=e.forwardRef(({active:t,payload:r,className:n,indicator:o="dot",hideLabel:a=!1,hideIndicator:i=!1,label:s,labelFormatter:l,labelClassName:c,formatter:u,color:d,nameKey:f,labelKey:p},h)=>{const{config:m}=Ha(),y=e.useMemo(()=>{if(a||!r?.length)return null;const[e]=r,t=`${p||e.dataKey||e.name||"value"}`,n=Qa(m,e,t),o=p||"string"!=typeof s?n?.label:m[s]?.label||s;return l?It.jsx("div",{className:Mt("font-medium",c),children:l(o,r)}):o?It.jsx("div",{className:Mt("font-medium",c),children:o}):null},[s,l,r,a,c,m,p]);if(!t||!r?.length)return null;const g=1===r.length&&"dot"!==o;return It.jsxs("div",{ref:h,className:Mt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[g?null:y,It.jsx("div",{className:"grid gap-1.5",children:r.map((e,t)=>{const r=`${f||e.name||e.dataKey||"value"}`,n=Qa(m,e,r),a=d||e.payload.fill||e.color;return It.jsx("div",{className:Mt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===o&&"items-center"),children:u&&void 0!==e?.value&&e.name?u(e.value,e.name,e,t,e.payload):It.jsxs(It.Fragment,{children:[n?.icon?It.jsx(n.icon,{}):!i&&It.jsx("div",{className:Mt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===o,"w-1":"line"===o,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===o,"my-0.5":g&&"dashed"===o}),style:{"--color-bg":a,"--color-border":a}}),It.jsxs("div",{className:Mt("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[It.jsxs("div",{className:"grid gap-1.5",children:[g?y:null,It.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),e.value&&It.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});Za.displayName="ChartTooltip";const Ga=ht.Legend,Ya=e.forwardRef(({className:e,hideIcon:t=!1,payload:r,verticalAlign:n="bottom",nameKey:o},a)=>{const{config:i}=Ha();return r?.length?It.jsx("div",{ref:a,className:Mt("flex items-center justify-center gap-4","top"===n?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${o||e.dataKey||"value"}`,n=Qa(i,e,r);return It.jsxs("div",{className:Mt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[n?.icon&&!t?It.jsx(n.icon,{}):It.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null});function Qa(e,t,r){if("object"!=typeof t||null===t)return;const n="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0;let o=r;return r in t&&"string"==typeof t[r]?o=t[r]:n&&r in n&&"string"==typeof n[r]&&(o=n[r]),o in e?e[o]:e[r]}Ya.displayName="ChartLegend";const Xa=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Xa.displayName="Command";const Ja=({children:e,...t})=>It.jsx("div",{...t,children:It.jsx(Xa,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),ei=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:It.jsx("input",{ref:r,className:Mt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})}));ei.displayName="CommandInput";const ti=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));ti.displayName="CommandList";const ri=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("py-6 text-center text-sm text-muted-foreground",e),...t}));ri.displayName="CommandEmpty";const ni=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));ni.displayName="CommandGroup";const oi=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("-mx-1 h-px bg-border",e),...t}));oi.displayName="CommandSeparator";const ai=e.forwardRef(({className:e,disabled:t,onSelect:r,value:n,...o},a)=>It.jsx("div",{ref:a,className:Mt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":t,onClick:()=>!t&&r?.(n||""),...o}));ai.displayName="CommandItem";const ii=({className:e,...t})=>It.jsx("span",{className:Mt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});ii.displayName="CommandShortcut";const si={Root:function({children:e,className:t}){return It.jsx("div",{className:Mt("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return It.jsx(Wt,{className:Mt("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:It.jsx(Qt,{className:"p-4",children:e})})},Field:function({label:e,value:t,className:r}){return It.jsxs("div",{className:Mt("flex justify-between items-center text-sm",r),children:[It.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),It.jsx("span",{className:"text-foreground",children:t})]})}},li=({variant:e="button",className:r="",children:n})=>{const[a,i]=o(!1),{user:s}=zo(),{companies:l,alias:c}=zo(),u=c?l?.find(e=>e.alias===c)||l?.[0]||null:l?.[0]||null,d=(()=>{if(!s?.email)return"";return`${`${import.meta.env.VITE_FEEDBACK_APP_URL}/`}?${new URLSearchParams({email:s.email,module:"OKR",alias:u?.alias||""}).toString()}`})();if(!s?.email||!u)return null;const f=t.forwardRef((t,n)=>"menuItem"===e?It.jsxs("div",{ref:n,className:"flex items-center cursor-pointer w-full px-2 py-1.5 text-sm hover:bg-accent rounded-sm",...t,children:[It.jsx(Le,{className:"mr-2 h-4 w-4"}),"Feedback"]}):It.jsxs($t,{ref:n,variant:"default",size:"sm",className:`bg-primary hover:bg-primary/90 ${r}`,...t,children:[It.jsx(Le,{className:"mr-2 h-4 w-4"}),"Feedback"]}));return f.displayName="TriggerButton",It.jsxs(Jt,{open:a,onOpenChange:i,children:[It.jsx(er,{asChild:!0,children:It.jsx(f,{})}),It.jsxs(or,{className:"max-w-4xl max-h-[90vh] w-full h-full p-0 overflow-hidden",children:[It.jsxs(ar,{className:"sr-only",children:[It.jsx(sr,{children:"Feedback"}),It.jsx(lr,{children:"Formulário de feedback para melhorias no sistema"})]}),It.jsx("div",{className:"w-full h-full",children:It.jsx("iframe",{src:d,width:"100%",height:"600px",className:"feedback-iframe",title:"Formulário de Feedback",loading:"lazy"})})]})]})},ci={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},ui={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function di({children:e,cols:t="auto-fit",gap:r="md",className:n}){return It.jsx("div",{className:Mt("grid",ci[t],ui[r],n),children:e})}const fi=e.forwardRef(({className:e,containerClassName:t,...r},n)=>It.jsx(mt,{ref:n,containerClassName:Mt("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:Mt("disabled:cursor-not-allowed",e),...r}));fi.displayName="InputOTP";const pi=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,className:Mt("flex items-center",e),...t}));pi.displayName="InputOTPGroup";const hi=e.forwardRef(({index:t,className:r,...n},o)=>{const a=e.useContext(yt),{char:i,hasFakeCaret:s,isActive:l}=a.slots[t];return It.jsxs("div",{ref:o,className:Mt("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",r),...n,children:[i,s&&It.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:It.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});hi.displayName="InputOTPSlot";const mi=e.forwardRef(({...e},t)=>It.jsx("div",{ref:t,role:"separator",...e,children:It.jsx(Ie,{})}));function yi({items:e,maxItems:t=3,className:r}){return e.length>t&&(e[0],e.slice(-(t-1))),e.length,It.jsx(ba,{className:r})}function gi(){const e=et();return(()=>{const t=e.pathname.split("/").filter(Boolean),r=[{label:"Exemplos",href:"/"}];let n="";return t.forEach((e,o)=>{n+=`/${e}`;const a=o===t.length-1,i=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");r.push({label:i,href:a?void 0:n,isCurrentPage:a})}),r})()}mi.displayName="InputOTPSeparator";const vi=({className:e,...t})=>It.jsx("nav",{role:"navigation","aria-label":"pagination",className:Mt("mx-auto flex w-full justify-center",e),...t});vi.displayName="Pagination";const bi=e.forwardRef(({className:e,...t},r)=>It.jsx("ul",{ref:r,className:Mt("flex flex-row items-center gap-1",e),...t}));bi.displayName="PaginationContent";const xi=e.forwardRef(({className:e,...t},r)=>It.jsx("li",{ref:r,className:Mt("",e),...t}));xi.displayName="PaginationItem";const wi=({className:e,isActive:t,size:r="icon",...n})=>It.jsx("a",{"aria-current":t?"page":void 0,className:Mt(Ut({variant:t?"outline":"ghost",size:r}),e),...n});wi.displayName="PaginationLink";const Ni=({className:e,...t})=>It.jsxs(wi,{"aria-label":"Go to previous page",size:"default",className:Mt("gap-1 pl-2.5",e),...t,children:[It.jsx(fe,{className:"h-4 w-4"}),It.jsx("span",{children:"Previous"})]});Ni.displayName="PaginationPrevious";const ji=({className:e,...t})=>It.jsxs(wi,{"aria-label":"Go to next page",size:"default",className:Mt("gap-1 pr-2.5",e),...t,children:[It.jsx("span",{children:"Next"}),It.jsx(A,{className:"h-4 w-4"})]});ji.displayName="PaginationNext";const _i=({className:e,...t})=>It.jsxs("span",{"aria-hidden":!0,className:Mt("flex h-9 w-9 items-center justify-center",e),...t,children:[It.jsx(Re,{className:"h-4 w-4"}),It.jsx("span",{className:"sr-only",children:"More pages"})]});_i.displayName="PaginationEllipsis";const ki=e.forwardRef(({className:e,value:t,...r},n)=>It.jsx(gt.Root,{ref:n,className:Mt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:It.jsx(gt.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));ki.displayName=gt.Root.displayName;const Oi=e.forwardRef(({className:e,...t},r)=>It.jsx(vt.Root,{className:Mt("grid gap-2",e),...t,ref:r}));Oi.displayName=vt.Root.displayName;const Ei=e.forwardRef(({className:e,...t},r)=>It.jsx(vt.Item,{ref:r,className:Mt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:It.jsx(vt.Indicator,{className:"flex items-center justify-center",children:It.jsx(T,{className:"h-2.5 w-2.5 fill-current text-current"})})}));var Si,Ai,Ti,Ci,Pi,qi,Ri,Li,Ii,Mi,Di,Fi,Bi,zi,Ui,$i,Hi,Vi,Ki,Wi,Zi,Gi,Yi,Qi,Xi,Ji,es,ts,rs,ns,os,as,is,ss,ls,cs,us,ds,fs,ps,hs,ms,ys,gs,vs,bs,xs,ws,Ns,js,_s,ks,Os,Es,Ss,As,Ts,Cs,Ps,qs,Rs,Ls,Is,Ms,Ds,Fs,Bs,zs,Us,$s,Hs,Vs,Ks,Ws,Zs,Gs,Ys,Qs,Xs,Js,el,tl,rl,nl,ol,al,il,sl,ll,cl,ul,dl,fl,pl,hl,ml,yl,gl,vl,bl,xl,wl,Nl,jl,_l,kl,Ol,El,Sl,Al,Tl,Cl,Pl,ql,Rl,Ll,Il,Ml,Dl,Fl,Bl,zl,Ul,$l,Hl,Vl,Kl,Wl;function Zl(){if(Ci)return Ti;return Ci=1,Ti=function(e,t){return e===t||e!=e&&t!=t}}function Gl(){if(qi)return Pi;qi=1;var e=Zl();return Pi=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return-1}}function Yl(){if($i)return Ui;$i=1;var e=Ai?Si:(Ai=1,Si=function(){this.__data__=[],this.size=0}),t=function(){if(Li)return Ri;Li=1;var e=Gl(),t=Array.prototype.splice;return Ri=function(r){var n=this.__data__,o=e(n,r);return!(o<0||(o==n.length-1?n.pop():t.call(n,o,1),--this.size,0))}}(),r=function(){if(Mi)return Ii;Mi=1;var e=Gl();return Ii=function(t){var r=this.__data__,n=e(r,t);return n<0?void 0:r[n][1]}}(),n=function(){if(Fi)return Di;Fi=1;var e=Gl();return Di=function(t){return e(this.__data__,t)>-1}}(),o=function(){if(zi)return Bi;zi=1;var e=Gl();return Bi=function(t,r){var n=this.__data__,o=e(n,t);return o<0?(++this.size,n.push([t,r])):n[o][1]=r,this}}();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Ui=a}function Ql(){if(Ji)return Xi;Ji=1;var e="object"==typeof Et&&Et&&Et.Object===Object&&Et;return Xi=e}function Xl(){if(ts)return es;ts=1;var e=Ql(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return es=r}function Jl(){if(ns)return rs;ns=1;var e=Xl().Symbol;return rs=e}function ec(){if(cs)return ls;cs=1;var e=Jl(),t=function(){if(as)return os;as=1;var e=Jl(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;return os=function(e){var t=r.call(e,o),a=e[o];try{e[o]=void 0;var i=!0}catch(e){}var s=n.call(e);return i&&(t?e[o]=a:delete e[o]),s}}(),r=function(){if(ss)return is;ss=1;var e=Object.prototype.toString;return is=function(t){return e.call(t)}}(),n=e?e.toStringTag:void 0;return ls=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):r(e)}}function tc(){if(ds)return us;return ds=1,us=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function rc(){if(ps)return fs;ps=1;var e=ec(),t=tc();return fs=function(r){if(!t(r))return!1;var n=e(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function nc(){if(gs)return ys;gs=1;var e,t=function(){if(ms)return hs;ms=1;var e=Xl()["__core-js_shared__"];return hs=e}(),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return ys=function(e){return!!r&&r in e}}function oc(){if(bs)return vs;bs=1;var e=Function.prototype.toString;return vs=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}function ac(){if(ks)return _s;ks=1;var e=function(){if(ws)return xs;ws=1;var e=rc(),t=nc(),r=tc(),n=oc(),o=/^\[object .+?Constructor\]$/,a=Function.prototype,i=Object.prototype,s=a.toString,l=i.hasOwnProperty,c=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return xs=function(a){return!(!r(a)||t(a))&&(e(a)?c:o).test(n(a))}}(),t=js?Ns:(js=1,Ns=function(e,t){return null==e?void 0:e[t]});return _s=function(r,n){var o=t(r,n);return e(o)?o:void 0}}function ic(){if(Es)return Os;Es=1;var e=ac()(Xl(),"Map");return Os=e}function sc(){if(As)return Ss;As=1;var e=ac()(Object,"create");return Ss=e}function lc(){if(zs)return Bs;zs=1;var e=function(){if(Cs)return Ts;Cs=1;var e=sc();return Ts=function(){this.__data__=e?e(null):{},this.size=0}}(),t=qs?Ps:(qs=1,Ps=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}),r=function(){if(Ls)return Rs;Ls=1;var e=sc(),t=Object.prototype.hasOwnProperty;return Rs=function(r){var n=this.__data__;if(e){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return t.call(n,r)?n[r]:void 0}}(),n=function(){if(Ms)return Is;Ms=1;var e=sc(),t=Object.prototype.hasOwnProperty;return Is=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}(),o=function(){if(Fs)return Ds;Fs=1;var e=sc();return Ds=function(t,r){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=e&&void 0===r?"__lodash_hash_undefined__":r,this}}();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Bs=a}function cc(){if(Ws)return Ks;Ws=1;var e=Vs?Hs:(Vs=1,Hs=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return Ks=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function uc(){if(nl)return rl;nl=1;var e=function(){if($s)return Us;$s=1;var e=lc(),t=Yl(),r=ic();return Us=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}(),t=function(){if(Gs)return Zs;Gs=1;var e=cc();return Zs=function(t){var r=e(this,t).delete(t);return this.size-=r?1:0,r}}(),r=function(){if(Qs)return Ys;Qs=1;var e=cc();return Ys=function(t){return e(this,t).get(t)}}(),n=function(){if(Js)return Xs;Js=1;var e=cc();return Xs=function(t){return e(this,t).has(t)}}(),o=function(){if(tl)return el;tl=1;var e=cc();return el=function(t,r){var n=e(this,t),o=n.size;return n.set(t,r),this.size+=n.size==o?0:1,this}}();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,rl=a}function dc(){if(sl)return il;sl=1;var e=Yl(),t=function(){if(Vi)return Hi;Vi=1;var e=Yl();return Hi=function(){this.__data__=new e,this.size=0}}(),r=Wi?Ki:(Wi=1,Ki=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}),n=Gi?Zi:(Gi=1,Zi=function(e){return this.__data__.get(e)}),o=Qi?Yi:(Qi=1,Yi=function(e){return this.__data__.has(e)}),a=function(){if(al)return ol;al=1;var e=Yl(),t=ic(),r=uc();return ol=function(n,o){var a=this.__data__;if(a instanceof e){var i=a.__data__;if(!t||i.length<199)return i.push([n,o]),this.size=++a.size,this;a=this.__data__=new r(i)}return a.set(n,o),this.size=a.size,this}}();function i(t){var r=this.__data__=new e(t);this.size=r.size}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=n,i.prototype.has=o,i.prototype.set=a,il=i}function fc(){if(pl)return fl;pl=1;var e=uc(),t=cl?ll:(cl=1,ll=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),r=dl?ul:(dl=1,ul=function(e){return this.__data__.has(e)});function n(t){var r=-1,n=null==t?0:t.length;for(this.__data__=new e;++r<n;)this.add(t[r])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,fl=n}function pc(){if(bl)return vl;bl=1;var e=fc(),t=ml?hl:(ml=1,hl=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}),r=gl?yl:(gl=1,yl=function(e,t){return e.has(t)});return vl=function(n,o,a,i,s,l){var c=1&a,u=n.length,d=o.length;if(u!=d&&!(c&&d>u))return!1;var f=l.get(n),p=l.get(o);if(f&&p)return f==o&&p==n;var h=-1,m=!0,y=2&a?new e:void 0;for(l.set(n,o),l.set(o,n);++h<u;){var g=n[h],v=o[h];if(i)var b=c?i(v,g,h,o,n,l):i(g,v,h,n,o,l);if(void 0!==b){if(b)continue;m=!1;break}if(y){if(!t(o,function(e,t){if(!r(y,t)&&(g===e||s(g,e,a,i,l)))return y.push(t)})){m=!1;break}}else if(g!==v&&!s(g,v,a,i,l)){m=!1;break}}return l.delete(n),l.delete(o),m}}function hc(){if(El)return Ol;El=1;var e=Jl(),t=function(){if(wl)return xl;wl=1;var e=Xl().Uint8Array;return xl=e}(),r=Zl(),n=pc(),o=jl?Nl:(jl=1,Nl=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}),a=kl?_l:(kl=1,_l=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}),i=e?e.prototype:void 0,s=i?i.valueOf:void 0;return Ol=function(e,i,l,c,u,d,f){switch(l){case"[object DataView]":if(e.byteLength!=i.byteLength||e.byteOffset!=i.byteOffset)return!1;e=e.buffer,i=i.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=i.byteLength||!d(new t(e),new t(i)));case"[object Boolean]":case"[object Date]":case"[object Number]":return r(+e,+i);case"[object Error]":return e.name==i.name&&e.message==i.message;case"[object RegExp]":case"[object String]":return e==i+"";case"[object Map]":var p=o;case"[object Set]":var h=1&c;if(p||(p=a),e.size!=i.size&&!h)return!1;var m=f.get(e);if(m)return m==i;c|=2,f.set(e,i);var y=n(p(e),p(i),c,u,d,f);return f.delete(e),y;case"[object Symbol]":if(s)return s.call(e)==s.call(i)}return!1}}function mc(){if(Cl)return Tl;Cl=1;var e=Array.isArray;return Tl=e}function yc(){if(ql)return Pl;ql=1;var e=Al?Sl:(Al=1,Sl=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}),t=mc();return Pl=function(r,n,o){var a=n(r);return t(r)?a:e(a,o(r))}}function gc(){if(Fl)return Dl;Fl=1;var e=Ll?Rl:(Ll=1,Rl=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}),t=Ml?Il:(Ml=1,Il=function(){return[]}),r=Object.prototype.propertyIsEnumerable,n=Object.getOwnPropertySymbols;return Dl=n?function(t){return null==t?[]:(t=Object(t),e(n(t),function(e){return r.call(t,e)}))}:t}function vc(){if($l)return Ul;return $l=1,Ul=function(e){return null!=e&&"object"==typeof e}}function bc(){if(Wl)return Kl;Wl=1;var e=function(){if(Vl)return Hl;Vl=1;var e=ec(),t=vc();return Hl=function(r){return t(r)&&"[object Arguments]"==e(r)}}(),t=vc(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e(function(){return arguments}())?e:function(e){return t(e)&&n.call(e,"callee")&&!o.call(e,"callee")};return Kl=a}Ei.displayName=vt.Item.displayName;var xc,wc,Nc,jc,_c,kc,Oc,Ec,Sc,Ac,Tc,Cc={exports:{}};function Pc(){return Nc||(Nc=1,function(e,t){var r=Xl(),n=wc?xc:(wc=1,xc=function(){return!1}),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,i=a&&a.exports===o?r.Buffer:void 0,s=(i?i.isBuffer:void 0)||n;e.exports=s}(Cc,Cc.exports)),Cc.exports}function qc(){if(Oc)return kc;Oc=1;return kc=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}var Rc,Lc,Ic,Mc,Dc,Fc,Bc,zc,Uc,$c,Hc,Vc,Kc,Wc,Zc,Gc,Yc,Qc,Xc,Jc,eu,tu,ru,nu,ou,au,iu,su,lu,cu,uu,du,fu,pu,hu,mu,yu,gu={exports:{}};function vu(){if(Ic)return Lc;Ic=1;var e=function(){if(Sc)return Ec;Sc=1;var e=ec(),t=qc(),r=vc(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Ec=function(o){return r(o)&&t(o.length)&&!!n[e(o)]}}(),t=Tc?Ac:(Tc=1,Ac=function(e){return function(t){return e(t)}}),r=function(){return Rc||(Rc=1,e=gu,t=gu.exports,r=Ql(),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,a=o&&o.exports===n&&r.process,i=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}(),e.exports=i),gu.exports;var e,t,r,n,o,a,i}(),n=r&&r.isTypedArray,o=n?t(n):e;return Lc=o}function bu(){if(Dc)return Mc;Dc=1;var e=zl?Bl:(zl=1,Bl=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}),t=bc(),r=mc(),n=Pc(),o=function(){if(_c)return jc;_c=1;var e=/^(?:0|[1-9]\d*)$/;return jc=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}}(),a=vu(),i=Object.prototype.hasOwnProperty;return Mc=function(s,l){var c=r(s),u=!c&&t(s),d=!c&&!u&&n(s),f=!c&&!u&&!d&&a(s),p=c||u||d||f,h=p?e(s.length,String):[],m=h.length;for(var y in s)!l&&!i.call(s,y)||p&&("length"==y||d&&("offset"==y||"parent"==y)||f&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||o(y,m))||h.push(y);return h}}function xu(){if(Hc)return $c;Hc=1;var e=(Uc?zc:(Uc=1,zc=function(e,t){return function(r){return e(t(r))}}))(Object.keys,Object);return $c=e}function wu(){if(Kc)return Vc;Kc=1;var e=function(){if(Bc)return Fc;Bc=1;var e=Object.prototype;return Fc=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}(),t=xu(),r=Object.prototype.hasOwnProperty;return Vc=function(n){if(!e(n))return t(n);var o=[];for(var a in Object(n))r.call(n,a)&&"constructor"!=a&&o.push(a);return o}}function Nu(){if(Yc)return Gc;Yc=1;var e=bu(),t=wu(),r=function(){if(Zc)return Wc;Zc=1;var e=rc(),t=qc();return Wc=function(r){return null!=r&&t(r.length)&&!e(r)}}();return Gc=function(n){return r(n)?e(n):t(n)}}function ju(){if(eu)return Jc;eu=1;var e=function(){if(Xc)return Qc;Xc=1;var e=yc(),t=gc(),r=Nu();return Qc=function(n){return e(n,r,t)}}(),t=Object.prototype.hasOwnProperty;return Jc=function(r,n,o,a,i,s){var l=1&o,c=e(r),u=c.length;if(u!=e(n).length&&!l)return!1;for(var d=u;d--;){var f=c[d];if(!(l?f in n:t.call(n,f)))return!1}var p=s.get(r),h=s.get(n);if(p&&h)return p==n&&h==r;var m=!0;s.set(r,n),s.set(n,r);for(var y=l;++d<u;){var g=r[f=c[d]],v=n[f];if(a)var b=l?a(v,g,f,n,r,s):a(g,v,f,r,n,s);if(!(void 0===b?g===v||i(g,v,o,a,s):b)){m=!1;break}y||(y="constructor"==f)}if(m&&!y){var x=r.constructor,w=n.constructor;x==w||!("constructor"in r)||!("constructor"in n)||"function"==typeof x&&x instanceof x&&"function"==typeof w&&w instanceof w||(m=!1)}return s.delete(r),s.delete(n),m}}function _u(){if(uu)return cu;uu=1;var e=function(){if(ru)return tu;ru=1;var e=ac()(Xl(),"DataView");return tu=e}(),t=ic(),r=function(){if(ou)return nu;ou=1;var e=ac()(Xl(),"Promise");return nu=e}(),n=function(){if(iu)return au;iu=1;var e=ac()(Xl(),"Set");return au=e}(),o=function(){if(lu)return su;lu=1;var e=ac()(Xl(),"WeakMap");return su=e}(),a=ec(),i=oc(),s="[object Map]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",d="[object DataView]",f=i(e),p=i(t),h=i(r),m=i(n),y=i(o),g=a;return(e&&g(new e(new ArrayBuffer(1)))!=d||t&&g(new t)!=s||r&&g(r.resolve())!=l||n&&g(new n)!=c||o&&g(new o)!=u)&&(g=function(e){var t=a(e),r="[object Object]"==t?e.constructor:void 0,n=r?i(r):"";if(n)switch(n){case f:return d;case p:return s;case h:return l;case m:return c;case y:return u}return t}),cu=g}function ku(){if(hu)return pu;hu=1;var e=function(){if(fu)return du;fu=1;var e=dc(),t=pc(),r=hc(),n=ju(),o=_u(),a=mc(),i=Pc(),s=vu(),l="[object Arguments]",c="[object Array]",u="[object Object]",d=Object.prototype.hasOwnProperty;return du=function(f,p,h,m,y,g){var v=a(f),b=a(p),x=v?c:o(f),w=b?c:o(p),N=(x=x==l?u:x)==u,j=(w=w==l?u:w)==u,_=x==w;if(_&&i(f)){if(!i(p))return!1;v=!0,N=!1}if(_&&!N)return g||(g=new e),v||s(f)?t(f,p,h,m,y,g):r(f,p,x,h,m,y,g);if(!(1&h)){var k=N&&d.call(f,"__wrapped__"),O=j&&d.call(p,"__wrapped__");if(k||O){var E=k?f.value():f,S=O?p.value():p;return g||(g=new e),y(E,S,h,m,g)}}return!!_&&(g||(g=new e),n(f,p,h,m,y,g))}}(),t=vc();return pu=function r(n,o,a,i,s){return n===o||(null==n||null==o||!t(n)&&!t(o)?n!=n&&o!=o:e(n,o,a,i,r,s))},pu}function Ou(){if(yu)return mu;yu=1;var e=ku();return mu=function(t,r){return e(t,r)}}var Eu,Su,Au,Tu={exports:{}};
|
|
10
|
+
*/function It(){return qt||(qt=1,"production"!==process.env.NODE_ENV&&function(){var e=t,r=Symbol.for("react.element"),n=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.iterator;var y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function g(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];!function(e,t,r){var n=y.ReactDebugCurrentFrame,o=n.getStackAddendum();""!==o&&(t+="%s",r=r.concat([o]));var a=r.map(function(e){return String(e)});a.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,a)}("error",e,r)}var v;function b(e){return e.displayName||"Context"}function x(e){if(null==e)return null;if("number"==typeof e.tag&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case n:return"Portal";case i:return"Profiler";case a:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return b(e)+".Consumer";case s:return b(e._context)+".Provider";case c:return function(e,t,r){var n=e.displayName;if(n)return n;var o=t.displayName||t.name||"";return""!==o?r+"("+o+")":r}(e,e.render,"ForwardRef");case f:var t=e.displayName||null;return null!==t?t:x(e.type)||"Memo";case p:var r=e,h=r._payload,m=r._init;try{return x(m(h))}catch(e){return null}}return null}v=Symbol.for("react.module.reference");var w,N,j,_,k,O,E,S=Object.assign,A=0;function T(){}T.__reactDisabledLog=!0;var C,P=y.ReactCurrentDispatcher;function q(e,t,r){if(void 0===C)try{throw Error()}catch(e){var n=e.stack.trim().match(/\n( *(at )?)/);C=n&&n[1]||""}return"\n"+C+e}var R,L=!1,I="function"==typeof WeakMap?WeakMap:Map;function M(e,t){if(!e||L)return"";var r,n=R.get(e);if(void 0!==n)return n;L=!0;var o,a=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=P.current,P.current=null,function(){if(0===A){w=console.log,N=console.info,j=console.warn,_=console.error,k=console.group,O=console.groupCollapsed,E=console.groupEnd;var e={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}();try{if(t){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(i,[])}catch(e){r=e}Reflect.construct(e,[],i)}else{try{i.call()}catch(e){r=e}e.call(i.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var s=t.stack.split("\n"),l=r.stack.split("\n"),c=s.length-1,u=l.length-1;c>=1&&u>=0&&s[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(s[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||s[c]!==l[u]){var d="\n"+s[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&R.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{L=!1,P.current=o,function(){if(0===--A){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:S({},e,{value:w}),info:S({},e,{value:N}),warn:S({},e,{value:j}),error:S({},e,{value:_}),group:S({},e,{value:k}),groupCollapsed:S({},e,{value:O}),groupEnd:S({},e,{value:E})})}A<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=a}var f=e?e.displayName||e.name:"",p=f?q(f):"";return"function"==typeof e&&R.set(e,p),p}function D(e,t,r){if(null==e)return"";if("function"==typeof e)return M(e,function(e){var t=e.prototype;return!(!t||!t.isReactComponent)}(e));if("string"==typeof e)return q(e);switch(e){case u:return q("Suspense");case d:return q("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return M(e.render,!1);case f:return D(e.type,t,r);case p:var n=e,o=n._payload,a=n._init;try{return D(a(o),t,r)}catch(e){}}return""}R=new I;var F=Object.prototype.hasOwnProperty,B={},z=y.ReactDebugCurrentFrame;function U(e){if(e){var t=e._owner,r=D(e.type,e._source,t?t.type:null);z.setExtraStackFrame(r)}else z.setExtraStackFrame(null)}var $=Array.isArray;function H(e){return $(e)}function V(e){return""+e}function K(e){if(function(e){try{return V(e),!1}catch(e){return!0}}(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),V(e)}var W,Z,G=y.ReactCurrentOwner,Y={key:!0,ref:!0,__self:!0,__source:!0};function Q(e,t,n,o,a){var i,s={},l=null,c=null;for(i in void 0!==n&&(K(n),l=""+n),function(e){if(F.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(K(t.key),l=""+t.key),function(e){if(F.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e){"string"==typeof e.ref&&G.current}(t)),t)F.call(t,i)&&!Y.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps){var u=e.defaultProps;for(i in u)void 0===s[i]&&(s[i]=u[i])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var r=function(){W||(W=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"key",{get:r,configurable:!0})}(s,d),c&&function(e,t){var r=function(){Z||(Z=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};r.isReactWarning=!0,Object.defineProperty(e,"ref",{get:r,configurable:!0})}(s,d)}return function(e,t,n,o,a,i,s){var l={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:i,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:a}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,a,o,G.current,s)}var X,J=y.ReactCurrentOwner,ee=y.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,r=D(e.type,e._source,t?t.type:null);ee.setExtraStackFrame(r)}else ee.setExtraStackFrame(null)}function re(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function ne(){if(J.current){var e=x(J.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}X=!1;var oe={};function ae(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var r=function(e){var t=ne();if(!t){var r="string"==typeof e?e:e.displayName||e.name;r&&(t="\n\nCheck the top-level render call using <"+r+">.")}return t}(t);if(!oe[r]){oe[r]=!0;var n="";e&&e._owner&&e._owner!==J.current&&(n=" It was passed a child from "+x(e._owner.type)+"."),te(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',r,n),te(null)}}}function ie(e,t){if("object"==typeof e)if(H(e))for(var r=0;r<e.length;r++){var n=e[r];re(n)&&ae(n,t)}else if(re(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=m&&e[m]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var a,i=o.call(e);!(a=i.next()).done;)re(a.value)&&ae(a.value,t)}}function se(e){var t,r=e.type;if(null!=r&&"string"!=typeof r){if("function"==typeof r)t=r.propTypes;else{if("object"!=typeof r||r.$$typeof!==c&&r.$$typeof!==f)return;t=r.propTypes}if(t){var n=x(r);!function(e,t,r,n,o){var a=Function.call.bind(F);for(var i in e)if(a(e,i)){var s=void 0;try{if("function"!=typeof e[i]){var l=Error((n||"React class")+": "+r+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}s=e[i](t,i,n,r,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}!s||s instanceof Error||(U(o),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",r,i,typeof s),U(null)),s instanceof Error&&!(s.message in B)&&(B[s.message]=!0,U(o),g("Failed %s type: %s",r,s.message),U(null))}}(t,e.props,"prop",n,e)}else if(void 0!==r.PropTypes&&!X){X=!0,g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",x(r)||"Unknown")}"function"!=typeof r.getDefaultProps||r.getDefaultProps.isReactClassApproved||g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ce(e,t,n,m,y,b){var w=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===i||e===a||e===u||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===f||e.$$typeof===s||e.$$typeof===l||e.$$typeof===c||e.$$typeof===v||void 0!==e.getModuleId)}(e);if(!w){var N="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(N+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var j;N+=ne(),null===e?j="null":H(e)?j="array":void 0!==e&&e.$$typeof===r?(j="<"+(x(e.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):j=typeof e,g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",j,N)}var _=Q(e,t,n,y,b);if(null==_)return _;if(w){var k=t.children;if(void 0!==k)if(m)if(H(k)){for(var O=0;O<k.length;O++)ie(k[O],e);Object.freeze&&Object.freeze(k)}else g("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ie(k,e)}if(F.call(t,"key")){var E=x(e),S=Object.keys(t).filter(function(e){return"key"!==e}),A=S.length>0?"{key: someKey, "+S.join(": ..., ")+": ...}":"{key: someKey}";if(!le[E+A])g('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',A,E,S.length>0?"{"+S.join(": ..., ")+": ...}":"{}",E),le[E+A]=!0}return e===o?function(e){for(var t=Object.keys(e.props),r=0;r<t.length;r++){var n=t[r];if("children"!==n&&"key"!==n){te(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),te(null);break}}null!==e.ref&&(te(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(_):se(_),_}var ue=function(e,t,r){return ce(e,t,r,!1)},de=function(e,t,r){return ce(e,t,r,!0)};Lt.Fragment=o,Lt.jsx=ue,Lt.jsxs=de}()),Lt}var Mt=(Rt||(Rt=1,"production"===process.env.NODE_ENV?Ct.exports=function(){if(Tt)return Pt;Tt=1;var e=t,r=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,n){var s,l={},c=null,u=null;for(s in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)o.call(t,s)&&!i.hasOwnProperty(s)&&(l[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps)void 0===l[s]&&(l[s]=t[s]);return{$$typeof:r,type:e,key:c,ref:u,props:l,_owner:a.current}}return Pt.Fragment=n,Pt.jsx=s,Pt.jsxs=s,Pt}():Ct.exports=It()),Ct.exports);function Dt(...e){return m(h(e))}const Ft=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(Ft);if("object"==typeof e&&e.constructor===Object){const t={};for(const[r,n]of Object.entries(e))t[r]=Ft(n);return t}return e},Bt=e=>{if(!e)return"";const t=y(e);if(!g(t))return"Data inválida";return`${t.toLocaleDateString("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"})} ${t.toLocaleTimeString("pt-BR",{hour:"2-digit",minute:"2-digit"})}`},zt=e=>null==e?"R$ 0,00":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:2,maximumFractionDigits:2}).format(e),Ut=(e,t)=>{let r;return(...n)=>{clearTimeout(r),r=setTimeout(()=>e(...n),t)}},$t=p("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline","icon-only":"bg-transparent border border-input hover:bg-accent hover:text-accent-foreground p-2","external-link":"bg-transparent text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors","action-primary":"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm","action-secondary":"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-input"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10","icon-sm":"h-8 w-8","icon-xs":"h-6 w-6"}},defaultVariants:{variant:"default",size:"default"}}),Ht=e.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...o},a)=>{const i=n?d:"button";return Mt.jsx(i,{className:Dt($t({variant:t,size:r,className:e})),ref:a,...o})});Ht.displayName="Button";const Vt=e.forwardRef(({className:e,type:t,...r},n)=>Mt.jsx("input",{type:t,className:Dt("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...r}));Vt.displayName="Input";const Kt=p("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Wt=e.forwardRef(({className:e,...t},r)=>Mt.jsx(b.Root,{ref:r,className:Dt(Kt(),e),...t}));Wt.displayName=b.Root.displayName;const Zt=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Zt.displayName="Card";const Gt=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("flex flex-col space-y-1.5 p-6",e),...t}));Gt.displayName="CardHeader";const Yt=e.forwardRef(({className:e,...t},r)=>Mt.jsx("h3",{ref:r,className:Dt("text-2xl font-semibold leading-none tracking-tight",e),...t}));Yt.displayName="CardTitle";const Qt=e.forwardRef(({className:e,...t},r)=>Mt.jsx("p",{ref:r,className:Dt("text-sm text-muted-foreground",e),...t}));Qt.displayName="CardDescription";const Xt=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("p-6 pt-0",e),...t}));Xt.displayName="CardContent";const Jt=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("flex items-center p-6 pt-0",e),...t}));Jt.displayName="CardFooter";const er=x.Root,tr=x.Trigger,rr=x.Portal,nr=x.Close,or=e.forwardRef(({className:e,...t},r)=>Mt.jsx(x.Overlay,{ref:r,className:Dt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));or.displayName=x.Overlay.displayName;const ar=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsxs(rr,{children:[Mt.jsx(or,{}),Mt.jsxs(x.Content,{ref:n,className:Dt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background p-6 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg overflow-hidden",e),...r,children:[t,Mt.jsxs(x.Close,{className:"absolute right-4 top-4 z-10 rounded-sm text-white opacity-70 ring-offset-background transition-opacity hover:opacity-100 hover:text-white focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[Mt.jsx(w,{className:"h-4 w-4"}),Mt.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ar.displayName=x.Content.displayName;const ir=({className:e,...t})=>Mt.jsx("div",{className:Dt("flex flex-col space-y-1.5 text-center sm:text-left bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-3 rounded-t-lg",e),...t});ir.displayName="DialogHeader";const sr=({className:e,...t})=>Mt.jsx("div",{className:Dt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});sr.displayName="DialogFooter";const lr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(x.Title,{ref:r,className:Dt("text-lg font-semibold leading-none tracking-tight",e),...t}));lr.displayName=x.Title.displayName;const cr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(x.Description,{ref:r,className:Dt("text-sm text-muted-foreground",e),...t}));cr.displayName=x.Description.displayName;const ur=$e,dr=e.createContext({}),fr=({...e})=>Mt.jsx(dr.Provider,{value:{name:e.name},children:Mt.jsx(He,{...e})}),pr=()=>{const t=e.useContext(dr),r=e.useContext(hr),{getFieldState:n,formState:o}=Ue(),a=n(t.name,o);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:i}=r;return{id:i,name:t.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...a}},hr=e.createContext({}),mr=e.forwardRef(({className:t,...r},n)=>{const o=e.useId();return Mt.jsx(hr.Provider,{value:{id:o},children:Mt.jsx("div",{ref:n,className:Dt("space-y-2",t),...r})})});mr.displayName="FormItem";const yr=e.forwardRef(({className:e,...t},r)=>{const{error:n,formItemId:o}=pr();return Mt.jsx(Wt,{ref:r,className:Dt(n&&"text-destructive",e),htmlFor:o,...t})});yr.displayName="FormLabel";const gr=e.forwardRef(({...e},t)=>{const{error:r,formItemId:n,formDescriptionId:o,formMessageId:a}=pr();return Mt.jsx(d,{ref:t,id:n,"aria-describedby":r?`${o} ${a}`:`${o}`,"aria-invalid":!!r,...e})});gr.displayName="FormControl";e.forwardRef(({className:e,...t},r)=>{const{formDescriptionId:n}=pr();return Mt.jsx("p",{ref:r,id:n,className:Dt("text-sm text-muted-foreground",e),...t})}).displayName="FormDescription";const vr=e.forwardRef(({className:e,children:t,...r},n)=>{const{error:o,formMessageId:a}=pr(),i=o?String(o?.message):t;return i?Mt.jsx("p",{ref:n,id:a,className:Dt("text-sm font-medium text-destructive",e),...r,children:i}):null});vr.displayName="FormMessage";const br=Ve.Root,xr=Ve.Value,wr=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsxs(Ve.Trigger,{ref:n,className:Dt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,Mt.jsx(Ve.Icon,{asChild:!0,children:Mt.jsx(N,{className:"h-4 w-4 opacity-50"})})]}));wr.displayName=Ve.Trigger.displayName;const Nr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(Ve.ScrollUpButton,{ref:r,className:Dt("flex cursor-default items-center justify-center py-1",e),...t,children:Mt.jsx(j,{className:"h-4 w-4"})}));Nr.displayName=Ve.ScrollUpButton.displayName;const jr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(Ve.ScrollDownButton,{ref:r,className:Dt("flex cursor-default items-center justify-center py-1",e),...t,children:Mt.jsx(N,{className:"h-4 w-4"})}));jr.displayName=Ve.ScrollDownButton.displayName;const _r=e.forwardRef(({className:e,children:t,position:r="popper",...n},o)=>Mt.jsx(Ve.Portal,{children:Mt.jsxs(Ve.Content,{ref:o,className:Dt("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...n,children:[Mt.jsx(Nr,{}),Mt.jsx(Ve.Viewport,{className:Dt("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),Mt.jsx(jr,{})]})}));_r.displayName=Ve.Content.displayName;e.forwardRef(({className:e,...t},r)=>Mt.jsx(Ve.Label,{ref:r,className:Dt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=Ve.Label.displayName;const kr=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsxs(Ve.Item,{ref:n,className:Dt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[Mt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:Mt.jsx(Ve.ItemIndicator,{children:Mt.jsx(_,{className:"h-4 w-4"})})}),Mt.jsx(Ve.ItemText,{children:t})]}));kr.displayName=Ve.Item.displayName;e.forwardRef(({className:e,...t},r)=>Mt.jsx(Ve.Separator,{ref:r,className:Dt("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=Ve.Separator.displayName;const Or=e.forwardRef(({className:e,...t},r)=>Mt.jsx(Ke.Root,{ref:r,className:Dt("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:Mt.jsx(Ke.Indicator,{className:Dt("flex items-center justify-center text-current"),children:Mt.jsx(_,{className:"h-4 w-4"})})}));Or.displayName=Ke.Root.displayName;const Er=e.forwardRef(({className:e,...t},r)=>Mt.jsx("textarea",{className:Dt("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Er.displayName="Textarea";const Sr=p("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white hover:bg-green-600",warning:"border-transparent bg-yellow-500 text-white hover:bg-yellow-600",info:"border-transparent bg-blue-500 text-white hover:bg-blue-600"}},defaultVariants:{variant:"default"}}),Ar=e.forwardRef(({className:e,variant:t,...r},n)=>Mt.jsx("div",{ref:n,className:Dt(Sr({variant:t}),e),...r}));Ar.displayName="Badge";const Tr={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function Cr({size:e="md",className:t}){return Mt.jsx(k,{className:Dt("animate-spin text-muted-foreground",Tr[e],t)})}function Pr({isLoading:e,children:t,className:r,type:n="spinner",size:o="md"}){return e?"overlay"===n?Mt.jsxs("div",{className:Dt("relative",r),children:[t,Mt.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:Mt.jsx(Cr,{size:o})})]}):"skeleton"===n?Mt.jsx("div",{className:Dt("animate-pulse",r),children:Mt.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):Mt.jsx("div",{className:Dt("flex items-center justify-center py-8",r),children:Mt.jsx(Cr,{size:o})}):Mt.jsx(Mt.Fragment,{children:t})}let qr=0;const Rr=new Map,Lr=e=>{if(Rr.has(e))return;const t=setTimeout(()=>{Rr.delete(e),Fr({type:"REMOVE_TOAST",toastId:e})},1e6);Rr.set(e,t)},Ir=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{const{toastId:r}=t;return r?Lr(r):e.toasts.forEach(e=>{Lr(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===r||void 0===r?{...e,open:!1}:e)}}case"REMOVE_TOAST":return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},Mr=[];let Dr={toasts:[]};function Fr(e){Dr=Ir(Dr,e),Mr.forEach(e=>{e(Dr)})}function Br({...e}){const t=(qr=(qr+1)%Number.MAX_SAFE_INTEGER,qr.toString()),r=()=>Fr({type:"DISMISS_TOAST",toastId:t});return Fr({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:e=>Fr({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function zr(){const[t,r]=e.useState(Dr);return e.useEffect(()=>(Mr.push(r),()=>{const e=Mr.indexOf(r);e>-1&&Mr.splice(e,1)}),[t]),{...t,toast:Br,dismiss:e=>Fr({type:"DISMISS_TOAST",toastId:e})}}const Ur=We.Provider,$r=e.forwardRef(({className:e,...t},r)=>Mt.jsx(We.Viewport,{ref:r,className:Dt("fixed top-4 left-1/2 transform -translate-x-1/2 z-[100] flex max-h-screen w-full max-w-[420px] flex-col p-4",e),...t}));$r.displayName=We.Viewport.displayName;const Hr=p("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Vr=e.forwardRef(({className:e,variant:t,...r},n)=>Mt.jsx(We.Root,{ref:n,className:Dt(Hr({variant:t}),e),...r}));Vr.displayName=We.Root.displayName;const Kr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(We.Action,{ref:r,className:Dt("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));Kr.displayName=We.Action.displayName;const Wr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(We.Close,{ref:r,className:Dt("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:Mt.jsx(w,{className:"h-4 w-4"})}));Wr.displayName=We.Close.displayName;const Zr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(We.Title,{ref:r,className:Dt("text-sm font-semibold",e),...t}));Zr.displayName=We.Title.displayName;const Gr=e.forwardRef(({className:e,...t},r)=>Mt.jsx(We.Description,{ref:r,className:Dt("text-sm opacity-90",e),...t}));function Yr(){const{toasts:e}=zr();return Mt.jsxs(Ur,{children:[e.map(function({id:e,title:t,description:r,action:n,...o}){return Mt.jsxs(Vr,{...o,children:[Mt.jsxs("div",{className:"grid gap-1",children:[t&&Mt.jsx(Zr,{children:t}),r&&Mt.jsx(Gr,{children:r})]}),n,Mt.jsx(Wr,{})]},e)}),Mt.jsx($r,{})]})}Gr.displayName=We.Description.displayName;const Qr="qualiex_access_token",Xr="qualiex_id_token",Jr="supabase_token",en="oauth_state",tn="oauth_nonce",rn="selected_alias",nn="manual_logout",on={setAccessToken:e=>localStorage.setItem(Qr,e),getAccessToken:()=>localStorage.getItem(Qr),setIdToken:e=>localStorage.setItem(Xr,e),getIdToken:()=>localStorage.getItem(Xr),getSupabaseToken:()=>localStorage.getItem(Jr),setOAuthState:e=>sessionStorage.setItem(en,e),getOAuthState:()=>sessionStorage.getItem(en),clearOAuthState:()=>sessionStorage.removeItem(en),setOAuthNonce:e=>sessionStorage.setItem(tn,e),getOAuthNonce:()=>sessionStorage.getItem(tn),clearOAuthNonce:()=>sessionStorage.removeItem(tn),setSelectedAlias:e=>localStorage.setItem(rn,e),getSelectedAlias:()=>localStorage.getItem(rn),clearSelectedAlias:()=>localStorage.removeItem(rn),generateOAuthState:()=>"Lw==",generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!on.getAccessToken()||!on.getIdToken()),setSupabaseToken:e=>{localStorage.setItem(Jr,e),on._clearValidationCache()},areAllTokensValid:()=>{const e=on.getAccessToken(),t=on.getIdToken(),r=on.getSupabaseToken();return!(!e||!t)&&(!on.isTokenExpired(e)&&!on.isTokenExpired(t)&&(!r||!on.isTokenExpired(r)))},clearExpiredTokens:()=>{let e=!1;const t=on.getAccessToken(),r=on.getIdToken(),n=on.getSupabaseToken();return t&&on.isTokenExpired(t)&&(localStorage.removeItem(Qr),e=!0),r&&on.isTokenExpired(r)&&(localStorage.removeItem(Xr),e=!0),n&&on.isTokenExpired(n)&&(localStorage.removeItem(Jr),e=!0),e},clearAll:()=>{localStorage.removeItem(Qr),localStorage.removeItem(Xr),localStorage.removeItem(Jr),localStorage.removeItem(rn),localStorage.removeItem(nn),sessionStorage.removeItem(en),sessionStorage.removeItem(tn)},setManualLogout:()=>localStorage.setItem(nn,"true"),isManualLogout:()=>"true"===localStorage.getItem(nn),clearManualLogout:()=>localStorage.removeItem(nn),isTokenExpired:e=>{try{return 1e3*JSON.parse(atob(e.split(".")[1])).exp<Date.now()}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{on._validationCache.isValid=!1,on._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=on.getSupabaseToken();if(!e)return!1;if(on.isTokenExpired(e))return on._clearValidationCache(),on._handleExpiredToken(),!1;const t=Date.now();return t-on._validationCache.timestamp<on._validationCache.cacheValidityMs?on._validationCache.isValid:(on._validationCache.isValid=!0,on._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>on.isSupabaseTokenValid()?on.getSupabaseToken():null,_handleExpiredToken:()=>{console.warn("[TokenManager] Token expirado detectado - limpando sessão"),on.clearAll(),"undefined"!=typeof window&&(window.location.href="/")},extractTokenData:()=>{if(!on.isSupabaseTokenValid())return console.warn("[TokenManager] Tentativa de extrair dados de token inválido/expirado"),null;const e=on.getSupabaseToken();if(!e)return null;try{const t=JSON.parse(atob(e.split(".")[1])),r=t.alias||t.default||t.user_alias;let n=t.company_id;if(!n&&r)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const o=t[e];if(o&&"string"==typeof o){const e=o.split(";");if(e.length>7&&e[0]===r){n=e[7];break}}}return{alias:r,companyId:n,payload:t}}catch(e){return console.error("[TokenManager] Erro ao extrair dados do token:",e),on._handleExpiredToken(),null}},getCompanyId:e=>{const t=on.extractTokenData();if(!t)return null;if(!e)return t.companyId;const r=on.getIdToken();if(!r)return null;try{const t=JSON.parse(atob(r.split(".")[1]));for(const r in t)if(r.startsWith("co")&&/^co\d+$/.test(r)){const n=t[r];if(n&&"string"==typeof n){const t=n.split(";");if(t.length>7&&t[0]===e)return t[7]}}}catch{return null}return null},getCurrentCompanyId:()=>{const e=on.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=on.getIdToken();if(!e)return[];try{const t=JSON.parse(atob(e.split(".")[1])),r=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const n=t[e];if(n&&"string"==typeof n){const e=n.split(";");e.length>=4&&r.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return r}catch{return[]}}};var an=Object.defineProperty,sn=(e,t,r)=>((e,t,r)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const ln=new class{constructor(){sn(this,"errors",[]),sn(this,"toastCount",0),sn(this,"lastToastTime",0)}handleError(e,t=!0){const r="string"==typeof e?e:e.message;this.errors.push({id:Date.now().toString(),message:r,timestamp:Date.now(),count:1}),t&&this.shouldShowToast()&&Br({title:"Erro",description:r,variant:"destructive"})}success(e,t){Br({title:e,description:t,variant:"default"})}shouldShowToast(){const e=Date.now();return e-this.lastToastTime>6e4&&(this.toastCount=0),this.toastCount<3&&(this.toastCount++,this.lastToastTime=e,!0)}getErrors(){return this.errors.slice(-50)}clearErrors(){this.errors=[]}};var cn=Object.defineProperty,un=(e,t,r)=>((e,t,r)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,"symbol"!=typeof t?t+"":t,r);const dn=import.meta.env.VITE_SUPABASE_URL,fn=import.meta.env.VITE_SUPABASE_PUBLISHABLE_KEY,pn=class e{constructor(){un(this,"client"),un(this,"currentToken",null),un(this,"instanceCount",0),un(this,"isRegenerating",!1),this.instanceCount++,this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:fn};return e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`),Ze(dn,fn,{auth:{persistSession:!1,autoRefreshToken:!1,storage:void 0},global:{headers:t}})}static getInstance(){return e.instance||(e.instance=new e),e.instance}getClient(){on.getValidSupabaseToken()||!on.areAllTokensValid()||this.isRegenerating||this.attemptTokenRegeneration();const e=on.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}async attemptTokenRegeneration(){if(!this.isRegenerating){this.isRegenerating=!0;try{const e=on.getAccessToken(),t=on.getSelectedAlias();if(!e||!t)return;const{AuthService:r}=await Promise.resolve().then(function(){return Do}),n=await r.generateSupabaseToken(e,t);n&&on.setSupabaseToken(n)}catch(e){console.error("[Supabase] Erro ao regenerar token:",e)}finally{this.isRegenerating=!1}}}isTokenValid(e){try{const t=JSON.parse(atob(e.split(".")[1])),r=Math.floor(Date.now()/1e3);return t.exp>r}catch(e){return ln.handleError(e instanceof Error?e:"❌ Supabase - Error validating token",!1),!1}}};un(pn,"instance");let hn=pn;const mn=()=>hn.getInstance().getClient();var yn=Object.defineProperty,gn=(e,t,r)=>((e,t,r)=>t in e?yn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r)(e,t+"",r);const vn=new class{constructor(){gn(this,"baseUrl",import.meta.env.VITE_QUALIEX_API_URL)}async makeApiCall(e,t,r){const n=on.getAccessToken();if(!n)throw new Error("Token Qualiex não encontrado");if(!r||""===r.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const o=new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{o.searchParams.append(e,t)});const a=await fetch(o.toString(),{method:"GET",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json",Accept:"application/json","un-alias":r}});if(!a.ok)throw new Error(`API call failed: ${a.status} ${a.statusText}`);return await a.json()}mapToQualiexUser(e){return{userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível"}}async fetchUsers(e,t){try{const r=await this.makeApiCall("/api/common/v1/companiesusers",{companyId:t,search:"",filterStatus:"active"},e);let n=r;if(r.data)n=r.data;else{if(!Array.isArray(r))return ln.handleError("[QualiexApi] Unexpected response format",!1),[];n=r}if(!Array.isArray(n))return ln.handleError("[QualiexApi] Response is not an array",!1),[];return n.map(this.mapToQualiexUser)}catch(e){return ln.handleError(e instanceof Error?e:"[QualiexApi] Error fetching users"),[]}}async fetchUserById(e,t,r){try{return(await this.fetchUsers(t,r)).find(t=>t.userId===e)||null}catch(e){return ln.handleError(e instanceof Error?e:"[QualiexApi] Error fetching user by ID"),null}}async getUsers(e){const t=on.extractTokenData();return t&&t.companyId?this.fetchUsers(e,t.companyId):(ln.handleError("[QualiexApi] CompanyId não encontrado no token Supabase",!1),[])}};class bn{static async extractTokenData(){const e=on.extractTokenData();return e||(ln.handleError("[QualiexEnrichment] ❌ Token Supabase não encontrado",!1),null)}static async enrichWithResponsibleNames(e,t){if(!e||0===e.length)return ln.handleError(`[QualiexEnrichment.${t.entityName}] Nenhuma entidade encontrada`,!1),e;try{const r=await this.extractTokenData();if(!r)return e.map(e=>({...e,responsible_name:e.id_user?"Token não encontrado":null}));const{alias:n,companyId:o}=r;if(!n||!o)return ln.handleError(`[QualiexEnrichment.${t.entityName}] DADOS OBRIGATÓRIOS FALTANDO - alias: ${!!n}, companyId: ${!!o}`,!1),e.map(e=>({...e,responsible_name:e.id_user?`Configuração incompleta (alias: ${!!n}, companyId: ${!!o})`:null}));const a=await vn.getUsers(n),i=e.map(e=>{if(e.id_user){const t=a.find(t=>t.userId===e.id_user);return{...e,responsible_name:t?.userName||`ID não encontrado: ${e.id_user}`}}return{...e,responsible_name:null}});i.filter(e=>e.responsible_name&&!e.responsible_name.includes("ID não encontrado")&&!e.responsible_name.includes("Erro:")&&!e.responsible_name.includes("Token não encontrado")&&!e.responsible_name.includes("Configuração incompleta")).length;return i}catch(r){return ln.handleError(r instanceof Error?r:`[QualiexEnrichment.${t.entityName}] 💥 ERRO CRÍTICO`),e.map(e=>({...e,responsible_name:e.id_user?`Erro: ${r.message}`:null}))}}}const xn={oauth:{authUrl:import.meta.env.VITE_OAUTH_AUTH_URL,clientId:import.meta.env.VITE_OAUTH_CLIENT_ID,responseType:"id_token token",scope:"openid profile email"}},wn={pagination:{defaultPageSize:25,pageSizeOptions:[10,25,50,100]},sorting:{defaultField:"updated_at",defaultDirection:"desc"}},Nn={debounceDelay:500},jn=()=>{const e=window.location.origin;return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("id-preview")||e.includes("lovable.dev")||import.meta.env.DEV},_n={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]};let kn={enableUserEnrichment:!1,enableUsersApi:!1};const On=()=>kn,En=e=>{kn={...kn,...e}},Sn={success:{created:e=>`${e} criado com sucesso`,updated:e=>`${e} atualizado com sucesso`,deleted:e=>`${e} removido com sucesso`},error:{create:e=>`Erro ao criar ${e}`,update:e=>`Erro ao atualizar ${e}`,delete:e=>`Erro ao remover ${e}`,load:e=>`Erro ao carregar ${e}`}},An=["responsible_name"];function Tn(e,t,r){const n="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:r||"central"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"central",...e},{tableName:o,searchFields:a,selectFields:i,schemaName:s,entityName:l,enableQualiexEnrichment:c=!1}=n,u=()=>{if(!on.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return mn().schema(s).from(o)};return{async getAll(e={}){const{search:t="",sortField:r="updated_at",sortDirection:n="desc",page:s=1,limit:d=25,...f}=e;let p=u().select(i||"*",{count:"exact"});p=p.eq("is_removed",!1),Object.entries(f).forEach(([e,t])=>{null!=t&&""!==t&&(p=Array.isArray(t)?p.in(e,t):"object"==typeof t&&t&&"operator"in t&&"not_null"===t.operator?p.not(e,"is",null):p.eq(e,t))}),p=((e,t)=>{if(t&&a.length>0){const r=a.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(r)}return e})(p,t),p=p.order(r,{ascending:"asc"===n}),p=((e,t,r)=>{const n=(t-1)*r,o=n+r-1;return e.range(n,o)})(p,s,d);const{data:h,error:m,count:y}=await p;if(m)throw new Error(`Error fetching ${o}: ${m.message}`);let g=((e,t,r,n)=>{const o=Math.ceil((t||0)/n);return{data:e,currentPage:r,totalPages:o,totalItems:t||0,itemsPerPage:n,hasNextPage:r<o,hasPreviousPage:r>1}})(h||[],y,s,d);const v=On();if(c&&v.enableUserEnrichment&&l&&g.data.length>0){if(g.data.some(e=>e.id_user)){if(r&&(b=r,An.includes(b))){const t={...e,page:1,limit:500,sortField:void 0,sortDirection:void 0},o=await this.getAll(t);if(!o?.data?.length)return o;const a=((e,t,r)=>[...e].sort((e,n)=>{const o=e[t]||"",a=n[t]||"",i=o.localeCompare(a,"pt-BR",{sensitivity:"base"});return"asc"===r?i:-i}))(await bn.enrichWithResponsibleNames(o.data,{entityName:l}),r,n),i=((e,t=1,r=25)=>{const n=(t-1)*r,o=n+r,a=e.slice(n,o);return{data:a,pagination:{currentPage:t,totalPages:Math.ceil(e.length/r),totalItems:a.length,totalCount:e.length,itemsPerPage:r,hasNextPage:o<e.length,hasPreviousPage:t>1}}})(a,s,d);return{data:i.data,currentPage:i.pagination.currentPage,totalPages:i.pagination.totalPages,totalItems:i.pagination.totalItems,itemsPerPage:i.pagination.itemsPerPage,hasNextPage:i.pagination.hasNextPage,hasPreviousPage:i.pagination.hasPreviousPage}}const t=await bn.enrichWithResponsibleNames(g.data,{entityName:l});g={...g,data:t}}}var b;return g},async getById(e){const{data:t,error:r}=await u().select(i||"*").eq("id",e).maybeSingle();if(r)throw new Error(`Error fetching ${o}: ${r.message}`);return t},async create(e){const t=Ft(e),r=Object.entries(t).reduce((e,[t,r])=>(void 0!==r&&(e[t]=r),e),{}),{data:n,error:a}=await u().insert(r).select().single();if(a)throw new Error(`Error creating ${o}: ${a.message}`);if(!n)throw new Error(`No data returned from create ${o} operation`);return n},async update(e,t){const r={...Ft(t),updated_at:(new Date).toISOString()},{data:n,error:a}=await u().update(r).eq("id",e).select().single();if(a)throw new Error(`Error updating ${o}: ${a.message}`);if(!n)throw new Error(`No data returned from update ${o} operation`);return n},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:r}=await u().update(t).eq("id",e);if(r)throw new Error(`Error soft deleting ${o}: ${r.message}`)}}}function Cn({queryKey:e,service:t,entityName:o,searchFields:a,additionalFilters:i={},onSuccess:s}){const[l,c]=Je(),u=Ge(),d=l.get("search")||"",f=l.get("sortField")||wn.sorting.defaultField,p=l.get("sortDirection")||wn.sorting.defaultDirection,h=parseInt(l.get("page")||"1"),m=parseInt(l.get("limit")||String(wn.pagination.defaultPageSize)),y=d,g=r(()=>({search:y,sortField:f,sortDirection:p,page:h,limit:m,...i}),[y,f,p,h,m,i]),v=n(()=>t.getAll(g),[t,g]),b=Ye({queryKey:[e,g],queryFn:v}),x=Qe({mutationFn:t.create,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),nt.success(Sn.success.created(o)),s?.()},onError:e=>{nt.error(`${Sn.error.create(o)}: ${e.message}`)}}),w=Qe({mutationFn:({id:e,data:r})=>t.update(e,r),onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),nt.success(Sn.success.updated(o)),s?.()},onError:e=>{nt.error(`${Sn.error.update(o)}: ${e.message}`)}}),N=Qe({mutationFn:t.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[e]}),nt.success(Sn.success.deleted(o))},onError:e=>{nt.error(`${Sn.error.delete(o)}: ${e.message}`)}}),j=n(e=>{const t={...Object.fromEntries(l)};Object.entries(e).forEach(([e,r])=>{""===r||0===r?delete t[e]:t[e]=String(r)}),c(t)},[l,c]),_=n(e=>{j({search:e,page:1})},[j]),k=n(e=>{j({sortField:e,sortDirection:f===e&&"asc"===p?"desc":"asc",page:1})},[f,p,j]),O=n(e=>{j({page:e})},[j]),E=n(e=>{j({limit:e,page:1})},[j]),S=n(()=>{c({})},[c]);return{entities:b.data?.data||[],pagination:{currentPage:b.data?.currentPage||1,totalPages:b.data?.totalPages||1,totalItems:b.data?.totalItems||0,itemsPerPage:b.data?.itemsPerPage||wn.pagination.defaultPageSize,hasNextPage:b.data?.hasNextPage||!1,hasPreviousPage:b.data?.hasPreviousPage||!1},isLoading:b.isLoading,isCreating:x.isPending,isUpdating:w.isPending,isDeleting:N.isPending,error:b.error,searchTerm:d,sortField:f,sortDirection:p,currentPage:h,itemsPerPage:m,createEntity:x.mutate,updateEntity:(e,t)=>w.mutate({id:e,data:t}),deleteEntity:N.mutate,handleSearch:_,handleSort:k,handlePageChange:O,handleItemsPerPageChange:E,clearFilters:S,refetch:b.refetch}}function Pn(e){const t=Tn({tableName:e.tableName,searchFields:e.searchFields||["title"],schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment||!0});return{service:t,useCrudHook:r=>Cn({queryKey:e.tableName,service:{...t,getAll:async(e={})=>await t.getAll({...e})},entityName:e.entityName,onSuccess:r})}}const qn=at.Root,Rn=at.Trigger,Ln=at.Portal,In=e.forwardRef(({className:e,...t},r)=>Mt.jsx(at.Overlay,{className:Dt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));In.displayName=at.Overlay.displayName;const Mn=e.forwardRef(({className:e,...t},r)=>Mt.jsxs(Ln,{children:[Mt.jsx(In,{}),Mt.jsx(at.Content,{ref:r,className:Dt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Mn.displayName=at.Content.displayName;const Dn=({className:e,...t})=>Mt.jsx("div",{className:Dt("flex flex-col space-y-2 text-center sm:text-left bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-6 rounded-t-lg",e),...t});Dn.displayName="AlertDialogHeader";const Fn=({className:e,...t})=>Mt.jsx("div",{className:Dt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Fn.displayName="AlertDialogFooter";const Bn=e.forwardRef(({className:e,...t},r)=>Mt.jsx(at.Title,{ref:r,className:Dt("text-lg font-semibold",e),...t}));Bn.displayName=at.Title.displayName;const zn=e.forwardRef(({className:e,...t},r)=>Mt.jsx(at.Description,{ref:r,className:Dt("text-sm text-muted-foreground",e),...t}));zn.displayName=at.Description.displayName;const Un=e.forwardRef(({className:e,...t},r)=>Mt.jsx(at.Action,{ref:r,className:Dt($t(),e),...t}));Un.displayName=at.Action.displayName;const $n=e.forwardRef(({className:e,...t},r)=>Mt.jsx(at.Cancel,{ref:r,className:Dt($t({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));$n.displayName=at.Cancel.displayName;const Hn=({open:e,onOpenChange:t,item:r,onConfirm:n,entityName:i="item",isDeleting:s=!1})=>{const[l,c]=o("");a(()=>{e||c("")},[e]);const u=()=>{c(""),t(!1)},d=l===r?.title;return r?Mt.jsx(qn,{open:e,onOpenChange:u,children:Mt.jsxs(Mn,{className:"sm:max-w-[500px]",children:[Mt.jsx(Dn,{children:Mt.jsxs("div",{className:"flex items-center space-x-2",children:[Mt.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-destructive/10 flex items-center justify-center",children:Mt.jsx("span",{className:"text-destructive font-semibold text-sm",children:"!"})}),Mt.jsx("div",{className:"flex-1",children:Mt.jsx(Bn,{className:"text-lg font-semibold",children:"Confirmar Exclusão"})})]})}),Mt.jsx(zn,{asChild:!0,children:Mt.jsxs("div",{className:"space-y-4",children:[Mt.jsxs("div",{className:"text-sm text-muted-foreground",children:[Mt.jsxs("p",{className:"mb-2",children:["Você está prestes a excluir permanentemente o ",i,":"]}),Mt.jsx("div",{className:"p-3 bg-muted rounded-md border-l-4 border-l-destructive",children:Mt.jsx("p",{className:"font-medium text-foreground",children:r.title})})]}),Mt.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-md p-3",children:Mt.jsxs("div",{className:"flex items-start space-x-2",children:[Mt.jsx("div",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-orange-500 flex items-center justify-center mt-0.5",children:Mt.jsx("span",{className:"text-white font-bold text-xs",children:"!"})}),Mt.jsxs("div",{className:"text-sm text-orange-800",children:[Mt.jsx("p",{className:"font-medium mb-1",children:"Atenção!"}),Mt.jsxs("p",{children:["Esta ação não pode ser desfeita. O ",i," será removido permanentemente do sistema."]})]})]})}),Mt.jsxs("div",{className:"space-y-2",children:[Mt.jsxs(Wt,{htmlFor:"confirmation",className:"text-sm font-medium",children:["Para confirmar, digite ",Mt.jsxs("strong",{children:['"',r.title,'"']})," abaixo:"]}),Mt.jsx(Vt,{id:"confirmation",type:"text",value:l,onChange:e=>c(e.target.value),placeholder:`Digite: ${r.title}`,className:"w-full"})]})]})}),Mt.jsxs(Fn,{children:[Mt.jsx($n,{onClick:u,children:"Cancelar"}),Mt.jsx(Un,{onClick:()=>{r&&l===r.title&&(n(r),c(""),t(!1))},disabled:!d||s,className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:s?"Removendo...":`Excluir ${i}`})]})]})}):null},Vn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("table",{ref:r,className:Dt("w-full caption-bottom text-sm",e),...t}));Vn.displayName="Table";const Kn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("thead",{ref:r,className:Dt("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));Kn.displayName="TableHeader";const Wn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("tbody",{ref:r,className:Dt("[&_tr:last-child]:border-0",e),...t}));Wn.displayName="TableBody";const Zn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("tfoot",{ref:r,className:Dt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));Zn.displayName="TableFooter";const Gn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("tr",{ref:r,className:Dt("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Gn.displayName="TableRow";const Yn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("th",{ref:r,className:Dt("h-12 px-4 py-3 text-left align-middle font-medium text-muted-foreground bg-background border-b [&:has([role=checkbox])]:pr-0",e),...t}));Yn.displayName="TableHead";const Qn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("td",{ref:r,className:Dt("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));Qn.displayName="TableCell";const Xn=e.forwardRef(({className:e,...t},r)=>Mt.jsx("caption",{ref:r,className:Dt("mt-4 text-sm text-muted-foreground",e),...t}));function Jn({className:e,...t}){return Mt.jsx("div",{className:Dt("animate-pulse rounded-md bg-muted",e),...t})}function eo({rows:e=5,columns:t=4}){return Mt.jsx("div",{className:"w-full",children:Mt.jsxs("div",{className:"rounded-md border",children:[Mt.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:Mt.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>Mt.jsx(Jn,{className:"h-4 w-24"},t))})}),Mt.jsx("div",{children:Array.from({length:e}).map((e,r)=>Mt.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:Mt.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>Mt.jsx(Jn,{className:"h-4 w-20"},t))})},r))})]})})}function to({count:e=3}){return Mt.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>Mt.jsxs(Zt,{children:[Mt.jsxs(Gt,{children:[Mt.jsx(Jn,{className:"h-4 w-3/4"}),Mt.jsx(Jn,{className:"h-3 w-1/2"})]}),Mt.jsx(Xt,{children:Mt.jsxs("div",{className:"space-y-2",children:[Mt.jsx(Jn,{className:"h-3 w-full"}),Mt.jsx(Jn,{className:"h-3 w-2/3"})]})})]},t))})}function ro({fields:e=4}){return Mt.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,t)=>Mt.jsxs("div",{className:"space-y-2",children:[Mt.jsx(Jn,{className:"h-4 w-24"}),Mt.jsx(Jn,{className:"h-10 w-full"})]},t)),Mt.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[Mt.jsx(Jn,{className:"h-10 w-20"}),Mt.jsx(Jn,{className:"h-10 w-20"})]})]})}function no(){return Mt.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[Mt.jsxs("div",{className:"flex items-center space-x-3",children:[Mt.jsx(Jn,{className:"h-8 w-8 rounded-full"}),Mt.jsx(Jn,{className:"h-6 w-32"})]}),Mt.jsxs("div",{className:"flex items-center space-x-2",children:[Mt.jsx(Jn,{className:"h-8 w-8"}),Mt.jsx(Jn,{className:"h-8 w-24"})]})]})}function oo(){return Mt.jsx("div",{className:"w-64 border-r bg-muted/10",children:Mt.jsxs("div",{className:"p-4",children:[Mt.jsx(Jn,{className:"h-8 w-32 mb-6"}),Mt.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>Mt.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[Mt.jsx(Jn,{className:"h-4 w-4"}),Mt.jsx(Jn,{className:"h-4 w-20"})]},t))})]})})}Xn.displayName="TableCaption";const ao={default:S,search:E,error:O};function io({icon:e,title:t,description:r,action:n,className:o,variant:a="default"}){const i=e?()=>e:ao[a];return Mt.jsxs("div",{className:Dt("flex flex-col items-center justify-center py-12 px-4 text-center",o),children:[Mt.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:Mt.jsx(i,{className:"h-8 w-8 text-muted-foreground"})}),Mt.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),r&&Mt.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:r}),n&&Mt.jsx(Ht,{onClick:n.onClick,variant:"outline",children:n.label})]})}const so=it.Root,lo=it.Trigger,co=it.Group,uo=it.Portal,fo=it.Sub,po=it.RadioGroup,ho=e.forwardRef(({className:e,inset:t,children:r,...n},o)=>Mt.jsxs(it.SubTrigger,{ref:o,className:Dt("flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...n,children:[r,Mt.jsx(A,{className:"ml-auto h-4 w-4"})]}));ho.displayName=it.SubTrigger.displayName;const mo=e.forwardRef(({className:e,...t},r)=>Mt.jsx(it.SubContent,{ref:r,className:Dt("z-50 min-w-[8rem] overflow-hidden border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));mo.displayName=it.SubContent.displayName;const yo=e.forwardRef(({className:e,sideOffset:t=4,...r},n)=>Mt.jsx(it.Portal,{children:Mt.jsx(it.Content,{ref:n,sideOffset:t,className:Dt("z-[100] min-w-[8rem] overflow-hidden rounded-md border bg-white shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 dark:bg-gray-800 dark:border-gray-700",e),...r})}));yo.displayName=it.Content.displayName;const go=e.forwardRef(({className:e,inset:t,...r},n)=>Mt.jsx(it.Item,{ref:n,className:Dt("relative flex cursor-default select-none items-center px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));go.displayName=it.Item.displayName;const vo=e.forwardRef(({className:e,children:t,checked:r,...n},o)=>Mt.jsxs(it.CheckboxItem,{ref:o,className:Dt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[Mt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:Mt.jsx(it.ItemIndicator,{children:Mt.jsx(_,{className:"h-4 w-4"})})}),t]}));vo.displayName=it.CheckboxItem.displayName;const bo=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsxs(it.RadioItem,{ref:n,className:Dt("relative flex cursor-default select-none items-center py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[Mt.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:Mt.jsx(it.ItemIndicator,{children:Mt.jsx(T,{className:"h-2 w-2 fill-current"})})}),t]}));bo.displayName=it.RadioItem.displayName;const xo=e.forwardRef(({className:e,inset:t,...r},n)=>Mt.jsx(it.Label,{ref:n,className:Dt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...r}));xo.displayName=it.Label.displayName;const wo=e.forwardRef(({className:e,...t},r)=>Mt.jsx(it.Separator,{ref:r,className:Dt("-mx-1 my-1 h-px bg-muted",e),...t}));wo.displayName=it.Separator.displayName;const No=({className:e,...t})=>Mt.jsx("span",{className:Dt("ml-auto text-xs tracking-widest opacity-60",e),...t});No.displayName="DropdownMenuShortcut";const jo=({onEdit:e,onDelete:t,onToggleStatus:r,isActive:n=!0,canDelete:o=!0,renderAs:a})=>{const i=[];if(e){const t={icon:C,label:"Editar",onClick:e};i.push(t)}if(r){const e={icon:n?P:q,label:n?"Inativar":"Ativar",onClick:r};i.push(e)}if(o&&t){const e={icon:R,label:"Remover",onClick:t,destructive:!0};i.push(e)}return"dropdown"===a?Mt.jsx(Mt.Fragment,{children:i.map((e,t)=>Mt.jsxs(go,{onClick:e.onClick,className:e.destructive?"text-destructive":"",children:[Mt.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},t))}):Mt.jsx(Mt.Fragment,{children:i.map((e,t)=>Mt.jsxs(Ht,{variant:"ghost",size:"sm",onClick:e.onClick,className:"w-full justify-start h-auto py-2 px-3 text-sm font-normal "+(e.destructive?"text-destructive hover:text-destructive":""),children:[Mt.jsx(e.icon,{className:"h-4 w-4 mr-2"}),e.label]},t))})},_o=({onEdit:e,onDelete:t,canDelete:r=!0,onToggleStatus:n,isActive:o=!0})=>Mt.jsxs(so,{children:[Mt.jsx(lo,{asChild:!0,children:Mt.jsx(Ht,{variant:"default",size:"sm",className:"h-7 px-2 text-xs bg-primary text-primary-foreground hover:bg-primary/90",children:Mt.jsx(L,{size:12})})}),Mt.jsx(yo,{align:"end",children:Mt.jsx(jo,{onEdit:t=>{t?.stopPropagation(),e?.()},onDelete:e=>{e?.stopPropagation(),t?.()},onToggleStatus:e=>{e?.stopPropagation(),n?.()},isActive:o,canDelete:r,renderAs:"dropdown"})})]}),ko=({manager:e,columns:t,onEdit:r,onView:n,onToggleStatus:i,onDelete:s,renderActions:l})=>{const[c,u]=o(!1),[d,f]=o(null);a(()=>{const e=()=>u(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),a(()=>{const e=()=>f(null);if(d)return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[d]);const p=(()=>{t.length;let e=0;const r=t.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const r=t.minWidth||120,n=t.weight||1;return e+=r,{...t,calculatedWidth:r,weight:n,isFixed:!1}}});return e+=100,r.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})();return c?e.isLoading?Mt.jsx(to,{count:3}):0===e.entities.length?Mt.jsx(io,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"}):Mt.jsxs("div",{className:"space-y-4",children:[e.entities.map(e=>Mt.jsx(Zt,{className:"overflow-hidden cursor-pointer hover:bg-muted/50",onClick:t=>{t.stopPropagation(),r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),f({x:t.clientX,y:t.clientY,item:e})},children:Mt.jsxs(Xt,{className:"p-4",children:[t.map(t=>Mt.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[Mt.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[t.header,":"]}),Mt.jsx("div",{className:"text-sm text-foreground text-right min-w-0 flex-1",children:t.render?t.render(e):e[t.key]})]},String(t.key))),(r||n||l)&&Mt.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:l?l(e):Mt.jsx(_o,{onEdit:r?()=>{r(e)}:void 0,onDelete:s?()=>s(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived})})]})},e.id)),d&&Mt.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:d.x,top:d.y},onClick:e=>e.stopPropagation(),children:Mt.jsx(jo,{onEdit:r?()=>{r(d.item),f(null)}:void 0,onDelete:s?()=>{s(d.item),f(null)}:void 0,onToggleStatus:i?()=>{i(d.item),f(null)}:void 0,isActive:d.item.is_actived,canDelete:!!s,renderAs:"context"})})]}):Mt.jsxs("div",{className:"flex flex-col h-full",children:[e.isLoading?Mt.jsx(eo,{rows:5,columns:t.length}):Mt.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:Mt.jsx("div",{className:"flex-1 overflow-auto",children:Mt.jsxs(Vn,{className:"table-fixed",children:[Mt.jsxs("colgroup",{children:[p.map((e,t)=>Mt.jsx("col",{style:e.style},t)),Mt.jsx("col",{style:{width:"100px"}})]}),Mt.jsx(Kn,{children:Mt.jsxs(Gn,{children:[t.map(t=>{return Mt.jsx(Yn,{className:`${t.className||""} ${t.sortable?"cursor-pointer hover:bg-muted/50":""}`,onClick:t.sortable?()=>e.handleSort(String(t.key)):void 0,children:Mt.jsxs("div",{className:"flex items-center "+(t.className?.includes("text-center")?"justify-center":""),children:[t.header,t.sortable&&(r=String(t.key),e.sortField!==r?Mt.jsx(I,{size:14,className:"ml-1 opacity-50"}):"asc"===e.sortDirection?Mt.jsx(M,{size:14,className:"ml-1"}):Mt.jsx(D,{size:14,className:"ml-1"}))]})},String(t.key));var r}),Mt.jsx(Yn,{className:"w-[100px] text-center",children:"Ações"})]})}),Mt.jsx(Wn,{children:0===e.entities.length?Mt.jsx(Gn,{children:Mt.jsx(Qn,{colSpan:t.length+1,className:"h-32",children:Mt.jsx(io,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"})})}):e.entities.map(e=>Mt.jsxs(Gn,{className:"cursor-pointer hover:bg-muted/50",onClick:t=>{t.stopPropagation(),r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),f({x:t.clientX,y:t.clientY,item:e})},children:[t.map(t=>Mt.jsx(Qn,{className:t.className,children:t.render?t.render(e):e[t.key]},String(t.key))),Mt.jsx(Qn,{className:"text-center",children:l?l(e):Mt.jsx(_o,{onEdit:r?()=>r(e):void 0,onDelete:s?()=>s(e):void 0,onToggleStatus:i?()=>i(e):void 0,isActive:e.is_actived})})]},e.id))})]})})}),d&&Mt.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:d.x,top:d.y},onClick:e=>e.stopPropagation(),children:Mt.jsx(jo,{onEdit:r?()=>{r(d.item),f(null)}:void 0,onDelete:s?()=>{s(d.item),f(null)}:void 0,onToggleStatus:i?()=>{i(d.item),f(null)}:void 0,isActive:d.item.is_actived,canDelete:!!s,renderAs:"context"})})]})};function Oo(e,t,n,i){const[s,l]=o({}),[c,u]=o({}),d=r(()=>e,[e]),f=e=>e instanceof Date&&!isNaN(e.getTime()),p=e=>{if(void 0!==e.defaultValue)return e.defaultValue;switch(e.type){case"multiselect":return[];case"checkbox":return!1;case"number":return 0;case"date":default:return"";case"group":return{}}},h=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(t){return p(e)}},m=(e,t,r)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let n;if("function"==typeof e.validation?n=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(n=e.validation.custom),n)try{const e=n(t,r);if(e)return e}catch(e){}}};a(()=>{if(!i)return;const e=t=>{const r=[];return t.forEach(t=>{r.push(t),t.fields&&r.push(...e(t.fields))}),r},r=e(d),o={};r.forEach(e=>{let r;if(t&&void 0!==t[e.name]){if(r=t[e.name],null==r&&(r=""),"date"===e.type&&r)if("string"==typeof r){const e=new Date(r);f(e)&&(r=e.toISOString().split("T")[0])}else f(r)&&(r=r.toISOString().split("T")[0])}else r=p(e);o[e.name]=r}),r.forEach(e=>{const t=h(e,o);void 0!==t&&(o[e.name]=t)}),l(o),u({}),n&&n(o)},[d,t,n,i]);const y=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...y(e.fields))}),t},g=()=>{const e=y(d),t={};return e.forEach(e=>{const r=m(e,s[e.name],s);r&&(t[e.name]=r)}),u(t),0===Object.keys(t).length};return{formData:s,errors:c,updateField:(e,t)=>{l(r=>{const o={...r,[e]:t},a=((e,t)=>{let r={...t};const n=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...n(e.fields))}),t};return n(d).filter(t=>t.dependsOn===e).forEach(e=>{const t=h(e,r);void 0!==t&&(r={...r,[e.name]:t})}),r})(e,o);return n&&n(a),a}),c[e]&&u(t=>{const r={...t};return delete r[e],r});const r=y(d).find(t=>t.name===e);if(r){const n=m(r,t,s);n&&u(t=>({...t,[e]:n}))}},validateForm:g,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),g()&&e(s)}}}const Eo=st.Root,So=st.Trigger,Ao=e.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},o)=>Mt.jsx(st.Portal,{children:Mt.jsx(st.Content,{ref:o,align:t,sideOffset:r,className:Dt("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Ao.displayName=st.Content.displayName;const To=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#84cc16","#f97316","#ec4899","#6b7280"],Co=({value:e="#3b82f6",onChange:t,label:r})=>Mt.jsxs("div",{className:"space-y-2",children:[r&&Mt.jsx(Wt,{children:r}),Mt.jsxs(Eo,{children:[Mt.jsx(So,{asChild:!0,children:Mt.jsxs(Ht,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[Mt.jsx("div",{className:"h-4 w-4 rounded border mr-2",style:{backgroundColor:e}}),e]})}),Mt.jsx(Ao,{className:"w-64",children:Mt.jsxs("div",{className:"space-y-3",children:[Mt.jsxs("div",{children:[Mt.jsx(Wt,{htmlFor:"color-input",children:"Cor personalizada"}),Mt.jsx(Vt,{id:"color-input",type:"color",value:e,onChange:e=>t?.(e.target.value),className:"h-10 w-full"})]}),Mt.jsxs("div",{children:[Mt.jsx(Wt,{children:"Cores predefinidas"}),Mt.jsx("div",{className:"grid grid-cols-5 gap-2 mt-2",children:To.map(e=>Mt.jsx("button",{className:"h-8 w-8 rounded border-2 border-border hover:border-primary",style:{backgroundColor:e},onClick:()=>t?.(e),"aria-label":`Selecionar cor ${e}`},e))})]})]})})]})]}),Po=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsxs(lt.Root,{ref:n,className:Dt("relative overflow-hidden",e),...r,children:[Mt.jsx(lt.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),Mt.jsx(qo,{}),Mt.jsx(lt.Corner,{})]}));Po.displayName=lt.Root.displayName;const qo=e.forwardRef(({className:e,orientation:t="vertical",...r},n)=>Mt.jsx(lt.ScrollAreaScrollbar,{ref:n,orientation:t,className:Dt("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:Mt.jsx(lt.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));qo.displayName=lt.ScrollAreaScrollbar.displayName;const Ro={Star:Te,Heart:Ae,Home:Se,User:Ee,Settings:Oe,Mail:ke,Phone:_e,Calendar:je,MapPin:Ne,Camera:we,Image:xe,Music:be,Video:ve,Book:ge,Bookmark:ye,Search:E,Filter:me,Edit:C,Trash2:R,Plus:he,Minus:pe,Check:_,X:w,ChevronDown:N,ChevronUp:j,ChevronLeft:fe,ChevronRight:A,ArrowUp:M,ArrowDown:D,ArrowLeft:de,ArrowRight:ue,Clock:ce,Bell:le,AlertCircle:O,Info:se,HelpCircle:ie,Download:ae,Upload:oe,Share:ne,Copy:re,Save:te,FileText:ee,Folder:J,FolderOpen:X,Archive:Q,Lock:Y,Unlock:G,Eye:Z,EyeOff:W,Shield:K,Key:V,Zap:H,Flame:$,Sparkles:U,Award:z,Trophy:B,Target:F},Lo=({value:e="Star",onChange:t,label:r})=>{const[n,a]=o(""),i=Object.entries(Ro).filter(([e])=>e.toLowerCase().includes(n.toLowerCase())),s=Ro[e]||Te;return Mt.jsxs("div",{className:"space-y-2",children:[r&&Mt.jsx(Wt,{children:r}),Mt.jsxs(Eo,{children:[Mt.jsx(So,{asChild:!0,children:Mt.jsxs(Ht,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[Mt.jsx(s,{className:"h-4 w-4 mr-2"}),e]})}),Mt.jsx(Ao,{className:"w-80",children:Mt.jsxs("div",{className:"space-y-3",children:[Mt.jsxs("div",{children:[Mt.jsx(Wt,{htmlFor:"icon-search",children:"Buscar ícone"}),Mt.jsx(Vt,{id:"icon-search",placeholder:"Digite o nome do ícone...",value:n,onChange:e=>a(e.target.value)})]}),Mt.jsx(Po,{className:"h-48",children:Mt.jsx("div",{className:"grid grid-cols-6 gap-2",children:i.map(([r,n])=>Mt.jsx("button",{className:"p-2 rounded border-2 hover:border-primary "+(e===r?"border-primary bg-primary/10":"border-border"),onClick:()=>t?.(r),title:r,children:Mt.jsx(n,{className:"h-4 w-4"})},r))})})]})})]})]})},Io=()=>{on.clearManualLogout()};class Mo{static async initialize(){try{if(!on.hasAllTokens()||!on.areAllTokensValid())return on.clearExpiredTokens(),{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null};const e=on.getAccessToken(),t=on.getIdToken();Io();const r=this.extractUserFromIdToken(t),n=this.extractCompaniesFromIdToken(t),o=this.extractAliasFromAccessToken(e),a=on.getSelectedAlias(),i=a&&n.some(e=>e.alias===a)?a:o||n[0]?.alias||null;if(!on.isSupabaseTokenValid()&&i){const t=await this.generateSupabaseToken(e,i);t&&on.setSupabaseToken(t)}let s=null;if(i){const e=on.getCompanyId(i),t=n.find(e=>e.alias===i);t&&(s={id:e||t.id,name:t.name,alias:t.alias})}return{isAuthenticated:!0,isLoading:!1,user:r,alias:i,companies:n,selectedUnit:s,userId:r?.id||null,userAlias:r?.id||null}}catch(e){return console.error("[Auth] Erro na inicialização:",e),{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null}}}static async loginDev(){try{const e=mn(),{data:t,error:r}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(r)return console.error("[Auth] Erro na Edge Function dev-tokens:",r),!1;if(!t?.access_token||!t?.id_token)return console.error("[Auth] Tokens ausentes na resposta"),!1;const n=new URL("/callback",window.location.origin);return n.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=n.toString(),!0}catch(e){return console.error("[Auth] Erro no login dev:",e),!1}}static loginProd(){const e=on.generateOAuthState();on.setOAuthState(e);const t=on.generateOAuthNonce();on.setOAuthNonce(t);const r=`${window.location.origin}/callback`,n=new URL(xn.oauth.authUrl);n.searchParams.set("client_id",xn.oauth.clientId),n.searchParams.set("response_type",xn.oauth.responseType),n.searchParams.set("scope",xn.oauth.scope),n.searchParams.set("redirect_uri",r),n.searchParams.set("state",e),n.searchParams.set("nonce",t),n.searchParams.set("response_mode","fragment"),jn(),window.location.href=n.toString()}static async processCallback(){try{if(on.hasAllTokens()){if(!on.getValidSupabaseToken()){const e=on.getAccessToken(),t=this.extractAliasFromAccessToken(e),r=this.extractCompaniesFromIdToken(on.getIdToken())[0]?.alias,n=t||r;if(n){const t=await this.generateSupabaseToken(e,n);t&&on.setSupabaseToken(t)}}return!0}const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),r=r=>e.get(r)||t.get(r),n=r("access_token"),o=r("id_token"),a=r("error");if(a)throw new Error(`Erro OAuth: ${a}`);if(!n||!o)throw new Error("Tokens não encontrados na URL de callback");on.setAccessToken(n),on.setIdToken(o),Io();const i=this.extractAliasFromAccessToken(n);if(i){const e=await this.generateSupabaseToken(n,i);if(!e)throw new Error("Falha ao gerar token Supabase");on.setSupabaseToken(e)}else{const e=this.extractCompaniesFromIdToken(o);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");const t=e[0].alias,r=await this.generateSupabaseToken(n,t);if(!r)throw new Error("Falha ao gerar token Supabase");on.setSupabaseToken(r)}return on.clearOAuthState(),on.clearOAuthNonce(),!0}catch(e){throw console.error("❌ [CallbackPage] Erro ao processar callback:",e),e}}static logout(){on.setManualLogout(),on.clearAll(),window.location.href="/login"}static decodeToken(e){try{const t=e.split(".")[1],r=atob(t),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);const o=new TextDecoder("utf-8").decode(n);return JSON.parse(o)}catch{return null}}static extractUserFromIdToken(e){const t=this.decodeToken(e);return t?{id:t.subNewId,email:t.email,name:t.name,identifier:t.identifier}:null}static extractCompaniesFromIdToken(e){const t=this.decodeToken(e);if(!t)return[];const r=[];return Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const n=t[e].split(";");if(n.length>=4)r.push({id:n.length>7?n[7].trim():"",alias:n[0].trim(),name:n[3].trim()});else{const[n,o]=t[e].split("|");n&&o&&r.push({id:"",alias:n.trim(),name:o.trim()})}}}),r}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}static async generateSupabaseToken(e,t){try{const r=mn(),{data:n,error:o}=await r.functions.invoke("validate-token",{body:{access_token:e,alias:t}});return o?(console.error("[Auth] Erro na Edge Function validate-token:",o),o.message?.includes("401")||o.message?.includes("Unauthorized")?(console.warn("[Auth] Tokens Qualiex expirados, forçando logout"),this.logout(),null):null):n?.access_token?n.access_token:(console.error("[Auth] Token Supabase ausente na resposta"),null)}catch(e){return console.error("[Auth] Erro ao gerar token Supabase:",e),e instanceof Error&&(e.message.includes("401")||e.message.includes("Unauthorized"))&&(console.warn("[Auth] Possível token expirado, forçando logout"),this.logout()),null}}}var Do=Object.freeze({__proto__:null,AuthService:Mo});class Fo{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(console.warn("[AuthErrorInterceptor] Erro de autenticação detectado, limpando tokens e forçando logout"),on.clearAll(),window.location.href="/",!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const r=t.toLowerCase();return["401","unauthorized","token","expired","invalid","authentication","login","session"].some(e=>r.includes(e))}static async wrapAsync(e){try{return await e}catch(e){if(!this.handleError(e))throw e;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}const Bo=i(void 0),zo=({children:e})=>{const[t,i]=o({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null});let s=null;try{s=Ge()}catch{}const[l,c]=o(!1),[u,d]=o(0),f=n(e=>{i(t=>({...t,...e}))},[]),p=n(e=>{i(t=>({...t,isLoading:e}))},[]),h=n(()=>{i({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null})},[]),m=n(async e=>{try{p(!0);const t=on.getAccessToken();if(!t)return void console.error("[AuthContext] Access token não encontrado para trocar unidade");const r=await Mo.generateSupabaseToken(t,e.alias);if(!r)return void console.error("[AuthContext] Erro ao gerar token Supabase para nova unidade");on.setSupabaseToken(r),on.setSelectedAlias(e.alias);const n={id:on.getCompanyId(e.alias)||e.id,name:e.name,alias:e.alias};f({alias:e.alias,selectedUnit:n}),s&&await s.invalidateQueries()}catch(t){console.error("[AuthContext] Erro ao trocar unidade",t,e)}finally{p(!1)}},[f,s,p]),y=n(async()=>await Mo.processCallback(),[]),g=n(async()=>{Mo.logout(),h(),s&&await s.clear()},[h,s]),v=n(e=>{c(e)},[]),b=n(()=>{d(e=>e+1)},[]),x=n(()=>{d(e=>e+1)},[]);a(()=>{if(!t.isAuthenticated)return;let e=!0;const r=setInterval(()=>{e&&(on.areAllTokensValid()||(console.warn("[AuthContext] Tokens expirados detectados, fazendo logout"),e&&g()))},6e5);return()=>{e=!1,clearInterval(r)}},[t.isAuthenticated,g]),a(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await Mo.initialize();if(!e)return;t&&t.isAuthenticated?f({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias}):e&&p(!1)}catch(t){console.error("[AuthContext] Erro na inicialização da autenticação",t),e&&(Fo.handleError(t),p(!1))}})(),()=>{e=!1}},[f,p,g]);const w=r(()=>({...t,logout:g,processCallback:y,switchUnit:m,availableUnits:t.companies,isSearchVisible:l,setSearchVisible:v,clearSearch:b,refreshData:x}),[t,g,y,m,l,v,b,x]);return Mt.jsx(Bo.Provider,{value:w,children:e})},Uo=()=>{const e=s(Bo);if(void 0===e)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return e},$o=(e={})=>{const{user:t,alias:r}=Uo(),n=On(),{enabled:o=n.enableUsersApi}=e;return Ye({queryKey:["qualiex-users",r],queryFn:()=>vn.getUsers(r),enabled:o&&!!r&&!!t,retry:2,retryDelay:1e3})},Ho=({value:e="",onChange:t,placeholder:r="Selecionar usuário",disabled:n,className:o,enabled:a})=>{const{data:i=[],isLoading:s,error:l}=$o({enabled:a});return s?Mt.jsx(Jn,{className:Dt("h-10 w-full",o)}):l?Mt.jsxs("div",{className:`flex items-center gap-2 p-2 border border-destructive/20 rounded-md ${o}`,children:[Mt.jsx(O,{className:"h-4 w-4 text-destructive"}),Mt.jsx("span",{className:"text-sm text-destructive",children:"Erro ao carregar usuários"})]}):Mt.jsxs(br,{value:e,onValueChange:t,disabled:n||0===i.length,children:[Mt.jsx(wr,{className:o,children:Mt.jsx(xr,{placeholder:r})}),Mt.jsx(_r,{children:0===i.length?Mt.jsx(kr,{value:"no-users",disabled:!0,children:"Nenhum usuário encontrado"}):i.map(e=>Mt.jsx(kr,{value:e.userId,children:e.userName},e.userId))})]})},Vo=({value:e,onChange:t,placeholder:r="Selecionar responsável",disabled:n,className:o})=>Mt.jsxs(br,{value:e,onValueChange:t,disabled:n,children:[Mt.jsx(wr,{className:o,children:Mt.jsx(xr,{placeholder:r})}),Mt.jsx(_r,{children:Mt.jsx(kr,{value:"placeholder",children:"Responsável placeholder"})})]});function Ko({title:e,sections:a,initialData:i,onSubmit:s,onCancel:l,open:c,submitButtonText:u="Salvar",isLoading:d=!1,usersData:f}){const[p,h]=o(a?.[0]?.id||""),m=r(()=>a&&Array.isArray(a)?a.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[a]),{formData:y,errors:g,updateField:v,handleSubmit:b}=Oo(m,i,void 0,c),x=r(()=>a&&Array.isArray(a)?a.map(e=>({...e,disabled:e.condition?!e.condition(y):e.disabled||!1})):[],[a,y]),w=r(()=>{const e=x.find(e=>e.id===p);if(e&&!e.disabled)return p;const t=x.find(e=>!e.disabled);return t?.id||p},[x,p]);t.useEffect(()=>{w!==p&&h(w)},[w,p]);const N=x.find(e=>e.id===w),j=e=>{const t=(e.computedValue,y[e.name]),r=void 0!==t?t:"",n=g[e.name];switch(e.type){case"group":return Mt.jsxs("div",{className:"space-y-2",children:[e.label,Mt.jsx("div",{className:e.className||("horizontal"===e.layout?"flex gap-3":"space-y-3"),children:e.fields?.map(e=>j(e))})]},e.name);case"user-select":return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Ho,{value:r||"",onChange:t=>v(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:n?"border-red-500":""}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"textarea":return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Er,{id:e.name,value:r||"",onChange:t=>{v(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"select":return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsxs(br,{value:String(r),onValueChange:t=>{v(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[Mt.jsx(wr,{className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,children:Mt.jsx(xr,{placeholder:e.placeholder})}),Mt.jsx(_r,{children:e.options?.map(e=>Mt.jsx(kr,{value:e.value,children:e.label},e.value))})]}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"date":return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Vt,{id:e.name,type:"date",value:String(r),onChange:t=>v(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:Dt("w-full",n?"border-red-500":"",e.disabled?"bg-gray-100 cursor-not-allowed":"")}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"single-responsible-select":return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Vo,{value:String(r),onChange:t=>v(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:n?"border-red-500":""}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"simple-qualiex-user-field":const t=On();return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Ho,{value:r??"",onChange:t=>v(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:n?"border-red-500":"",enabled:t.enableUsersApi}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);case"color":return Mt.jsxs("div",{children:[Mt.jsxs(Wt,{htmlFor:e.name,children:[e.label," ",e.required&&Mt.jsx("span",{className:"text-destructive",children:"*"})]}),Mt.jsx(Vt,{id:e.name,type:"color",value:r||e.defaultValue||"#000000",onChange:t=>v(e.name,t.target.value),className:"h-10"}),n&&Mt.jsx("p",{className:"text-sm text-destructive mt-1",children:n})]},e.name);case"color-picker":return Mt.jsxs("div",{children:[Mt.jsx(Co,{label:`${e.label} ${e.required?"*":""}`,value:r||e.defaultValue||"#3b82f6",onChange:t=>v(e.name,t)}),n&&Mt.jsx("p",{className:"text-sm text-destructive mt-1",children:n})]},e.name);case"icon-picker":return Mt.jsxs("div",{children:[Mt.jsx(Lo,{label:`${e.label} ${e.required?"*":""}`,value:r||e.defaultValue||"Star",onChange:t=>v(e.name,t)}),n&&Mt.jsx("p",{className:"text-sm text-destructive mt-1",children:n})]},e.name);case"number":return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Vt,{id:e.name,type:"number",value:null!=r?String(r):"",onChange:t=>{const r=t.target.value,n=""===r?null:Number(r);v(e.name,n)},placeholder:e.placeholder,disabled:e.disabled,className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name);default:return Mt.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[Mt.jsx(Wt,{htmlFor:e.name,children:e.label}),Mt.jsx(Vt,{id:e.name,type:"text",value:r||"",onChange:t=>{v(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${n?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,readOnly:e.disabled}),n&&Mt.jsx("p",{className:"text-sm text-red-500",children:n})]},e.name)}},_=n(()=>{if(!N)return null;if(N.disabled)return Mt.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[Mt.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:Mt.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:Mt.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),Mt.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),Mt.jsx("p",{className:"text-muted-foreground max-w-sm",children:'Complete as informações obrigatórias na seção "Informações Gerais" para acessar esta seção.'})]});if(N.component){const e=N.component;return Mt.jsx(e,{formData:y,updateField:v,errors:g,users:f,disabled:N.disabled})}return Mt.jsx("div",{className:"space-y-3",children:N.fields.map(j)})},[N,y,v,g,f,j]),k=Mt.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[x.length>1&&Mt.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:Mt.jsx("div",{className:"flex space-x-2",children:x.map(e=>Mt.jsx(Ht,{variant:w===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=x.find(t=>t.id===e);t&&!t.disabled&&h(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),Mt.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 pt-0 pb-2 md:pb-4",children:d?Mt.jsx("div",{className:"flex items-center justify-center py-12",children:Mt.jsx("div",{className:"text-muted-foreground",children:"Carregando dados..."})}):Mt.jsxs("form",{onSubmit:b(s),className:"space-y-3 md:space-y-4",children:[_(),Mt.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[Mt.jsx(Ht,{type:"button",variant:"outline",onClick:l,children:"Cancelar"}),Mt.jsx(Ht,{type:"submit",disabled:d,children:u})]})]})})]});return Mt.jsx(er,{open:c,onOpenChange:e=>{!1===e&&!0===c&&l()},children:Mt.jsxs(ar,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[Mt.jsxs(ir,{className:"bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-4",children:[Mt.jsx(lr,{className:"text-white",children:e}),Mt.jsx(cr,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),k]})})}function Wo({open:e,title:t,sections:r,initialData:n,onSubmit:o,onCancel:a,isLoading:i=!1,submitButtonText:s="Salvar"}){return Mt.jsx(Ko,{open:e,title:t,sections:r,initialData:n,onSubmit:o,onCancel:a,isLoading:i,submitButtonText:s})}const Zo=({manager:e})=>{const{pagination:t={totalItems:0,totalPages:1},currentPage:r=1,itemsPerPage:n=10,handlePageChange:o=()=>{},handleItemsPerPageChange:a=()=>{}}=e,{totalItems:i=0,totalPages:s=1}=t,l=i>0?(r-1)*n+1:0,c=Math.min(r*n,i);return Mt.jsxs("div",{className:"px-4 h-12 flex items-center justify-between text-sm text-muted-foreground bg-muted/50 border-t border-border flex-shrink-0 mt-auto",children:[Mt.jsxs("div",{className:"flex items-center space-x-3",children:[Mt.jsx("span",{children:"Itens por página"}),Mt.jsxs(br,{value:n.toString(),onValueChange:e=>a(Number(e)),children:[Mt.jsx(wr,{className:"w-20 h-8 border-border",children:Mt.jsx(xr,{})}),Mt.jsxs(_r,{children:[Mt.jsx(kr,{value:"10",children:"10"}),Mt.jsx(kr,{value:"25",children:"25"}),Mt.jsx(kr,{value:"50",children:"50"}),Mt.jsx(kr,{value:"100",children:"100"})]})]})]}),Mt.jsx("div",{className:"flex-1 flex justify-center",children:Mt.jsx("span",{children:i>0?`${l}-${c} de ${i} itens (página ${r} de ${s})`:"0 itens"})}),Mt.jsxs("div",{className:"flex items-center space-x-1",children:[Mt.jsx(Ht,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:1===r,children:Mt.jsx(Ce,{className:"h-4 w-4"})}),Mt.jsx(Ht,{variant:"outline",size:"sm",onClick:()=>o(Math.max(1,r-1)),disabled:1===r,children:Mt.jsx(fe,{className:"h-4 w-4"})}),Mt.jsx(Ht,{variant:"outline",size:"sm",onClick:()=>o(Math.min(s,r+1)),disabled:r===s,children:Mt.jsx(A,{className:"h-4 w-4"})}),Mt.jsx(Ht,{variant:"outline",size:"sm",onClick:()=>o(s),disabled:r===s,children:Mt.jsx(Pe,{className:"h-4 w-4"})})]})]})};function Go({manager:e,config:t,formSections:r,onSave:n,FormComponent:a,TableComponent:i,onToggleStatus:s}){const[l,c]=o(!1),[u,d]=o(null),[f,p]=o({isOpen:!1,entityId:null,entityName:""}),h=e=>{t.onEdit?t.onEdit(e):(d(e),c(!0))},m=()=>{c(!1),d(null)},y=e=>{n(e),c(!1),d(null)},g=e=>{p({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})};return Mt.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[Mt.jsx("div",{className:"flex-shrink-0 flex justify-between items-center px-4 py-1.5 bg-muted/50 border-b",children:Mt.jsx("div",{className:"flex items-center gap-4",children:Mt.jsxs(Ht,{onClick:()=>{t.onNew?t.onNew():(d(null),c(!0))},className:"flex items-center gap-2",children:[Mt.jsx(he,{size:16}),t.newButtonText||"Novo"]})})}),Mt.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:i?Mt.jsx(i,{manager:e,onEdit:h,onDelete:g,onToggleStatus:s}):Mt.jsx(ko,{manager:e,columns:t.columns,onEdit:h,onDelete:g,onToggleStatus:s})}),Mt.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:Mt.jsx(Zo,{manager:e})}),!t.useCustomRouting&&(a?Mt.jsx(a,{open:l,onCancel:m,onSubmit:y,editingEntity:u,isLoading:e.isLoading}):Mt.jsx(Wo,{open:l,title:u?`Editar ${t.entityName}`:`Novo ${t.entityName}`,sections:r,initialData:u||void 0,onSubmit:y,onCancel:m,isLoading:e.isLoading,submitButtonText:u?"Atualizar":"Criar"})),Mt.jsx(Hn,{open:f.isOpen,onOpenChange:()=>{p({isOpen:!1,entityId:null,entityName:""})},onConfirm:t=>{f.entityId&&(e.deleteEntity(f.entityId),p({isOpen:!1,entityId:null,entityName:""}))},item:f.entityId?{id:f.entityId,title:f.entityName}:void 0,entityName:t.entityName,isDeleting:e.isDeleting})]})}function Yo({manager:e,config:t,formSections:r,onSave:n,FormComponent:o,TableComponent:i,onToggleStatus:s}){const{setSearchVisible:l,refreshData:c}=Uo();return a(()=>(l(!0),()=>{l(!1)}),[l]),Mt.jsx(Go,{manager:e,config:t,formSections:r,onSave:n,FormComponent:o,TableComponent:i,onToggleStatus:s})}function Qo(e){return()=>{const{manager:t,config:r,onSave:n,onToggleStatus:o,FormComponent:a}=e,i={entityName:r.entityName,entityNamePlural:r.entityNamePlural,filters:r.filters||[],columns:r.columns,cardFields:r.cardFields||[]};return Mt.jsx(Yo,{manager:t,config:i,formSections:r.formSections,onSave:n,FormComponent:a,onToggleStatus:o})}}function Xo(e,t,r){return n=>{if(n.id){const t=r(n);e.updateEntity(n.id,t)}else{const r=t(n);e.createEntity(r)}}}function Jo(e,t,r={}){const n=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const r=t[e],o={key:e,header:ta(e),label:ta(e),...ea(e,r),sortable:!0,searchable:"string"==typeof r};n.push(o)}}),{title:e,columns:n,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...r}}function ea(e,t){const r=e.toLowerCase();return r.includes("email")?{type:"email",required:!0}:r.includes("phone")||r.includes("tel")?{type:"tel"}:r.includes("description")||r.includes("content")||r.includes("notes")?{type:"textarea"}:r.includes("status")||r.includes("type")||r.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function ta(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const ra={user:{title:"Usuários",searchPlaceholder:"Buscar usuários...",enableDelete:!1},product:{title:"Produtos",searchPlaceholder:"Buscar produtos...",enableFilters:!0},order:{title:"Pedidos",searchPlaceholder:"Buscar pedidos...",enableCreate:!1},category:{title:"Categorias",searchPlaceholder:"Buscar categorias...",itemsPerPage:20}};function na(e,t,r={}){const n=ra[e];return Jo(n.title,t,{...n,...r})}const oa=({children:e})=>{const{isAuthenticated:r,isLoading:n}=Uo();if(t.useEffect(()=>{if(!r)return;const e=()=>{on.areAllTokensValid()||(console.warn("[ProtectedRoute] Tokens expirados detectados, forçando logout"),Mo.logout())};e();const t=setInterval(e,3e5);return()=>clearInterval(t)},[r]),t.useEffect(()=>{if(n)return;if(r)return;if(on.isManualLogout())return void(window.location.href="/login");const e=new URLSearchParams(window.location.search),t=window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash,o=new URLSearchParams(t);if(e.has("access_token")||o.has("access_token"))return;const a=jn();(async()=>{a?await Mo.loginDev():Mo.loginProd()})()},[r,n]),n)return Mt.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsx(Gt,{className:"text-center",children:Mt.jsx(Yt,{className:"text-xl font-semibold",children:"Carregando..."})}),Mt.jsxs(Xt,{className:"text-center",children:[Mt.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),Mt.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!r){return new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token")?Mt.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsx(Gt,{className:"text-center",children:Mt.jsx(Yt,{className:"text-xl font-semibold",children:"Processando..."})}),Mt.jsxs(Xt,{className:"text-center",children:[Mt.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),Mt.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})}):Mt.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsx(Gt,{className:"text-center",children:Mt.jsx(Yt,{className:"text-xl font-semibold",children:"Iniciando..."})}),Mt.jsxs(Xt,{className:"text-center",children:[Mt.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),Mt.jsx("p",{className:"text-muted-foreground",children:jn()?"Fazendo login automático...":"Redirecionando para autenticação..."})]})]})})}return Mt.jsx(Mt.Fragment,{children:e})},aa=p("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),ia=e.forwardRef(({className:e,variant:t,...r},n)=>Mt.jsx("div",{ref:n,role:"alert",className:Dt(aa({variant:t}),e),...r}));ia.displayName="Alert";const sa=e.forwardRef(({className:e,...t},r)=>Mt.jsx("h5",{ref:r,className:Dt("mb-1 font-medium leading-none tracking-tight",e),...t}));sa.displayName="AlertTitle";const la=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("text-sm [&_p]:leading-relaxed",e),...t}));la.displayName="AlertDescription";const ca=()=>{const{processCallback:e}=Uo(),[t,r]=o(null),[n,i]=o(!1);a(()=>{(async()=>{try{if(await e()){window.history.replaceState({},document.title,"/");const e=localStorage.getItem("auth_return_url");e?(localStorage.removeItem("auth_return_url"),window.location.href=e):window.location.href="/"}else r("Falha na autenticação. Tente novamente.")}catch(e){console.error("❌ [CallbackPage] Erro no processamento:",e),r(e?.message||"Erro durante a autenticação. Tente novamente.")}})()},[e]);const s=async()=>{i(!0),r(null);try{await e()||r("Falha na autenticação. Tente novamente.")}catch(e){r(e?.message||"Erro ao tentar novamente.")}finally{i(!1)}},l=()=>{window.location.href="/"};return t?Mt.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsx(Gt,{className:"text-center",children:Mt.jsxs(Yt,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[Mt.jsx(O,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),Mt.jsxs(Xt,{className:"space-y-4",children:[Mt.jsx(ia,{variant:"destructive",children:Mt.jsx(la,{children:t})}),Mt.jsx("div",{className:"text-sm text-muted-foreground",children:Mt.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),Mt.jsxs("div",{className:"flex gap-2",children:[Mt.jsx(Ht,{onClick:s,disabled:n,className:"flex-1",children:n?Mt.jsxs(Mt.Fragment,{children:[Mt.jsx(Cr,{size:"sm",className:"mr-2"}),"Tentando..."]}):Mt.jsxs(Mt.Fragment,{children:[Mt.jsx(qe,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),Mt.jsx(Ht,{onClick:l,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):Mt.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsx(Gt,{className:"text-center",children:Mt.jsx(Yt,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),Mt.jsxs(Xt,{className:"text-center",children:[Mt.jsx("div",{className:"flex justify-center mb-4",children:Mt.jsx(Cr,{size:"lg"})}),Mt.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},ua=()=>Mt.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsx(Gt,{className:"text-center",children:Mt.jsx(Yt,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),Mt.jsxs(Xt,{className:"text-center space-y-4",children:[Mt.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),Mt.jsx(Ht,{onClick:async()=>{jn()?await Mo.loginDev():Mo.loginProd()},className:"w-full",size:"lg",children:jn()?"Login Desenvolvimento":"Entrar com Qualiex"})]})]})});function da(e){return{queryClient:e.queryClient||new Xe({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}}const fa=ct.Root,pa=e.forwardRef(({className:e,...t},r)=>Mt.jsx(ct.Item,{ref:r,className:Dt("border-b",e),...t}));pa.displayName="AccordionItem";const ha=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsx(ct.Header,{className:"flex",children:Mt.jsxs(ct.Trigger,{ref:n,className:Dt("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,Mt.jsx(N,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ha.displayName=ct.Trigger.displayName;const ma=e.forwardRef(({className:e,children:t,...r},n)=>Mt.jsx(ct.Content,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:Mt.jsx("div",{className:Dt("pb-4 pt-0",e),children:t})}));ma.displayName=ct.Content.displayName;const ya=ut.Root,ga=e.forwardRef(({className:e,...t},r)=>Mt.jsx(dt.Root,{ref:r,className:Dt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ga.displayName=dt.Root.displayName;const va=e.forwardRef(({className:e,...t},r)=>Mt.jsx(dt.Image,{ref:r,className:Dt("aspect-square h-full w-full",e),...t}));va.displayName=dt.Image.displayName;const ba=e.forwardRef(({className:e,...t},r)=>Mt.jsx(dt.Fallback,{ref:r,className:Dt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ba.displayName=dt.Fallback.displayName;const xa=e.forwardRef(({...e},t)=>Mt.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));xa.displayName="Breadcrumb";const wa=e.forwardRef(({className:e,...t},r)=>Mt.jsx("ol",{ref:r,className:Dt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));wa.displayName="BreadcrumbList";const Na=e.forwardRef(({className:e,...t},r)=>Mt.jsx("li",{ref:r,className:Dt("inline-flex items-center gap-1.5",e),...t}));Na.displayName="BreadcrumbItem";const ja=e.forwardRef(({asChild:t,className:r,...n},o)=>{const a=t?e.Fragment:"a";return Mt.jsx(a,{ref:o,className:Dt("transition-colors hover:text-foreground",r),...n})});ja.displayName="BreadcrumbLink";const _a=e.forwardRef(({className:e,...t},r)=>Mt.jsx("span",{ref:r,role:"link","aria-disabled":"true","aria-current":"page",className:Dt("font-normal text-foreground",e),...t}));_a.displayName="BreadcrumbPage";const ka=({children:e,className:t,...r})=>Mt.jsx("li",{role:"presentation","aria-hidden":"true",className:Dt("[&>svg]:size-3.5",t),...r,children:e??Mt.jsx(A,{})});ka.displayName="BreadcrumbSeparator";const Oa=({className:e,...t})=>Mt.jsxs("span",{role:"presentation","aria-hidden":"true",className:Dt("flex h-9 w-9 items-center justify-center",e),...t,children:[Mt.jsx(Re,{className:"h-4 w-4"}),Mt.jsx("span",{className:"sr-only",children:"More"})]});function Ea(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function Sa(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,o=r?.width?String(r.width):t;n=e.formattingValues[o]||e.formattingValues[t]}else{const t=e.defaultWidth,o=r?.width?String(r.width):e.defaultWidth;n=e.values[o]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function Aa(e){return(t,r={})=>{const n=r.width,o=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(o);if(!a)return null;const i=a[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r;return}(s,e=>e.test(i)):function(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r;return}(s,e=>e.test(i));let c;c=e.valueCallback?e.valueCallback(l):l,c=r.valueCallback?r.valueCallback(c):c;return{value:c,rest:t.slice(i.length)}}}Oa.displayName="BreadcrumbEllipsis";const Ta={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"cerca de 1 hora",other:"cerca de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"cerca de 1 semana",other:"cerca de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"cerca de 1 mês",other:"cerca de {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"cerca de 1 ano",other:"cerca de {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Ca={date:Ea({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/yyyy"},defaultWidth:"full"}),time:Ea({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Ea({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Pa={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"};var qa;const Ra={code:"pt-BR",formatDistance:(e,t,r)=>{let n;const o=Ta[e];return n="string"==typeof o?o:1===t?o.one:o.other.replace("{{count}}",String(t)),r?.addSuffix?r.comparison&&r.comparison>0?"em "+n:"há "+n:n},formatLong:Ca,formatRelative:(e,t,r,n)=>{const o=Pa[e];return"function"==typeof o?o(t):o},localize:{ordinalNumber:(e,t)=>{const r=Number(e);return"week"===t?.unit?r+"ª":r+"º"},era:Sa({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:Sa({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:Sa({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:Sa({values:{narrow:["D","S","T","Q","Q","S","S"],short:["dom","seg","ter","qua","qui","sex","sab"],abbreviated:["domingo","segunda","terça","quarta","quinta","sexta","sábado"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:Sa({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"tarde",night:"noite"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"},wide:{am:"a.m.",pm:"p.m.",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da tarde",night:"da noite"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(qa={matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const r=e.match(qa.matchPattern);if(!r)return null;const n=r[0],o=e.match(qa.parsePattern);if(!o)return null;let a=qa.valueCallback?qa.valueCallback(o[0]):o[0];return a=t.valueCallback?t.valueCallback(a):a,{value:a,rest:e.slice(n.length)}}),era:Aa({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|d\.?\s?c\.?)/i,wide:/^(antes de cristo|depois de cristo)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^antes de cristo/i,/^depois de cristo/i]},defaultParseWidth:"any"}),quarter:Aa({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:Aa({matchPatterns:{narrow:/^[jfmajsond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^fev/i,/^mar/i,/^abr/i,/^mai/i,/^jun/i,/^jul/i,/^ago/i,/^set/i,/^out/i,/^nov/i,/^dez/i]},defaultParseWidth:"any"}),day:Aa({matchPatterns:{narrow:/^(dom|[23456]ª?|s[aá]b)/i,short:/^(dom|[23456]ª?|s[aá]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[aá]b)/i,wide:/^(domingo|(segunda|ter[cç]a|quarta|quinta|sexta)([- ]feira)?|s[aá]bado)/i},defaultMatchWidth:"wide",parsePatterns:{short:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],narrow:[/^d/i,/^2/i,/^3/i,/^4/i,/^5/i,/^6/i,/^s[aá]/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[aá]b/i]},defaultParseWidth:"any"}),dayPeriod:Aa({matchPatterns:{narrow:/^(a|p|mn|md|(da) (manhã|tarde|noite))/i,any:/^([ap]\.?\s?m\.?|meia[-\s]noite|meio[-\s]dia|(da) (manhã|tarde|noite))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn|^meia[-\s]noite/i,noon:/^md|^meio[-\s]dia/i,morning:/manhã/i,afternoon:/tarde/i,evening:/tarde/i,night:/noite/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function La({className:e,classNames:t,showOutsideDays:r=!0,...n}){return Mt.jsx(ft,{showOutsideDays:r,className:Dt("p-3",e),locale:Ra,classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:Dt($t({variant:"outline"}),"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:Dt($t({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",day_selected:"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",day_today:"bg-accent text-accent-foreground",day_outside:"day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...t},components:{IconLeft:({...e})=>Mt.jsx(fe,{className:"h-4 w-4"}),IconRight:({...e})=>Mt.jsx(A,{className:"h-4 w-4"})},...n})}La.displayName="Calendar";const Ia=e.createContext(null);function Ma(){const t=e.useContext(Ia);if(!t)throw new Error("useCarousel must be used within a <Carousel />");return t}const Da=e.forwardRef(({orientation:t="horizontal",opts:r,setApi:n,plugins:o,className:a,children:i,...s},l)=>{const[c,u]=pt({...r,axis:"horizontal"===t?"x":"y"},o),[d,f]=e.useState(!1),[p,h]=e.useState(!1),m=e.useCallback(e=>{e&&(f(e.canScrollPrev()),h(e.canScrollNext()))},[]),y=e.useCallback(()=>{u?.scrollPrev()},[u]),g=e.useCallback(()=>{u?.scrollNext()},[u]),v=e.useCallback(e=>{"ArrowLeft"===e.key?(e.preventDefault(),y()):"ArrowRight"===e.key&&(e.preventDefault(),g())},[y,g]);return e.useEffect(()=>{u&&n&&n(u)},[u,n]),e.useEffect(()=>{if(u)return m(u),u.on("reInit",m),u.on("select",m),()=>{u?.off("select",m)}},[u,m]),Mt.jsx(Ia.Provider,{value:{carouselRef:c,api:u,opts:r,orientation:t||("y"===r?.axis?"vertical":"horizontal"),scrollPrev:y,scrollNext:g,canScrollPrev:d,canScrollNext:p},children:Mt.jsx("div",{ref:l,onKeyDownCapture:v,className:Dt("relative",a),role:"region","aria-roledescription":"carousel",...s,children:i})})});Da.displayName="Carousel";const Fa=e.forwardRef(({className:e,...t},r)=>{const{carouselRef:n,orientation:o}=Ma();return Mt.jsx("div",{ref:n,className:"overflow-hidden",children:Mt.jsx("div",{ref:r,className:Dt("flex","horizontal"===o?"-ml-4":"-mt-4 flex-col",e),...t})})});Fa.displayName="CarouselContent";const Ba=e.forwardRef(({className:e,...t},r)=>{const{orientation:n}=Ma();return Mt.jsx("div",{ref:r,role:"group","aria-roledescription":"slide",className:Dt("min-w-0 shrink-0 grow-0 basis-full","horizontal"===n?"pl-4":"pt-4",e),...t})});Ba.displayName="CarouselItem";const za=e.forwardRef(({className:e,variant:t="outline",size:r="icon",...n},o)=>{const{orientation:a,scrollPrev:i,canScrollPrev:s}=Ma();return Mt.jsxs(Ht,{ref:o,variant:t,size:r,className:Dt("absolute h-8 w-8 rounded-full","horizontal"===a?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!s,onClick:i,...n,children:[Mt.jsx(de,{className:"h-4 w-4"}),Mt.jsx("span",{className:"sr-only",children:"Previous slide"})]})});za.displayName="CarouselPrevious";const Ua=e.forwardRef(({className:e,variant:t="outline",size:r="icon",...n},o)=>{const{orientation:a,scrollNext:i,canScrollNext:s}=Ma();return Mt.jsxs(Ht,{ref:o,variant:t,size:r,className:Dt("absolute h-8 w-8 rounded-full","horizontal"===a?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!s,onClick:i,...n,children:[Mt.jsx(ue,{className:"h-4 w-4"}),Mt.jsx("span",{className:"sr-only",children:"Next slide"})]})});Ua.displayName="CarouselNext";const $a={light:"",dark:".dark"},Ha=e.createContext(null);function Va(){const t=e.useContext(Ha);if(!t)throw new Error("useChart must be used within a <ChartContainer />");return t}const Ka=e.forwardRef(({id:t,className:r,children:n,config:o,...a},i)=>{const s=e.useId(),l=`chart-${t||s.replace(/:/g,"")}`;return Mt.jsx(Ha.Provider,{value:{config:o},children:Mt.jsxs("div",{"data-chart":l,ref:i,className:Dt("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",r),...a,children:[Mt.jsx(Wa,{id:l,config:o}),Mt.jsx(ht.ResponsiveContainer,{children:n})]})})});Ka.displayName="Chart";const Wa=({id:e,config:t})=>{const r=Object.entries(t).filter(([e,t])=>t.theme||t.color);return r.length?Mt.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries($a).map(([t,n])=>`\n${n} [data-chart=${e}] {\n${r.map(([e,r])=>{const n=r.theme?.[t]||r.color;return n?` --color-${e}: ${n};`:null}).join("\n")}\n}\n`).join("\n")}}):null},Za=ht.Tooltip,Ga=e.forwardRef(({active:t,payload:r,className:n,indicator:o="dot",hideLabel:a=!1,hideIndicator:i=!1,label:s,labelFormatter:l,labelClassName:c,formatter:u,color:d,nameKey:f,labelKey:p},h)=>{const{config:m}=Va(),y=e.useMemo(()=>{if(a||!r?.length)return null;const[e]=r,t=`${p||e.dataKey||e.name||"value"}`,n=Xa(m,e,t),o=p||"string"!=typeof s?n?.label:m[s]?.label||s;return l?Mt.jsx("div",{className:Dt("font-medium",c),children:l(o,r)}):o?Mt.jsx("div",{className:Dt("font-medium",c),children:o}):null},[s,l,r,a,c,m,p]);if(!t||!r?.length)return null;const g=1===r.length&&"dot"!==o;return Mt.jsxs("div",{ref:h,className:Dt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[g?null:y,Mt.jsx("div",{className:"grid gap-1.5",children:r.map((e,t)=>{const r=`${f||e.name||e.dataKey||"value"}`,n=Xa(m,e,r),a=d||e.payload.fill||e.color;return Mt.jsx("div",{className:Dt("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===o&&"items-center"),children:u&&void 0!==e?.value&&e.name?u(e.value,e.name,e,t,e.payload):Mt.jsxs(Mt.Fragment,{children:[n?.icon?Mt.jsx(n.icon,{}):!i&&Mt.jsx("div",{className:Dt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===o,"w-1":"line"===o,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===o,"my-0.5":g&&"dashed"===o}),style:{"--color-bg":a,"--color-border":a}}),Mt.jsxs("div",{className:Dt("flex flex-1 justify-between leading-none",g?"items-end":"items-center"),children:[Mt.jsxs("div",{className:"grid gap-1.5",children:[g?y:null,Mt.jsx("span",{className:"text-muted-foreground",children:n?.label||e.name})]}),e.value&&Mt.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})});Ga.displayName="ChartTooltip";const Ya=ht.Legend,Qa=e.forwardRef(({className:e,hideIcon:t=!1,payload:r,verticalAlign:n="bottom",nameKey:o},a)=>{const{config:i}=Va();return r?.length?Mt.jsx("div",{ref:a,className:Dt("flex items-center justify-center gap-4","top"===n?"pb-3":"pt-3",e),children:r.map(e=>{const r=`${o||e.dataKey||"value"}`,n=Xa(i,e,r);return Mt.jsxs("div",{className:Dt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[n?.icon&&!t?Mt.jsx(n.icon,{}):Mt.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null});function Xa(e,t,r){if("object"!=typeof t||null===t)return;const n="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0;let o=r;return r in t&&"string"==typeof t[r]?o=t[r]:n&&r in n&&"string"==typeof n[r]&&(o=n[r]),o in e?e[o]:e[r]}Qa.displayName="ChartLegend";const Ja=mt.Root,ei=mt.CollapsibleTrigger,ti=mt.CollapsibleContent,ri=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ri.displayName="Command";const ni=({children:e,...t})=>Mt.jsx("div",{...t,children:Mt.jsx(ri,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:e})}),oi=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:Mt.jsx("input",{ref:r,className:Dt("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})}));oi.displayName="CommandInput";const ai=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));ai.displayName="CommandList";const ii=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("py-6 text-center text-sm text-muted-foreground",e),...t}));ii.displayName="CommandEmpty";const si=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));si.displayName="CommandGroup";const li=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("-mx-1 h-px bg-border",e),...t}));li.displayName="CommandSeparator";const ci=e.forwardRef(({className:e,disabled:t,onSelect:r,value:n,...o},a)=>Mt.jsx("div",{ref:a,className:Dt("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",e),"data-disabled":t,onClick:()=>!t&&r?.(n||""),...o}));ci.displayName="CommandItem";const ui=({className:e,...t})=>Mt.jsx("span",{className:Dt("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});ui.displayName="CommandShortcut";const di={Root:function({children:e,className:t}){return Mt.jsx("div",{className:Dt("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:r}){return Mt.jsx(Zt,{className:Dt("transition-colors",t&&"cursor-pointer hover:bg-muted/50",r),onClick:t,children:Mt.jsx(Xt,{className:"p-4",children:e})})},Field:function({label:e,value:t,className:r}){return Mt.jsxs("div",{className:Dt("flex justify-between items-center text-sm",r),children:[Mt.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),Mt.jsx("span",{className:"text-foreground",children:t})]})}},fi=({variant:e="button",className:r="",children:n})=>{const[a,i]=o(!1),{user:s}=Uo(),{companies:l,alias:c}=Uo(),u=c?l?.find(e=>e.alias===c)||l?.[0]||null:l?.[0]||null,d=(()=>{if(!s?.email)return"";return`${`${import.meta.env.VITE_FEEDBACK_APP_URL}/`}?${new URLSearchParams({email:s.email,module:"OKR",alias:u?.alias||""}).toString()}`})();if(!s?.email||!u)return null;const f=t.forwardRef((t,n)=>"menuItem"===e?Mt.jsxs("div",{ref:n,className:"flex items-center cursor-pointer w-full px-2 py-1.5 text-sm hover:bg-accent rounded-sm",...t,children:[Mt.jsx(Le,{className:"mr-2 h-4 w-4"}),"Feedback"]}):Mt.jsxs(Ht,{ref:n,variant:"default",size:"sm",className:`bg-primary hover:bg-primary/90 ${r}`,...t,children:[Mt.jsx(Le,{className:"mr-2 h-4 w-4"}),"Feedback"]}));return f.displayName="TriggerButton",Mt.jsxs(er,{open:a,onOpenChange:i,children:[Mt.jsx(tr,{asChild:!0,children:Mt.jsx(f,{})}),Mt.jsxs(ar,{className:"max-w-4xl max-h-[90vh] w-full h-full p-0 overflow-hidden",children:[Mt.jsxs(ir,{className:"sr-only",children:[Mt.jsx(lr,{children:"Feedback"}),Mt.jsx(cr,{children:"Formulário de feedback para melhorias no sistema"})]}),Mt.jsx("div",{className:"w-full h-full",children:Mt.jsx("iframe",{src:d,width:"100%",height:"600px",className:"feedback-iframe",title:"Formulário de Feedback",loading:"lazy"})})]})]})},pi={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6","auto-fit":"grid-cols-[repeat(auto-fit,minmax(250px,1fr))]","auto-fill":"grid-cols-[repeat(auto-fill,minmax(250px,1fr))]"},hi={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function mi({children:e,cols:t="auto-fit",gap:r="md",className:n}){return Mt.jsx("div",{className:Dt("grid",pi[t],hi[r],n),children:e})}const yi=e.forwardRef(({className:e,containerClassName:t,...r},n)=>Mt.jsx(yt,{ref:n,containerClassName:Dt("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:Dt("disabled:cursor-not-allowed",e),...r}));yi.displayName="InputOTP";const gi=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,className:Dt("flex items-center",e),...t}));gi.displayName="InputOTPGroup";const vi=e.forwardRef(({index:t,className:r,...n},o)=>{const a=e.useContext(gt),{char:i,hasFakeCaret:s,isActive:l}=a.slots[t];return Mt.jsxs("div",{ref:o,className:Dt("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",r),...n,children:[i,s&&Mt.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:Mt.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});vi.displayName="InputOTPSlot";const bi=e.forwardRef(({...e},t)=>Mt.jsx("div",{ref:t,role:"separator",...e,children:Mt.jsx(Ie,{})}));function xi({items:e,maxItems:t=3,className:r}){return e.length>t&&(e[0],e.slice(-(t-1))),e.length,Mt.jsx(xa,{className:r})}function wi(){const e=et();return(()=>{const t=e.pathname.split("/").filter(Boolean),r=[{label:"Exemplos",href:"/"}];let n="";return t.forEach((e,o)=>{n+=`/${e}`;const a=o===t.length-1,i=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");r.push({label:i,href:a?void 0:n,isCurrentPage:a})}),r})()}bi.displayName="InputOTPSeparator";const Ni=({className:e,...t})=>Mt.jsx("nav",{role:"navigation","aria-label":"pagination",className:Dt("mx-auto flex w-full justify-center",e),...t});Ni.displayName="Pagination";const ji=e.forwardRef(({className:e,...t},r)=>Mt.jsx("ul",{ref:r,className:Dt("flex flex-row items-center gap-1",e),...t}));ji.displayName="PaginationContent";const _i=e.forwardRef(({className:e,...t},r)=>Mt.jsx("li",{ref:r,className:Dt("",e),...t}));_i.displayName="PaginationItem";const ki=({className:e,isActive:t,size:r="icon",...n})=>Mt.jsx("a",{"aria-current":t?"page":void 0,className:Dt($t({variant:t?"outline":"ghost",size:r}),e),...n});ki.displayName="PaginationLink";const Oi=({className:e,...t})=>Mt.jsxs(ki,{"aria-label":"Go to previous page",size:"default",className:Dt("gap-1 pl-2.5",e),...t,children:[Mt.jsx(fe,{className:"h-4 w-4"}),Mt.jsx("span",{children:"Previous"})]});Oi.displayName="PaginationPrevious";const Ei=({className:e,...t})=>Mt.jsxs(ki,{"aria-label":"Go to next page",size:"default",className:Dt("gap-1 pr-2.5",e),...t,children:[Mt.jsx("span",{children:"Next"}),Mt.jsx(A,{className:"h-4 w-4"})]});Ei.displayName="PaginationNext";const Si=({className:e,...t})=>Mt.jsxs("span",{"aria-hidden":!0,className:Dt("flex h-9 w-9 items-center justify-center",e),...t,children:[Mt.jsx(Re,{className:"h-4 w-4"}),Mt.jsx("span",{className:"sr-only",children:"More pages"})]});Si.displayName="PaginationEllipsis";const Ai=e.forwardRef(({className:e,value:t,...r},n)=>Mt.jsx(vt.Root,{ref:n,className:Dt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...r,children:Mt.jsx(vt.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ai.displayName=vt.Root.displayName;const Ti=e.forwardRef(({className:e,...t},r)=>Mt.jsx(bt.Root,{className:Dt("grid gap-2",e),...t,ref:r}));Ti.displayName=bt.Root.displayName;const Ci=e.forwardRef(({className:e,...t},r)=>Mt.jsx(bt.Item,{ref:r,className:Dt("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:Mt.jsx(bt.Indicator,{className:"flex items-center justify-center",children:Mt.jsx(T,{className:"h-2.5 w-2.5 fill-current text-current"})})}));var Pi,qi,Ri,Li,Ii,Mi,Di,Fi,Bi,zi,Ui,$i,Hi,Vi,Ki,Wi,Zi,Gi,Yi,Qi,Xi,Ji,es,ts,rs,ns,os,as,is,ss,ls,cs,us,ds,fs,ps,hs,ms,ys,gs,vs,bs,xs,ws,Ns,js,_s,ks,Os,Es,Ss,As,Ts,Cs,Ps,qs,Rs,Ls,Is,Ms,Ds,Fs,Bs,zs,Us,$s,Hs,Vs,Ks,Ws,Zs,Gs,Ys,Qs,Xs,Js,el,tl,rl,nl,ol,al,il,sl,ll,cl,ul,dl,fl,pl,hl,ml,yl,gl,vl,bl,xl,wl,Nl,jl,_l,kl,Ol,El,Sl,Al,Tl,Cl,Pl,ql,Rl,Ll,Il,Ml,Dl,Fl,Bl,zl,Ul,$l,Hl,Vl,Kl,Wl,Zl,Gl,Yl,Ql;function Xl(){if(Li)return Ri;return Li=1,Ri=function(e,t){return e===t||e!=e&&t!=t}}function Jl(){if(Mi)return Ii;Mi=1;var e=Xl();return Ii=function(t,r){for(var n=t.length;n--;)if(e(t[n][0],r))return n;return-1}}function ec(){if(Wi)return Ki;Wi=1;var e=qi?Pi:(qi=1,Pi=function(){this.__data__=[],this.size=0}),t=function(){if(Fi)return Di;Fi=1;var e=Jl(),t=Array.prototype.splice;return Di=function(r){var n=this.__data__,o=e(n,r);return!(o<0||(o==n.length-1?n.pop():t.call(n,o,1),--this.size,0))}}(),r=function(){if(zi)return Bi;zi=1;var e=Jl();return Bi=function(t){var r=this.__data__,n=e(r,t);return n<0?void 0:r[n][1]}}(),n=function(){if($i)return Ui;$i=1;var e=Jl();return Ui=function(t){return e(this.__data__,t)>-1}}(),o=function(){if(Vi)return Hi;Vi=1;var e=Jl();return Hi=function(t,r){var n=this.__data__,o=e(n,t);return o<0?(++this.size,n.push([t,r])):n[o][1]=r,this}}();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Ki=a}function tc(){if(ns)return rs;ns=1;var e="object"==typeof St&&St&&St.Object===Object&&St;return rs=e}function rc(){if(as)return os;as=1;var e=tc(),t="object"==typeof self&&self&&self.Object===Object&&self,r=e||t||Function("return this")();return os=r}function nc(){if(ss)return is;ss=1;var e=rc().Symbol;return is=e}function oc(){if(ps)return fs;ps=1;var e=nc(),t=function(){if(cs)return ls;cs=1;var e=nc(),t=Object.prototype,r=t.hasOwnProperty,n=t.toString,o=e?e.toStringTag:void 0;return ls=function(e){var t=r.call(e,o),a=e[o];try{e[o]=void 0;var i=!0}catch(e){}var s=n.call(e);return i&&(t?e[o]=a:delete e[o]),s}}(),r=function(){if(ds)return us;ds=1;var e=Object.prototype.toString;return us=function(t){return e.call(t)}}(),n=e?e.toStringTag:void 0;return fs=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":n&&n in Object(e)?t(e):r(e)}}function ac(){if(ms)return hs;return ms=1,hs=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function ic(){if(gs)return ys;gs=1;var e=oc(),t=ac();return ys=function(r){if(!t(r))return!1;var n=e(r);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n}}function sc(){if(ws)return xs;ws=1;var e,t=function(){if(bs)return vs;bs=1;var e=rc()["__core-js_shared__"];return vs=e}(),r=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return xs=function(e){return!!r&&r in e}}function lc(){if(js)return Ns;js=1;var e=Function.prototype.toString;return Ns=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}function cc(){if(As)return Ss;As=1;var e=function(){if(ks)return _s;ks=1;var e=ic(),t=sc(),r=ac(),n=lc(),o=/^\[object .+?Constructor\]$/,a=Function.prototype,i=Object.prototype,s=a.toString,l=i.hasOwnProperty,c=RegExp("^"+s.call(l).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return _s=function(a){return!(!r(a)||t(a))&&(e(a)?c:o).test(n(a))}}(),t=Es?Os:(Es=1,Os=function(e,t){return null==e?void 0:e[t]});return Ss=function(r,n){var o=t(r,n);return e(o)?o:void 0}}function uc(){if(Cs)return Ts;Cs=1;var e=cc()(rc(),"Map");return Ts=e}function dc(){if(qs)return Ps;qs=1;var e=cc()(Object,"create");return Ps=e}function fc(){if(Vs)return Hs;Vs=1;var e=function(){if(Ls)return Rs;Ls=1;var e=dc();return Rs=function(){this.__data__=e?e(null):{},this.size=0}}(),t=Ms?Is:(Ms=1,Is=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}),r=function(){if(Fs)return Ds;Fs=1;var e=dc(),t=Object.prototype.hasOwnProperty;return Ds=function(r){var n=this.__data__;if(e){var o=n[r];return"__lodash_hash_undefined__"===o?void 0:o}return t.call(n,r)?n[r]:void 0}}(),n=function(){if(zs)return Bs;zs=1;var e=dc(),t=Object.prototype.hasOwnProperty;return Bs=function(r){var n=this.__data__;return e?void 0!==n[r]:t.call(n,r)}}(),o=function(){if($s)return Us;$s=1;var e=dc();return Us=function(t,r){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=e&&void 0===r?"__lodash_hash_undefined__":r,this}}();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,Hs=a}function pc(){if(Qs)return Ys;Qs=1;var e=Gs?Zs:(Gs=1,Zs=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return Ys=function(t,r){var n=t.__data__;return e(r)?n["string"==typeof r?"string":"hash"]:n.map}}function hc(){if(sl)return il;sl=1;var e=function(){if(Ws)return Ks;Ws=1;var e=fc(),t=ec(),r=uc();return Ks=function(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}}(),t=function(){if(Js)return Xs;Js=1;var e=pc();return Xs=function(t){var r=e(this,t).delete(t);return this.size-=r?1:0,r}}(),r=function(){if(tl)return el;tl=1;var e=pc();return el=function(t){return e(this,t).get(t)}}(),n=function(){if(nl)return rl;nl=1;var e=pc();return rl=function(t){return e(this,t).has(t)}}(),o=function(){if(al)return ol;al=1;var e=pc();return ol=function(t,r){var n=e(this,t),o=n.size;return n.set(t,r),this.size+=n.size==o?0:1,this}}();function a(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=o,il=a}function mc(){if(dl)return ul;dl=1;var e=ec(),t=function(){if(Gi)return Zi;Gi=1;var e=ec();return Zi=function(){this.__data__=new e,this.size=0}}(),r=Qi?Yi:(Qi=1,Yi=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r}),n=Ji?Xi:(Ji=1,Xi=function(e){return this.__data__.get(e)}),o=ts?es:(ts=1,es=function(e){return this.__data__.has(e)}),a=function(){if(cl)return ll;cl=1;var e=ec(),t=uc(),r=hc();return ll=function(n,o){var a=this.__data__;if(a instanceof e){var i=a.__data__;if(!t||i.length<199)return i.push([n,o]),this.size=++a.size,this;a=this.__data__=new r(i)}return a.set(n,o),this.size=a.size,this}}();function i(t){var r=this.__data__=new e(t);this.size=r.size}return i.prototype.clear=t,i.prototype.delete=r,i.prototype.get=n,i.prototype.has=o,i.prototype.set=a,ul=i}function yc(){if(gl)return yl;gl=1;var e=hc(),t=pl?fl:(pl=1,fl=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),r=ml?hl:(ml=1,hl=function(e){return this.__data__.has(e)});function n(t){var r=-1,n=null==t?0:t.length;for(this.__data__=new e;++r<n;)this.add(t[r])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,yl=n}function gc(){if(jl)return Nl;jl=1;var e=yc(),t=bl?vl:(bl=1,vl=function(e,t){for(var r=-1,n=null==e?0:e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}),r=wl?xl:(wl=1,xl=function(e,t){return e.has(t)});return Nl=function(n,o,a,i,s,l){var c=1&a,u=n.length,d=o.length;if(u!=d&&!(c&&d>u))return!1;var f=l.get(n),p=l.get(o);if(f&&p)return f==o&&p==n;var h=-1,m=!0,y=2&a?new e:void 0;for(l.set(n,o),l.set(o,n);++h<u;){var g=n[h],v=o[h];if(i)var b=c?i(v,g,h,o,n,l):i(g,v,h,n,o,l);if(void 0!==b){if(b)continue;m=!1;break}if(y){if(!t(o,function(e,t){if(!r(y,t)&&(g===e||s(g,e,a,i,l)))return y.push(t)})){m=!1;break}}else if(g!==v&&!s(g,v,a,i,l)){m=!1;break}}return l.delete(n),l.delete(o),m}}function vc(){if(Cl)return Tl;Cl=1;var e=nc(),t=function(){if(kl)return _l;kl=1;var e=rc().Uint8Array;return _l=e}(),r=Xl(),n=gc(),o=El?Ol:(El=1,Ol=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e,n){r[++t]=[n,e]}),r}),a=Al?Sl:(Al=1,Sl=function(e){var t=-1,r=Array(e.size);return e.forEach(function(e){r[++t]=e}),r}),i=e?e.prototype:void 0,s=i?i.valueOf:void 0;return Tl=function(e,i,l,c,u,d,f){switch(l){case"[object DataView]":if(e.byteLength!=i.byteLength||e.byteOffset!=i.byteOffset)return!1;e=e.buffer,i=i.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=i.byteLength||!d(new t(e),new t(i)));case"[object Boolean]":case"[object Date]":case"[object Number]":return r(+e,+i);case"[object Error]":return e.name==i.name&&e.message==i.message;case"[object RegExp]":case"[object String]":return e==i+"";case"[object Map]":var p=o;case"[object Set]":var h=1&c;if(p||(p=a),e.size!=i.size&&!h)return!1;var m=f.get(e);if(m)return m==i;c|=2,f.set(e,i);var y=n(p(e),p(i),c,u,d,f);return f.delete(e),y;case"[object Symbol]":if(s)return s.call(e)==s.call(i)}return!1}}function bc(){if(Ll)return Rl;Ll=1;var e=Array.isArray;return Rl=e}function xc(){if(Ml)return Il;Ml=1;var e=ql?Pl:(ql=1,Pl=function(e,t){for(var r=-1,n=t.length,o=e.length;++r<n;)e[o+r]=t[r];return e}),t=bc();return Il=function(r,n,o){var a=n(r);return t(r)?a:e(a,o(r))}}function wc(){if($l)return Ul;$l=1;var e=Fl?Dl:(Fl=1,Dl=function(e,t){for(var r=-1,n=null==e?0:e.length,o=0,a=[];++r<n;){var i=e[r];t(i,r,e)&&(a[o++]=i)}return a}),t=zl?Bl:(zl=1,Bl=function(){return[]}),r=Object.prototype.propertyIsEnumerable,n=Object.getOwnPropertySymbols;return Ul=n?function(t){return null==t?[]:(t=Object(t),e(n(t),function(e){return r.call(t,e)}))}:t}function Nc(){if(Wl)return Kl;return Wl=1,Kl=function(e){return null!=e&&"object"==typeof e}}function jc(){if(Ql)return Yl;Ql=1;var e=function(){if(Gl)return Zl;Gl=1;var e=oc(),t=Nc();return Zl=function(r){return t(r)&&"[object Arguments]"==e(r)}}(),t=Nc(),r=Object.prototype,n=r.hasOwnProperty,o=r.propertyIsEnumerable,a=e(function(){return arguments}())?e:function(e){return t(e)&&n.call(e,"callee")&&!o.call(e,"callee")};return Yl=a}Ci.displayName=bt.Item.displayName;var _c,kc,Oc,Ec,Sc,Ac,Tc,Cc,Pc,qc,Rc,Lc={exports:{}};function Ic(){return Oc||(Oc=1,function(e,t){var r=rc(),n=kc?_c:(kc=1,_c=function(){return!1}),o=t&&!t.nodeType&&t,a=o&&e&&!e.nodeType&&e,i=a&&a.exports===o?r.Buffer:void 0,s=(i?i.isBuffer:void 0)||n;e.exports=s}(Lc,Lc.exports)),Lc.exports}function Mc(){if(Tc)return Ac;Tc=1;return Ac=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}var Dc,Fc,Bc,zc,Uc,$c,Hc,Vc,Kc,Wc,Zc,Gc,Yc,Qc,Xc,Jc,eu,tu,ru,nu,ou,au,iu,su,lu,cu,uu,du,fu,pu,hu,mu,yu,gu,vu,bu,xu,wu={exports:{}};function Nu(){if(Bc)return Fc;Bc=1;var e=function(){if(Pc)return Cc;Pc=1;var e=oc(),t=Mc(),r=Nc(),n={};return n["[object Float32Array]"]=n["[object Float64Array]"]=n["[object Int8Array]"]=n["[object Int16Array]"]=n["[object Int32Array]"]=n["[object Uint8Array]"]=n["[object Uint8ClampedArray]"]=n["[object Uint16Array]"]=n["[object Uint32Array]"]=!0,n["[object Arguments]"]=n["[object Array]"]=n["[object ArrayBuffer]"]=n["[object Boolean]"]=n["[object DataView]"]=n["[object Date]"]=n["[object Error]"]=n["[object Function]"]=n["[object Map]"]=n["[object Number]"]=n["[object Object]"]=n["[object RegExp]"]=n["[object Set]"]=n["[object String]"]=n["[object WeakMap]"]=!1,Cc=function(o){return r(o)&&t(o.length)&&!!n[e(o)]}}(),t=Rc?qc:(Rc=1,qc=function(e){return function(t){return e(t)}}),r=function(){return Dc||(Dc=1,e=wu,t=wu.exports,r=tc(),n=t&&!t.nodeType&&t,o=n&&e&&!e.nodeType&&e,a=o&&o.exports===n&&r.process,i=function(){try{return o&&o.require&&o.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}(),e.exports=i),wu.exports;var e,t,r,n,o,a,i}(),n=r&&r.isTypedArray,o=n?t(n):e;return Fc=o}function ju(){if(Uc)return zc;Uc=1;var e=Vl?Hl:(Vl=1,Hl=function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}),t=jc(),r=bc(),n=Ic(),o=function(){if(Sc)return Ec;Sc=1;var e=/^(?:0|[1-9]\d*)$/;return Ec=function(t,r){var n=typeof t;return!!(r=null==r?9007199254740991:r)&&("number"==n||"symbol"!=n&&e.test(t))&&t>-1&&t%1==0&&t<r}}(),a=Nu(),i=Object.prototype.hasOwnProperty;return zc=function(s,l){var c=r(s),u=!c&&t(s),d=!c&&!u&&n(s),f=!c&&!u&&!d&&a(s),p=c||u||d||f,h=p?e(s.length,String):[],m=h.length;for(var y in s)!l&&!i.call(s,y)||p&&("length"==y||d&&("offset"==y||"parent"==y)||f&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||o(y,m))||h.push(y);return h}}function _u(){if(Zc)return Wc;Zc=1;var e=(Kc?Vc:(Kc=1,Vc=function(e,t){return function(r){return e(t(r))}}))(Object.keys,Object);return Wc=e}function ku(){if(Yc)return Gc;Yc=1;var e=function(){if(Hc)return $c;Hc=1;var e=Object.prototype;return $c=function(t){var r=t&&t.constructor;return t===("function"==typeof r&&r.prototype||e)}}(),t=_u(),r=Object.prototype.hasOwnProperty;return Gc=function(n){if(!e(n))return t(n);var o=[];for(var a in Object(n))r.call(n,a)&&"constructor"!=a&&o.push(a);return o}}function Ou(){if(eu)return Jc;eu=1;var e=ju(),t=ku(),r=function(){if(Xc)return Qc;Xc=1;var e=ic(),t=Mc();return Qc=function(r){return null!=r&&t(r.length)&&!e(r)}}();return Jc=function(n){return r(n)?e(n):t(n)}}function Eu(){if(ou)return nu;ou=1;var e=function(){if(ru)return tu;ru=1;var e=xc(),t=wc(),r=Ou();return tu=function(n){return e(n,r,t)}}(),t=Object.prototype.hasOwnProperty;return nu=function(r,n,o,a,i,s){var l=1&o,c=e(r),u=c.length;if(u!=e(n).length&&!l)return!1;for(var d=u;d--;){var f=c[d];if(!(l?f in n:t.call(n,f)))return!1}var p=s.get(r),h=s.get(n);if(p&&h)return p==n&&h==r;var m=!0;s.set(r,n),s.set(n,r);for(var y=l;++d<u;){var g=r[f=c[d]],v=n[f];if(a)var b=l?a(v,g,f,n,r,s):a(g,v,f,r,n,s);if(!(void 0===b?g===v||i(g,v,o,a,s):b)){m=!1;break}y||(y="constructor"==f)}if(m&&!y){var x=r.constructor,w=n.constructor;x==w||!("constructor"in r)||!("constructor"in n)||"function"==typeof x&&x instanceof x&&"function"==typeof w&&w instanceof w||(m=!1)}return s.delete(r),s.delete(n),m}}function Su(){if(hu)return pu;hu=1;var e=function(){if(iu)return au;iu=1;var e=cc()(rc(),"DataView");return au=e}(),t=uc(),r=function(){if(lu)return su;lu=1;var e=cc()(rc(),"Promise");return su=e}(),n=function(){if(uu)return cu;uu=1;var e=cc()(rc(),"Set");return cu=e}(),o=function(){if(fu)return du;fu=1;var e=cc()(rc(),"WeakMap");return du=e}(),a=oc(),i=lc(),s="[object Map]",l="[object Promise]",c="[object Set]",u="[object WeakMap]",d="[object DataView]",f=i(e),p=i(t),h=i(r),m=i(n),y=i(o),g=a;return(e&&g(new e(new ArrayBuffer(1)))!=d||t&&g(new t)!=s||r&&g(r.resolve())!=l||n&&g(new n)!=c||o&&g(new o)!=u)&&(g=function(e){var t=a(e),r="[object Object]"==t?e.constructor:void 0,n=r?i(r):"";if(n)switch(n){case f:return d;case p:return s;case h:return l;case m:return c;case y:return u}return t}),pu=g}function Au(){if(vu)return gu;vu=1;var e=function(){if(yu)return mu;yu=1;var e=mc(),t=gc(),r=vc(),n=Eu(),o=Su(),a=bc(),i=Ic(),s=Nu(),l="[object Arguments]",c="[object Array]",u="[object Object]",d=Object.prototype.hasOwnProperty;return mu=function(f,p,h,m,y,g){var v=a(f),b=a(p),x=v?c:o(f),w=b?c:o(p),N=(x=x==l?u:x)==u,j=(w=w==l?u:w)==u,_=x==w;if(_&&i(f)){if(!i(p))return!1;v=!0,N=!1}if(_&&!N)return g||(g=new e),v||s(f)?t(f,p,h,m,y,g):r(f,p,x,h,m,y,g);if(!(1&h)){var k=N&&d.call(f,"__wrapped__"),O=j&&d.call(p,"__wrapped__");if(k||O){var E=k?f.value():f,S=O?p.value():p;return g||(g=new e),y(E,S,h,m,g)}}return!!_&&(g||(g=new e),n(f,p,h,m,y,g))}}(),t=Nc();return gu=function r(n,o,a,i,s){return n===o||(null==n||null==o||!t(n)&&!t(o)?n!=n&&o!=o:e(n,o,a,i,r,s))},gu}function Tu(){if(xu)return bu;xu=1;var e=Au();return bu=function(t,r){return e(t,r)}}var Cu,Pu,qu,Ru={exports:{}};
|
|
11
11
|
/*!
|
|
12
12
|
* Quill Editor v1.3.7
|
|
13
13
|
* https://quilljs.com/
|
|
14
14
|
* Copyright (c) 2014, Jason Chen
|
|
15
15
|
* Copyright (c) 2013, salesforce.com
|
|
16
|
-
*/function Cu(){return Eu?Tu.exports:(Eu=1,"undefined"!=typeof self&&self,e=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=109)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(17),o=r(18),a=r(19),i=r(45),s=r(46),l=r(47),c=r(48),u=r(49),d=r(12),f=r(32),p=r(33),h=r(31),m=r(1),y={Scope:m.Scope,create:m.create,find:m.find,query:m.query,register:m.register,Container:n.default,Format:o.default,Leaf:a.default,Embed:c.default,Scroll:i.default,Block:l.default,Inline:s.default,Text:u.default,Attributor:{Attribute:d.default,Class:f.default,Style:p.default,Store:h.default}};t.default=y},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var r=this;return t="[Parchment] "+t,(r=e.call(this,t)||this).message=t,r.name=r.constructor.name,r}return o(t,e),t}(Error);t.ParchmentError=a;var i,s={},l={},c={},u={};function d(e,t){var r;if(void 0===t&&(t=i.ANY),"string"==typeof e)r=u[e]||s[e];else if(e instanceof Text||e.nodeType===Node.TEXT_NODE)r=u.text;else if("number"==typeof e)e&i.LEVEL&i.BLOCK?r=u.block:e&i.LEVEL&i.INLINE&&(r=u.inline);else if(e instanceof HTMLElement){var n=(e.getAttribute("class")||"").split(/\s+/);for(var o in n)if(r=l[n[o]])break;r=r||c[e.tagName]}return null==r?null:t&i.LEVEL&r.scope&&t&i.TYPE&r.scope?r:null}t.DATA_KEY="__blot",function(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"}(i=t.Scope||(t.Scope={})),t.create=function(e,t){var r=d(e);if(null==r)throw new a("Unable to create "+e+" blot");var n=r,o=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:n.create(t);return new n(o,t)},t.find=function e(r,n){return void 0===n&&(n=!1),null==r?null:null!=r[t.DATA_KEY]?r[t.DATA_KEY].blot:n?e(r.parentNode,n):null},t.query=d,t.register=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length>1)return t.map(function(t){return e(t)});var n=t[0];if("string"!=typeof n.blotName&&"string"!=typeof n.attrName)throw new a("Invalid definition");if("abstract"===n.blotName)throw new a("Cannot register abstract class");return u[n.blotName||n.attrName]=n,"string"==typeof n.keyName?s[n.keyName]=n:(null!=n.className&&(l[n.className]=n),null!=n.tagName&&(Array.isArray(n.tagName)?n.tagName=n.tagName.map(function(e){return e.toUpperCase()}):n.tagName=n.tagName.toUpperCase(),(Array.isArray(n.tagName)?n.tagName:[n.tagName]).forEach(function(e){null!=c[e]&&null!=n.className||(c[e]=n)}))),n}},function(e,t,r){var n=r(51),o=r(11),a=r(3),i=r(20),s=String.fromCharCode(0),l=function(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]};l.prototype.insert=function(e,t){var r={};return 0===e.length?this:(r.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(r.attributes=t),this.push(r))},l.prototype.delete=function(e){return e<=0?this:this.push({delete:e})},l.prototype.retain=function(e,t){if(e<=0)return this;var r={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(r.attributes=t),this.push(r)},l.prototype.push=function(e){var t=this.ops.length,r=this.ops[t-1];if(e=a(!0,{},e),"object"==typeof r){if("number"==typeof e.delete&&"number"==typeof r.delete)return this.ops[t-1]={delete:r.delete+e.delete},this;if("number"==typeof r.delete&&null!=e.insert&&(t-=1,"object"!=typeof(r=this.ops[t-1])))return this.ops.unshift(e),this;if(o(e.attributes,r.attributes)){if("string"==typeof e.insert&&"string"==typeof r.insert)return this.ops[t-1]={insert:r.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof r.retain)return this.ops[t-1]={retain:r.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},l.prototype.chop=function(){var e=this.ops[this.ops.length-1];return e&&e.retain&&!e.attributes&&this.ops.pop(),this},l.prototype.filter=function(e){return this.ops.filter(e)},l.prototype.forEach=function(e){this.ops.forEach(e)},l.prototype.map=function(e){return this.ops.map(e)},l.prototype.partition=function(e){var t=[],r=[];return this.forEach(function(n){(e(n)?t:r).push(n)}),[t,r]},l.prototype.reduce=function(e,t){return this.ops.reduce(e,t)},l.prototype.changeLength=function(){return this.reduce(function(e,t){return t.insert?e+i.length(t):t.delete?e-t.delete:e},0)},l.prototype.length=function(){return this.reduce(function(e,t){return e+i.length(t)},0)},l.prototype.slice=function(e,t){e=e||0,"number"!=typeof t&&(t=1/0);for(var r=[],n=i.iterator(this.ops),o=0;o<t&&n.hasNext();){var a;o<e?a=n.next(e-o):(a=n.next(t-o),r.push(a)),o+=i.length(a)}return new l(r)},l.prototype.compose=function(e){var t=i.iterator(this.ops),r=i.iterator(e.ops),n=[],a=r.peek();if(null!=a&&"number"==typeof a.retain&&null==a.attributes){for(var s=a.retain;"insert"===t.peekType()&&t.peekLength()<=s;)s-=t.peekLength(),n.push(t.next());a.retain-s>0&&r.next(a.retain-s)}for(var c=new l(n);t.hasNext()||r.hasNext();)if("insert"===r.peekType())c.push(r.next());else if("delete"===t.peekType())c.push(t.next());else{var u=Math.min(t.peekLength(),r.peekLength()),d=t.next(u),f=r.next(u);if("number"==typeof f.retain){var p={};"number"==typeof d.retain?p.retain=u:p.insert=d.insert;var h=i.attributes.compose(d.attributes,f.attributes,"number"==typeof d.retain);if(h&&(p.attributes=h),c.push(p),!r.hasNext()&&o(c.ops[c.ops.length-1],p)){var m=new l(t.rest());return c.concat(m).chop()}}else"number"==typeof f.delete&&"number"==typeof d.retain&&c.push(f)}return c.chop()},l.prototype.concat=function(e){var t=new l(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t},l.prototype.diff=function(e,t){if(this.ops===e.ops)return new l;var r=[this,e].map(function(t){return t.map(function(r){if(null!=r.insert)return"string"==typeof r.insert?r.insert:s;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")}),a=new l,c=n(r[0],r[1],t),u=i.iterator(this.ops),d=i.iterator(e.ops);return c.forEach(function(e){for(var t=e[1].length;t>0;){var r=0;switch(e[0]){case n.INSERT:r=Math.min(d.peekLength(),t),a.push(d.next(r));break;case n.DELETE:r=Math.min(t,u.peekLength()),u.next(r),a.delete(r);break;case n.EQUAL:r=Math.min(u.peekLength(),d.peekLength(),t);var s=u.next(r),l=d.next(r);o(s.insert,l.insert)?a.retain(r,i.attributes.diff(s.attributes,l.attributes)):a.push(l).delete(r)}t-=r}}),a.chop()},l.prototype.eachLine=function(e,t){t=t||"\n";for(var r=i.iterator(this.ops),n=new l,o=0;r.hasNext();){if("insert"!==r.peekType())return;var a=r.peek(),s=i.length(a)-r.peekLength(),c="string"==typeof a.insert?a.insert.indexOf(t,s)-s:-1;if(c<0)n.push(r.next());else if(c>0)n.push(r.next(c));else{if(!1===e(n,r.next(1).attributes||{},o))return;o+=1,n=new l}}n.length()>0&&e(n,{},o)},l.prototype.transform=function(e,t){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);for(var r=i.iterator(this.ops),n=i.iterator(e.ops),o=new l;r.hasNext()||n.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===n.peekType())if("insert"===n.peekType())o.push(n.next());else{var a=Math.min(r.peekLength(),n.peekLength()),s=r.next(a),c=n.next(a);if(s.delete)continue;c.delete?o.push(c):o.retain(a,i.attributes.transform(s.attributes,c.attributes,t))}else o.retain(i.length(r.next()));return o.chop()},l.prototype.transformPosition=function(e,t){t=!!t;for(var r=i.iterator(this.ops),n=0;r.hasNext()&&n<=e;){var o=r.peekLength(),a=r.peekType();r.next(),"delete"!==a?("insert"===a&&(n<e||!t)&&(e+=o),n+=o):e-=Math.min(o,e-n)}return e},e.exports=l},function(e,t){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},s=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var t,o=r.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!a)return!1;for(t in e);return void 0===t||r.call(e,t)},l=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;if(a)return a(e,t).value}return e[t]};e.exports=function e(){var t,r,n,o,a,u,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(null!=(t=arguments[f]))for(r in t)n=c(d,r),d!==(o=c(t,r))&&(h&&o&&(s(o)||(a=i(o)))?(a?(a=!1,u=n&&i(n)?n:[]):u=n&&s(n)?n:{},l(d,{name:r,newValue:e(h,u,o)})):void 0!==o&&l(d,{name:r,newValue:o}));return d}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BlockEmbed=t.bubbleFormats=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=d(r(3)),i=d(r(2)),s=d(r(0)),l=d(r(16)),c=d(r(6)),u=d(r(7));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),n(t,[{key:"attach",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"attach",this).call(this),this.attributes=new s.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return(new i.default).insert(this.value(),(0,a.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function(e,t){var r=s.default.query(e,s.default.Scope.BLOCK_ATTRIBUTE);null!=r&&this.attributes.attribute(r,t)}},{key:"formatAt",value:function(e,t,r,n){this.format(r,n)}},{key:"insertAt",value:function(e,r,n){if("string"==typeof r&&r.endsWith("\n")){var a=s.default.create(y.blotName);this.parent.insertBefore(a,0===e?this:this.next),a.insertAt(0,r.slice(0,-1))}else o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,r,n)}}]),t}(s.default.Embed);m.scope=s.default.Scope.BLOCK_BLOT;var y=function(e){function t(e){f(this,t);var r=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.cache={},r}return h(t,e),n(t,[{key:"delta",value:function(){return null==this.cache.delta&&(this.cache.delta=this.descendants(s.default.Leaf).reduce(function(e,t){return 0===t.length()?e:e.insert(t.value(),g(t))},new i.default).insert("\n",g(this))),this.cache.delta}},{key:"deleteAt",value:function(e,r){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,r),this.cache={}}},{key:"formatAt",value:function(e,r,n,a){r<=0||(s.default.query(n,s.default.Scope.BLOCK)?e+r===this.length()&&this.format(n,a):o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,Math.min(r,this.length()-e-1),n,a),this.cache={})}},{key:"insertAt",value:function(e,r,n){if(null!=n)return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,r,n);if(0!==r.length){var a=r.split("\n"),i=a.shift();i.length>0&&(e<this.length()-1||null==this.children.tail?o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});var s=this;a.reduce(function(e,t){return(s=s.split(e,!0)).insertAt(0,t),t.length},e+i.length)}}},{key:"insertBefore",value:function(e,r){var n=this.children.head;o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,r),n instanceof l.default&&n.remove(),this.cache={}}},{key:"length",value:function(){return null==this.cache.length&&(this.cache.length=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"length",this).call(this)+1),this.cache.length}},{key:"moveChildren",value:function(e,r){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"moveChildren",this).call(this,e,r),this.cache={}}},{key:"optimize",value:function(e){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.cache={}}},{key:"path",value:function(e){return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e,!0)}},{key:"removeChild",value:function(e){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"removeChild",this).call(this,e),this.cache={}}},{key:"split",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(r&&(0===e||e>=this.length()-1)){var n=this.clone();return 0===e?(this.parent.insertBefore(n,this),this):(this.parent.insertBefore(n,this.next),n)}var a=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"split",this).call(this,e,r);return this.cache={},a}}]),t}(s.default.Block);function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==e?t:("function"==typeof e.formats&&(t=(0,a.default)(t,e.formats())),null==e.parent||"scroll"==e.parent.blotName||e.parent.statics.scope!==e.statics.scope?t:g(e.parent,t))}y.blotName="block",y.tagName="P",y.defaultChild="break",y.allowedChildren=[c.default,s.default.Embed,u.default],t.bubbleFormats=g,t.BlockEmbed=m,t.default=y},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.overload=t.expandConfig=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();r(50);var i=y(r(2)),s=y(r(14)),l=y(r(8)),c=y(r(9)),u=y(r(0)),d=r(15),f=y(d),p=y(r(3)),h=y(r(10)),m=y(r(34));function y(e){return e&&e.__esModule?e:{default:e}}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=(0,h.default)("quill"),b=function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=x(t,n),this.container=this.options.container,null==this.container)return v.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);var o=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new l.default,this.scroll=u.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new s.default(this.scroll),this.selection=new f.default(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.theme.init(),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e){e===l.default.events.TEXT_CHANGE&&r.root.classList.toggle("ql-blank",r.editor.isBlank())}),this.emitter.on(l.default.events.SCROLL_UPDATE,function(e,t){var n=r.selection.lastRange,o=n&&0===n.length?n.index:void 0;w.call(r,function(){return r.editor.update(null,t,o)},e)});var a=this.clipboard.convert("<div class='ql-editor' style=\"white-space: normal;\">"+o+"<p><br></p></div>");this.setContents(a),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return a(e,null,[{key:"debug",value:function(e){!0===e&&(e="log"),h.default.level(e)}},{key:"find",value:function(e){return e.__quill||u.default.find(e)}},{key:"import",value:function(e){return null==this.imports[e]&&v.error("Cannot import "+e+". Are you sure it was registered?"),this.imports[e]}},{key:"register",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof e){var o=e.attrName||e.blotName;"string"==typeof o?this.register("formats/"+o,e,t):Object.keys(e).forEach(function(n){r.register(n,e[n],t)})}else null==this.imports[e]||n||v.warn("Overwriting "+e+" with",t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&"abstract"!==t.blotName?u.default.register(t):e.startsWith("modules")&&"function"==typeof t.register&&t.register()}}]),a(e,[{key:"addContainer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){var r=e;(e=document.createElement("div")).classList.add(r)}return this.container.insertBefore(e,t),e}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(e,t,r){var n=this,a=N(e,t,r),i=o(a,4);return e=i[0],t=i[1],r=i[3],w.call(this,function(){return n.editor.deleteText(e,t)},r,e,-1*t)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}},{key:"focus",value:function(){var e=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=e,this.scrollIntoView()}},{key:"format",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;return w.call(this,function(){var n=r.getSelection(!0),o=new i.default;if(null==n)return o;if(u.default.query(e,u.default.Scope.BLOCK))o=r.editor.formatLine(n.index,n.length,g({},e,t));else{if(0===n.length)return r.selection.format(e,t),o;o=r.editor.formatText(n.index,n.length,g({},e,t))}return r.setSelection(n,l.default.sources.SILENT),o},n)}},{key:"formatLine",value:function(e,t,r,n,a){var i,s=this,l=N(e,t,r,n,a),c=o(l,4);return e=c[0],t=c[1],i=c[2],a=c[3],w.call(this,function(){return s.editor.formatLine(e,t,i)},a,e,0)}},{key:"formatText",value:function(e,t,r,n,a){var i,s=this,l=N(e,t,r,n,a),c=o(l,4);return e=c[0],t=c[1],i=c[2],a=c[3],w.call(this,function(){return s.editor.formatText(e,t,i)},a,e,0)}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=void 0;r="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length);var n=this.container.getBoundingClientRect();return{bottom:r.bottom-n.top,height:r.height,left:r.left-n.left,right:r.right-n.left,top:r.top-n.top,width:r.width}}},{key:"getContents",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,r=N(e,t),n=o(r,2);return e=n[0],t=n[1],this.editor.getContents(e,t)}},{key:"getFormat",value:function(){var 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)}},{key:"getIndex",value:function(e){return e.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(e){return this.scroll.leaf(e)}},{key:"getLine",value:function(e){return this.scroll.line(e)}},{key:"getLines",value:function(){var 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)}},{key:"getModule",value:function(e){return this.theme.modules[e]}},{key:"getSelection",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,r=N(e,t),n=o(r,2);return e=n[0],t=n[1],this.editor.getText(e,t)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(t,r,n){var o=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return w.call(this,function(){return o.editor.insertEmbed(t,r,n)},a,t)}},{key:"insertText",value:function(e,t,r,n,a){var i,s=this,l=N(e,0,r,n,a),c=o(l,4);return e=c[0],i=c[2],a=c[3],w.call(this,function(){return s.editor.insertText(e,t,i)},a,e,t.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(e,t,r){this.clipboard.dangerouslyPasteHTML(e,t,r)}},{key:"removeFormat",value:function(e,t,r){var n=this,a=N(e,t,r),i=o(a,4);return e=i[0],t=i[1],r=i[3],w.call(this,function(){return n.editor.removeFormat(e,t)},r,e)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){e=new i.default(e);var r=t.getLength(),n=t.editor.deleteText(0,r),o=t.editor.applyDelta(e),a=o.ops[o.ops.length-1];return null!=a&&"string"==typeof a.insert&&"\n"===a.insert[a.insert.length-1]&&(t.editor.deleteText(t.getLength()-1,1),o.delete(1)),n.compose(o)},r)}},{key:"setSelection",value:function(t,r,n){if(null==t)this.selection.setRange(null,r||e.sources.API);else{var a=N(t,r,n),i=o(a,4);t=i[0],r=i[1],n=i[3],this.selection.setRange(new d.Range(t,r),n),n!==l.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API,r=(new i.default).insert(e);return this.setContents(r,t)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.scroll.update(e);return this.selection.update(e),t}},{key:"updateContents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){return e=new i.default(e),t.editor.applyDelta(e,r)},r,!0)}}]),e}();function x(e,t){if((t=(0,p.default)(!0,{container:e,modules:{clipboard:!0,keyboard:!0,history:!0}},t)).theme&&t.theme!==b.DEFAULTS.theme){if(t.theme=b.import("themes/"+t.theme),null==t.theme)throw new Error("Invalid theme "+t.theme+". Did you register it?")}else t.theme=m.default;var r=(0,p.default)(!0,{},t.theme.DEFAULTS);[r,t].forEach(function(e){e.modules=e.modules||{},Object.keys(e.modules).forEach(function(t){!0===e.modules[t]&&(e.modules[t]={})})});var n=Object.keys(r.modules).concat(Object.keys(t.modules)).reduce(function(e,t){var r=b.import("modules/"+t);return null==r?v.error("Cannot load "+t+" module. Are you sure you registered it?"):e[t]=r.DEFAULTS||{},e},{});return null!=t.modules&&t.modules.toolbar&&t.modules.toolbar.constructor!==Object&&(t.modules.toolbar={container:t.modules.toolbar}),t=(0,p.default)(!0,{},b.DEFAULTS,{modules:n},r,t),["bounds","container","scrollingContainer"].forEach(function(e){"string"==typeof t[e]&&(t[e]=document.querySelector(t[e]))}),t.modules=Object.keys(t.modules).reduce(function(e,r){return t.modules[r]&&(e[r]=t.modules[r]),e},{}),t}function w(e,t,r,n){if(this.options.strict&&!this.isEnabled()&&t===l.default.sources.USER)return new i.default;var o=null==r?null:this.getSelection(),a=this.editor.delta,s=e();if(null!=o&&(!0===r&&(r=o.index),null==n?o=j(o,s,t):0!==n&&(o=j(o,r,n,t)),this.setSelection(o,l.default.sources.SILENT)),s.length()>0){var c,u,d=[l.default.events.TEXT_CHANGE,s,a,t];(c=this.emitter).emit.apply(c,[l.default.events.EDITOR_CHANGE].concat(d)),t!==l.default.sources.SILENT&&(u=this.emitter).emit.apply(u,d)}return s}function N(e,t,r,o,a){var i={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(a=o,o=r,r=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(a=o,o=r,r=t,t=0),"object"===(void 0===r?"undefined":n(r))?(i=r,a=o):"string"==typeof r&&(null!=o?i[r]=o:a=r),[e,t,i,a=a||l.default.sources.API]}function j(e,t,r,n){if(null==e)return null;var a=void 0,s=void 0;if(t instanceof i.default){var c=[e.index,e.index+e.length].map(function(e){return t.transformPosition(e,n!==l.default.sources.USER)}),u=o(c,2);a=u[0],s=u[1]}else{var f=[e.index,e.index+e.length].map(function(e){return e<t||e===t&&n===l.default.sources.USER?e:r>=0?e+r:Math.max(t,e+r)}),p=o(f,2);a=p[0],s=p[1]}return new d.Range(a,s-a)}b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},b.events=l.default.events,b.sources=l.default.sources,b.version="1.3.7",b.imports={delta:i.default,parchment:u.default,"core/module":c.default,"core/theme":m.default},t.expandConfig=x,t.overload=N,t.default=b},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=s(r(7)),i=s(r(0));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"formatAt",value:function(e,r,n,a){if(t.compare(this.statics.blotName,n)<0&&i.default.query(n,i.default.Scope.BLOT)){var s=this.isolate(e,r);a&&s.wrap(n,a)}else o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,r,n,a)}},{key:"optimize",value:function(e){if(o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){var r=this.parent.isolate(this.offset(),this.length());this.moveChildren(r),r.wrap(this)}}}],[{key:"compare",value:function(e,r){var n=t.order.indexOf(e),o=t.order.indexOf(r);return n>=0||o>=0?n-o:e===r?0:e<r?-1:1}}]),t}(i.default.Inline);l.allowedChildren=[l,i.default.Embed,a.default],l.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default.Text);t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=i(r(54));function i(e){return e&&e.__esModule?e:{default:e}}var s=(0,i(r(10)).default)("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(function(e){document.addEventListener(e,function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(e){var r;e.__quill&&e.__quill.emitter&&(r=e.__quill.emitter).handleDOM.apply(r,t)})})});var l=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.listeners={},e.on("error",s.error),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"emit",value:function(){s.log.apply(s,arguments),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];(this.listeners[e.type]||[]).forEach(function(t){var n=t.node,o=t.handler;(e.target===n||n.contains(e.target))&&o.apply(void 0,[e].concat(r))})}},{key:"listenDOM",value:function(e,t,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({node:t,handler:r})}}]),t}(a.default);l.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},l.sources={API:"api",SILENT:"silent",USER:"user"},t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.quill=t,this.options=r};n.DEFAULTS={},t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=["error","warn","log","info"],o="warn";function a(e){if(n.indexOf(e)<=n.indexOf(o)){for(var t,r=arguments.length,a=Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];(t=console)[e].apply(t,a)}}function i(e){return n.reduce(function(t,r){return t[r]=a.bind(console,r,e),t},{})}a.level=i.level=function(e){o=e},t.default=i},function(e,t,r){var n=Array.prototype.slice,o=r(52),a=r(53),i=e.exports=function(e,t,r){return r||(r={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?r.strict?e===t:e==t:function(e,t,r){var c,u;if(s(e)||s(t))return!1;if(e.prototype!==t.prototype)return!1;if(a(e))return!!a(t)&&(e=n.call(e),t=n.call(t),i(e,t,r));if(l(e)){if(!l(t))return!1;if(e.length!==t.length)return!1;for(c=0;c<e.length;c++)if(e[c]!==t[c])return!1;return!0}try{var d=o(e),f=o(t)}catch(e){return!1}if(d.length!=f.length)return!1;for(d.sort(),f.sort(),c=d.length-1;c>=0;c--)if(d[c]!=f[c])return!1;for(c=d.length-1;c>=0;c--)if(u=d[c],!i(e[u],t[u],r))return!1;return typeof e==typeof t}(e,t,r))};function s(e){return null==e}function l(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0])}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e,t,r){void 0===r&&(r={}),this.attrName=e,this.keyName=t;var o=n.Scope.TYPE&n.Scope.ATTRIBUTE;null!=r.scope?this.scope=r.scope&n.Scope.LEVEL|o:this.scope=n.Scope.ATTRIBUTE,null!=r.whitelist&&(this.whitelist=r.whitelist)}return e.keys=function(e){return[].map.call(e.attributes,function(e){return e.name})},e.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)},e.prototype.canAdd=function(e,t){return null!=n.query(e,n.Scope.BLOT&(this.scope|n.Scope.TYPE))&&(null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1))},e.prototype.remove=function(e){e.removeAttribute(this.keyName)},e.prototype.value=function(e){var t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Code=void 0;var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=d(r(2)),s=d(r(0)),l=d(r(4)),c=d(r(6)),u=d(r(7));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),t}(c.default);m.blotName="code",m.tagName="CODE";var y=function(e){function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),o(t,[{key:"delta",value:function(){var e=this,t=this.domNode.textContent;return t.endsWith("\n")&&(t=t.slice(0,-1)),t.split("\n").reduce(function(t,r){return t.insert(r).insert("\n",e.formats())},new i.default)}},{key:"format",value:function(e,r){if(e!==this.statics.blotName||!r){var o=this.descendant(u.default,this.length()-1),i=n(o,1)[0];null!=i&&i.deleteAt(i.length()-1,1),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r)}}},{key:"formatAt",value:function(e,r,n,o){if(0!==r&&null!=s.default.query(n,s.default.Scope.BLOCK)&&(n!==this.statics.blotName||o!==this.statics.formats(this.domNode))){var a=this.newlineIndex(e);if(!(a<0||a>=e+r)){var i=this.newlineIndex(e,!0)+1,l=a-i+1,c=this.isolate(i,l),u=c.next;c.format(n,o),u instanceof t&&u.formatAt(0,e-i+r-l,n,o)}}}},{key:"insertAt",value:function(e,t,r){if(null==r){var o=this.descendant(u.default,e),a=n(o,2),i=a[0],s=a[1];i.insertAt(s,t)}}},{key:"length",value:function(){var e=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?e:e+1}},{key:"newlineIndex",value:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return this.domNode.textContent.slice(0,e).lastIndexOf("\n");var t=this.domNode.textContent.slice(e).indexOf("\n");return t>-1?e+t:-1}},{key:"optimize",value:function(e){this.domNode.textContent.endsWith("\n")||this.appendChild(s.default.create("text","\n")),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===r.statics.formats(r.domNode)&&(r.optimize(e),r.moveChildren(this),r.remove())}},{key:"replace",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(e){var t=s.default.find(e);null==t?e.parentNode.removeChild(e):t instanceof s.default.Embed?t.remove():t.unwrap()})}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return r.setAttribute("spellcheck",!1),r}},{key:"formats",value:function(){return!0}}]),t}(l.default);y.blotName="code-block",y.tagName="PRE",y.TAB=" ",t.Code=m,t.default=y},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=g(r(2)),s=g(r(20)),l=g(r(0)),c=g(r(13)),u=g(r(24)),d=r(4),f=g(d),p=g(r(16)),h=g(r(21)),m=g(r(11)),y=g(r(3));function g(e){return e&&e.__esModule?e:{default:e}}var v=/^[ -~]*$/,b=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scroll=t,this.delta=this.getDelta()}return a(e,[{key:"applyDelta",value:function(e){var t=this,r=!1;this.scroll.update();var a=this.scroll.length();return this.scroll.batchStart(),(e=function(e){return e.reduce(function(e,t){if(1===t.insert){var r=(0,h.default)(t.attributes);return delete r.image,e.insert({image:t.attributes.image},r)}if(null==t.attributes||!0!==t.attributes.list&&!0!==t.attributes.bullet||((t=(0,h.default)(t)).attributes.list?t.attributes.list="ordered":(t.attributes.list="bullet",delete t.attributes.bullet)),"string"==typeof t.insert){var n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new i.default)}(e)).reduce(function(e,i){var c=i.retain||i.delete||i.insert.length||1,u=i.attributes||{};if(null!=i.insert){if("string"==typeof i.insert){var p=i.insert;p.endsWith("\n")&&r&&(r=!1,p=p.slice(0,-1)),e>=a&&!p.endsWith("\n")&&(r=!0),t.scroll.insertAt(e,p);var h=t.scroll.line(e),m=o(h,2),g=m[0],v=m[1],b=(0,y.default)({},(0,d.bubbleFormats)(g));if(g instanceof f.default){var x=g.descendant(l.default.Leaf,v),w=o(x,1)[0];b=(0,y.default)(b,(0,d.bubbleFormats)(w))}u=s.default.attributes.diff(b,u)||{}}else if("object"===n(i.insert)){var N=Object.keys(i.insert)[0];if(null==N)return e;t.scroll.insertAt(e,N,i.insert[N])}a+=c}return Object.keys(u).forEach(function(r){t.scroll.formatAt(e,c,r,u[r])}),e+c},0),e.reduce(function(e,r){return"number"==typeof r.delete?(t.scroll.deleteAt(e,r.delete),e):e+(r.retain||r.insert.length||1)},0),this.scroll.batchEnd(),this.update(e)}},{key:"deleteText",value:function(e,t){return this.scroll.deleteAt(e,t),this.update((new i.default).retain(e).delete(t))}},{key:"formatLine",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(n).forEach(function(o){if(null==r.scroll.whitelist||r.scroll.whitelist[o]){var a=r.scroll.lines(e,Math.max(t,1)),i=t;a.forEach(function(t){var a=t.length();if(t instanceof c.default){var s=e-t.offset(r.scroll),l=t.newlineIndex(s+i)-s+1;t.formatAt(s,l,o,n[o])}else t.format(o,n[o]);i-=a})}}),this.scroll.optimize(),this.update((new i.default).retain(e).retain(t,(0,h.default)(n)))}},{key:"formatText",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).forEach(function(o){r.scroll.formatAt(e,t,o,n[o])}),this.update((new i.default).retain(e).retain(t,(0,h.default)(n)))}},{key:"getContents",value:function(e,t){return this.delta.slice(e,e+t)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(e,t){return e.concat(t.delta())},new i.default)}},{key:"getFormat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=[];0===t?this.scroll.path(e).forEach(function(e){var t=o(e,1)[0];t instanceof f.default?r.push(t):t instanceof l.default.Leaf&&n.push(t)}):(r=this.scroll.lines(e,t),n=this.scroll.descendants(l.default.Leaf,e,t));var a=[r,n].map(function(e){if(0===e.length)return{};for(var t=(0,d.bubbleFormats)(e.shift());Object.keys(t).length>0;){var r=e.shift();if(null==r)return t;t=x((0,d.bubbleFormats)(r),t)}return t});return y.default.apply(y.default,a)}},{key:"getText",value:function(e,t){return this.getContents(e,t).filter(function(e){return"string"==typeof e.insert}).map(function(e){return e.insert}).join("")}},{key:"insertEmbed",value:function(e,t,r){return this.scroll.insertAt(e,t,r),this.update((new i.default).retain(e).insert(function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},t,r)))}},{key:"insertText",value:function(e,t){var r=this,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(function(o){r.scroll.formatAt(e,t.length,o,n[o])}),this.update((new i.default).retain(e).insert(t,(0,h.default)(n)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var e=this.scroll.children.head;return e.statics.blotName===f.default.blotName&&!(e.children.length>1)&&e.children.head instanceof p.default}},{key:"removeFormat",value:function(e,t){var r=this.getText(e,t),n=this.scroll.line(e+t),a=o(n,2),s=a[0],l=a[1],u=0,d=new i.default;null!=s&&(u=s instanceof c.default?s.newlineIndex(l)-l+1:s.length()-l,d=s.delta().slice(l,l+u-1).insert("\n"));var f=this.getContents(e,t+u).diff((new i.default).insert(r).concat(d)),p=(new i.default).retain(e).concat(f);return this.applyDelta(p)}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(v)&&l.default.find(t[0].target)){var o=l.default.find(t[0].target),a=(0,d.bubbleFormats)(o),s=o.offset(this.scroll),c=t[0].oldValue.replace(u.default.CONTENTS,""),f=(new i.default).insert(c),p=(new i.default).insert(o.value());e=(new i.default).retain(s).concat(f.diff(p,r)).reduce(function(e,t){return t.insert?e.insert(t.insert,a):e.push(t)},new i.default),this.delta=n.compose(e)}else this.delta=this.getDelta(),e&&(0,m.default)(n.compose(e),this.delta)||(e=n.diff(this.delta,r));return e}}]),e}();function x(e,t){return Object.keys(t).reduce(function(r,n){return null==e[n]||(t[n]===e[n]?r[n]=t[n]:Array.isArray(t[n])?t[n].indexOf(e[n])<0&&(r[n]=t[n].concat([e[n]])):r[n]=[t[n],e[n]]),r},{})}t.default=b},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Range=void 0;var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=c(r(0)),i=c(r(21)),s=c(r(11)),l=c(r(8));function c(e){return e&&e.__esModule?e:{default:e}}function u(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=(0,c(r(10)).default)("quill:selection"),p=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;d(this,e),this.index=t,this.length=r},h=function(){function e(t,r){var n=this;d(this,e),this.emitter=r,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=a.default.create("cursor",this),this.lastRange=this.savedRange=new p(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){n.mouseDown||setTimeout(n.update.bind(n,l.default.sources.USER),1)}),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e,t){e===l.default.events.TEXT_CHANGE&&t.length()>0&&n.update(l.default.sources.SILENT)}),this.emitter.on(l.default.events.SCROLL_BEFORE_UPDATE,function(){if(n.hasFocus()){var e=n.getNativeRange();null!=e&&e.start.node!==n.cursor.textNode&&n.emitter.once(l.default.events.SCROLL_UPDATE,function(){try{n.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset)}catch(e){}})}}),this.emitter.on(l.default.events.SCROLL_OPTIMIZE,function(e,t){if(t.range){var r=t.range,o=r.startNode,a=r.startOffset,i=r.endNode,s=r.endOffset;n.setNativeRange(o,a,i,s)}}),this.update(l.default.sources.SILENT)}return o(e,[{key:"handleComposition",value:function(){var e=this;this.root.addEventListener("compositionstart",function(){e.composing=!0}),this.root.addEventListener("compositionend",function(){if(e.composing=!1,e.cursor.parent){var t=e.cursor.restore();if(!t)return;setTimeout(function(){e.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}},{key:"handleDragging",value:function(){var e=this;this.emitter.listenDOM("mousedown",document.body,function(){e.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){e.mouseDown=!1,e.update(l.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(e,t){if(null==this.scroll.whitelist||this.scroll.whitelist[e]){this.scroll.update();var r=this.getNativeRange();if(null!=r&&r.native.collapsed&&!a.default.query(e,a.default.Scope.BLOCK)){if(r.start.node!==this.cursor.textNode){var n=a.default.find(r.start.node,!1);if(null==n)return;if(n instanceof a.default.Leaf){var o=n.split(r.start.offset);n.parent.insertBefore(this.cursor,o)}else n.insertBefore(this.cursor,r.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()}}}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.scroll.length();e=Math.min(e,r-1),t=Math.min(e+t,r-1)-e;var o=void 0,a=this.scroll.leaf(e),i=n(a,2),s=i[0],l=i[1];if(null==s)return null;var c=s.position(l,!0),u=n(c,2);o=u[0],l=u[1];var d=document.createRange();if(t>0){d.setStart(o,l);var f=this.scroll.leaf(e+t),p=n(f,2);if(s=p[0],l=p[1],null==s)return null;var h=s.position(l,!0),m=n(h,2);return o=m[0],l=m[1],d.setEnd(o,l),d.getBoundingClientRect()}var y="left",g=void 0;return o instanceof Text?(l<o.data.length?(d.setStart(o,l),d.setEnd(o,l+1)):(d.setStart(o,l-1),d.setEnd(o,l),y="right"),g=d.getBoundingClientRect()):(g=s.domNode.getBoundingClientRect(),l>0&&(y="right")),{bottom:g.top+g.height,height:g.height,left:g[y],right:g[y],top:g.top,width:0}}},{key:"getNativeRange",value:function(){var e=document.getSelection();if(null==e||e.rangeCount<=0)return null;var t=e.getRangeAt(0);if(null==t)return null;var r=this.normalizeNative(t);return f.info("getNativeRange",r),r}},{key:"getRange",value:function(){var e=this.getNativeRange();return null==e?[null,null]:[this.normalizedToRange(e),e]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(e){var t=this,r=[[e.start.node,e.start.offset]];e.native.collapsed||r.push([e.end.node,e.end.offset]);var o=r.map(function(e){var r=n(e,2),o=r[0],i=r[1],s=a.default.find(o,!0),l=s.offset(t.scroll);return 0===i?l:s instanceof a.default.Container?l+s.length():l+s.index(o,i)}),i=Math.min(Math.max.apply(Math,u(o)),this.scroll.length()-1),s=Math.min.apply(Math,[i].concat(u(o)));return new p(s,i-s)}},{key:"normalizeNative",value:function(e){if(!m(this.root,e.startContainer)||!e.collapsed&&!m(this.root,e.endContainer))return null;var t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(function(e){for(var t=e.node,r=e.offset;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>r)t=t.childNodes[r],r=0;else{if(t.childNodes.length!==r)break;r=(t=t.lastChild)instanceof Text?t.data.length:t.childNodes.length+1}e.node=t,e.offset=r}),t}},{key:"rangeToNative",value:function(e){var t=this,r=e.collapsed?[e.index]:[e.index,e.index+e.length],o=[],a=this.scroll.length();return r.forEach(function(e,r){e=Math.min(a-1,e);var i,s=t.scroll.leaf(e),l=n(s,2),c=l[0],u=l[1],d=c.position(u,0!==r),f=n(d,2);i=f[0],u=f[1],o.push(i,u)}),o.length<2&&(o=o.concat(o)),o}},{key:"scrollIntoView",value:function(e){var t=this.lastRange;if(null!=t){var r=this.getBounds(t.index,t.length);if(null!=r){var o=this.scroll.length()-1,a=this.scroll.line(Math.min(t.index,o)),i=n(a,1)[0],s=i;if(t.length>0){var l=this.scroll.line(Math.min(t.index+t.length,o));s=n(l,1)[0]}if(null!=i&&null!=s){var c=e.getBoundingClientRect();r.top<c.top?e.scrollTop-=c.top-r.top:r.bottom>c.bottom&&(e.scrollTop+=r.bottom-c.bottom)}}}}},{key:"setNativeRange",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(f.info("setNativeRange",e,t,r,n),null==e||null!=this.root.parentNode&&null!=e.parentNode&&null!=r.parentNode){var a=document.getSelection();if(null!=a)if(null!=e){this.hasFocus()||this.root.focus();var i=(this.getNativeRange()||{}).native;if(null==i||o||e!==i.startContainer||t!==i.startOffset||r!==i.endContainer||n!==i.endOffset){"BR"==e.tagName&&(t=[].indexOf.call(e.parentNode.childNodes,e),e=e.parentNode),"BR"==r.tagName&&(n=[].indexOf.call(r.parentNode.childNodes,r),r=r.parentNode);var s=document.createRange();s.setStart(e,t),s.setEnd(r,n),a.removeAllRanges(),a.addRange(s)}}else a.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;if("string"==typeof t&&(r=t,t=!1),f.info("setRange",e),null!=e){var n=this.rangeToNative(e);this.setNativeRange.apply(this,u(n).concat([t]))}else this.setNativeRange(null);this.update(r)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.lastRange,r=this.getRange(),o=n(r,2),a=o[0],c=o[1];if(this.lastRange=a,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,s.default)(t,this.lastRange)){var u;!this.composing&&null!=c&&c.native.collapsed&&c.start.node!==this.cursor.textNode&&this.cursor.restore();var d,f=[l.default.events.SELECTION_CHANGE,(0,i.default)(this.lastRange),(0,i.default)(t),e];(u=this.emitter).emit.apply(u,[l.default.events.EDITOR_CHANGE].concat(f)),e!==l.default.sources.SILENT&&(d=this.emitter).emit.apply(d,f)}}}]),e}();function m(e,t){try{t.parentNode}catch(e){return!1}return t instanceof Text&&(t=t.parentNode),e.contains(t)}t.Range=p,t.default=h},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"insertInto",value:function(e,r){0===e.children.length?a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertInto",this).call(this,e,r):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default.Embed);s.blotName="break",s.tagName="BR",t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(44),i=r(30),s=r(1),l=function(e){function t(t){var r=e.call(this,t)||this;return r.build(),r}return o(t,e),t.prototype.appendChild=function(e){this.insertBefore(e)},t.prototype.attach=function(){e.prototype.attach.call(this),this.children.forEach(function(e){e.attach()})},t.prototype.build=function(){var e=this;this.children=new a.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(t){try{var r=c(t);e.insertBefore(r,e.children.head||void 0)}catch(e){if(e instanceof s.ParchmentError)return;throw e}})},t.prototype.deleteAt=function(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,function(e,t,r){e.deleteAt(t,r)})},t.prototype.descendant=function(e,r){var n=this.children.find(r),o=n[0],a=n[1];return null==e.blotName&&e(o)||null!=e.blotName&&o instanceof e?[o,a]:o instanceof t?o.descendant(e,a):[null,-1]},t.prototype.descendants=function(e,r,n){void 0===r&&(r=0),void 0===n&&(n=Number.MAX_VALUE);var o=[],a=n;return this.children.forEachAt(r,n,function(r,n,i){(null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e)&&o.push(r),r instanceof t&&(o=o.concat(r.descendants(e,n,a))),a-=i}),o},t.prototype.detach=function(){this.children.forEach(function(e){e.detach()}),e.prototype.detach.call(this)},t.prototype.formatAt=function(e,t,r,n){this.children.forEachAt(e,t,function(e,t,o){e.formatAt(t,o,r,n)})},t.prototype.insertAt=function(e,t,r){var n=this.children.find(e),o=n[0],a=n[1];if(o)o.insertAt(a,t,r);else{var i=null==r?s.create("text",t):s.create(t,r);this.appendChild(i)}},t.prototype.insertBefore=function(e,t){if(null!=this.statics.allowedChildren&&!this.statics.allowedChildren.some(function(t){return e instanceof t}))throw new s.ParchmentError("Cannot insert "+e.statics.blotName+" into "+this.statics.blotName);e.insertInto(this,t)},t.prototype.length=function(){return this.children.reduce(function(e,t){return e+t.length()},0)},t.prototype.moveChildren=function(e,t){this.children.forEach(function(r){e.insertBefore(r,t)})},t.prototype.optimize=function(t){if(e.prototype.optimize.call(this,t),0===this.children.length)if(null!=this.statics.defaultChild){var r=s.create(this.statics.defaultChild);this.appendChild(r),r.optimize(t)}else this.remove()},t.prototype.path=function(e,r){void 0===r&&(r=!1);var n=this.children.find(e,r),o=n[0],a=n[1],i=[[this,e]];return o instanceof t?i.concat(o.path(a,r)):(null!=o&&i.push([o,a]),i)},t.prototype.removeChild=function(e){this.children.remove(e)},t.prototype.replace=function(r){r instanceof t&&r.moveChildren(this),e.prototype.replace.call(this,r)},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var r=this.clone();return this.parent.insertBefore(r,this.next),this.children.forEachAt(e,this.length(),function(e,n,o){e=e.split(n,t),r.appendChild(e)}),r},t.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},t.prototype.update=function(e,t){var r=this,n=[],o=[];e.forEach(function(e){e.target===r.domNode&&"childList"===e.type&&(n.push.apply(n,e.addedNodes),o.push.apply(o,e.removedNodes))}),o.forEach(function(e){if(!(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var t=s.find(e);null!=t&&(null!=t.domNode.parentNode&&t.domNode.parentNode!==r.domNode||t.detach())}}),n.filter(function(e){return e.parentNode==r.domNode}).sort(function(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(e){var t=null;null!=e.nextSibling&&(t=s.find(e.nextSibling));var n=c(e);n.next==t&&null!=n.next||(null!=n.parent&&n.parent.removeChild(r),r.insertBefore(n,t||void 0))})},t}(i.default);function c(e){var t=s.find(e);if(null==t)try{t=s.create(e)}catch(r){t=s.create(s.Scope.INLINE),[].slice.call(e.childNodes).forEach(function(e){t.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(t.domNode,e),t.attach()}return t}t.default=l},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(12),i=r(31),s=r(17),l=r(1),c=function(e){function t(t){var r=e.call(this,t)||this;return r.attributes=new i.default(r.domNode),r}return o(t,e),t.formats=function(e){return"string"==typeof this.tagName||(Array.isArray(this.tagName)?e.tagName.toLowerCase():void 0)},t.prototype.format=function(e,t){var r=l.query(e);r instanceof a.default?this.attributes.attribute(r,t):t&&(null==r||e===this.statics.blotName&&this.formats()[e]===t||this.replaceWith(e,t))},t.prototype.formats=function(){var e=this.attributes.values(),t=this.statics.formats(this.domNode);return null!=t&&(e[this.statics.blotName]=t),e},t.prototype.replaceWith=function(t,r){var n=e.prototype.replaceWith.call(this,t,r);return this.attributes.copy(n),n},t.prototype.update=function(t,r){var n=this;e.prototype.update.call(this,t,r),t.some(function(e){return e.target===n.domNode&&"attributes"===e.type})&&this.attributes.build()},t.prototype.wrap=function(r,n){var o=e.prototype.wrap.call(this,r,n);return o instanceof t&&o.statics.scope===this.statics.scope&&this.attributes.move(o),o},t}(s.default);t.default=c},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(30),i=r(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.value=function(e){return!0},t.prototype.index=function(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1},t.prototype.position=function(e,t){var r=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return e>0&&(r+=1),[this.parent.domNode,r]},t.prototype.value=function(){var e;return(e={})[this.statics.blotName]=this.statics.value(this.domNode)||!0,e},t.scope=i.Scope.INLINE_BLOT,t}(a.default);t.default=s},function(e,t,r){var n=r(11),o=r(3),a={attributes:{compose:function(e,t,r){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var n=o(!0,{},t);for(var a in r||(n=Object.keys(n).reduce(function(e,t){return null!=n[t]&&(e[t]=n[t]),e},{})),e)void 0!==e[a]&&void 0===t[a]&&(n[a]=e[a]);return Object.keys(n).length>0?n:void 0},diff:function(e,t){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var r=Object.keys(e).concat(Object.keys(t)).reduce(function(r,o){return n(e[o],t[o])||(r[o]=void 0===t[o]?null:t[o]),r},{});return Object.keys(r).length>0?r:void 0},transform:function(e,t,r){if("object"!=typeof e)return t;if("object"==typeof t){if(!r)return t;var n=Object.keys(t).reduce(function(r,n){return void 0===e[n]&&(r[n]=t[n]),r},{});return Object.keys(n).length>0?n:void 0}}},iterator:function(e){return new i(e)},length:function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"string"==typeof e.insert?e.insert.length:1}};function i(e){this.ops=e,this.index=0,this.offset=0}i.prototype.hasNext=function(){return this.peekLength()<1/0},i.prototype.next=function(e){e||(e=1/0);var t=this.ops[this.index];if(t){var r=this.offset,n=a.length(t);if(e>=n-r?(e=n-r,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof t.delete)return{delete:e};var o={};return t.attributes&&(o.attributes=t.attributes),"number"==typeof t.retain?o.retain=e:"string"==typeof t.insert?o.insert=t.insert.substr(r,e):o.insert=t.insert,o}return{retain:1/0}},i.prototype.peek=function(){return this.ops[this.index]},i.prototype.peekLength=function(){return this.ops[this.index]?a.length(this.ops[this.index])-this.offset:1/0},i.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},i.prototype.rest=function(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);var e=this.offset,t=this.index,r=this.next(),n=this.ops.slice(this.index);return this.offset=e,this.index=t,[r].concat(n)}return[]},e.exports=a},function(e,t){var r=function(){function e(e,t){return null!=t&&e instanceof t}var t,r,n;try{t=Map}catch(e){t=function(){}}try{r=Set}catch(e){r=function(){}}try{n=Promise}catch(e){n=function(){}}function o(a,s,l,c,u){"object"==typeof s&&(l=s.depth,c=s.prototype,u=s.includeNonEnumerable,s=s.circular);var d=[],f=[],p="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function a(l,h){if(null===l)return null;if(0===h)return l;var m,y;if("object"!=typeof l)return l;if(e(l,t))m=new t;else if(e(l,r))m=new r;else if(e(l,n))m=new n(function(e,t){l.then(function(t){e(a(t,h-1))},function(e){t(a(e,h-1))})});else if(o.__isArray(l))m=[];else if(o.__isRegExp(l))m=new RegExp(l.source,i(l)),l.lastIndex&&(m.lastIndex=l.lastIndex);else if(o.__isDate(l))m=new Date(l.getTime());else{if(p&&Buffer.isBuffer(l))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(l.length):new Buffer(l.length),l.copy(m),m;e(l,Error)?m=Object.create(l):void 0===c?(y=Object.getPrototypeOf(l),m=Object.create(y)):(m=Object.create(c),y=c)}if(s){var g=d.indexOf(l);if(-1!=g)return f[g];d.push(l),f.push(m)}for(var v in e(l,t)&&l.forEach(function(e,t){var r=a(t,h-1),n=a(e,h-1);m.set(r,n)}),e(l,r)&&l.forEach(function(e){var t=a(e,h-1);m.add(t)}),l){var b;y&&(b=Object.getOwnPropertyDescriptor(y,v)),b&&null==b.set||(m[v]=a(l[v],h-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(l);for(v=0;v<x.length;v++){var w=x[v];(!(j=Object.getOwnPropertyDescriptor(l,w))||j.enumerable||u)&&(m[w]=a(l[w],h-1),j.enumerable||Object.defineProperty(m,w,{enumerable:!1}))}}if(u){var N=Object.getOwnPropertyNames(l);for(v=0;v<N.length;v++){var j,_=N[v];(j=Object.getOwnPropertyDescriptor(l,_))&&j.enumerable||(m[_]=a(l[_],h-1),Object.defineProperty(m,_,{enumerable:!1}))}}return m}(a,l)}function a(e){return Object.prototype.toString.call(e)}function i(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return o.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},o.__objToStr=a,o.__isDate=function(e){return"object"==typeof e&&"[object Date]"===a(e)},o.__isArray=function(e){return"object"==typeof e&&"[object Array]"===a(e)},o.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===a(e)},o.__getRegExpFlags=i,o}();"object"==typeof e&&e.exports&&(e.exports=r)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=p(r(0)),s=p(r(8)),l=r(4),c=p(l),u=p(r(16)),d=p(r(13)),f=p(r(25));function p(e){return e&&e.__esModule?e:{default:e}}function h(e){return e instanceof c.default||e instanceof l.BlockEmbed}var m=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.emitter=r.emitter,Array.isArray(r.whitelist)&&(n.whitelist=r.whitelist.reduce(function(e,t){return e[t]=!0,e},{})),n.domNode.addEventListener("DOMNodeInserted",function(){}),n.optimize(),n.enable(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(e,r){var o=this.line(e),i=n(o,2),s=i[0],c=i[1],f=this.line(e+r),p=n(f,1)[0];if(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,r),null!=p&&s!==p&&c>0){if(s instanceof l.BlockEmbed||p instanceof l.BlockEmbed)return void this.optimize();if(s instanceof d.default){var h=s.newlineIndex(s.length(),!0);if(h>-1&&(s=s.split(h+1))===p)return void this.optimize()}else if(p instanceof d.default){var m=p.newlineIndex(0);m>-1&&p.split(m+1)}var y=p.children.head instanceof u.default?null:p.children.head;s.moveChildren(p,y),s.remove()}this.optimize()}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e)}},{key:"formatAt",value:function(e,r,n,o){(null==this.whitelist||this.whitelist[n])&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,r,n,o),this.optimize())}},{key:"insertAt",value:function(e,r,n){if(null==n||null==this.whitelist||this.whitelist[r]){if(e>=this.length())if(null==n||null==i.default.query(r,i.default.Scope.BLOCK)){var o=i.default.create(this.statics.defaultChild);this.appendChild(o),null==n&&r.endsWith("\n")&&(r=r.slice(0,-1)),o.insertAt(0,r,n)}else{var s=i.default.create(r,n);this.appendChild(s)}else a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,r,n);this.optimize()}}},{key:"insertBefore",value:function(e,r){if(e.statics.scope===i.default.Scope.INLINE_BLOT){var n=i.default.create(this.statics.defaultChild);n.appendChild(e),e=n}a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,r)}},{key:"leaf",value:function(e){return this.path(e).pop()||[null,-1]}},{key:"line",value:function(e){return e===this.length()?this.line(e-1):this.descendant(h,e)}},{key:"lines",value:function(){return function e(t,r,n){var o=[],a=n;return t.children.forEachAt(r,n,function(t,r,n){h(t)?o.push(t):t instanceof i.default.Container&&(o=o.concat(e(t,r,a))),a-=n}),o}(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE)}},{key:"optimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e,r),e.length>0&&this.emitter.emit(s.default.events.SCROLL_OPTIMIZE,e,r))}},{key:"path",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e).slice(1)}},{key:"update",value:function(e){if(!0!==this.batch){var r=s.default.sources.USER;"string"==typeof e&&(r=e),Array.isArray(e)||(e=this.observer.takeRecords()),e.length>0&&this.emitter.emit(s.default.events.SCROLL_BEFORE_UPDATE,r,e),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).call(this,e.concat([])),e.length>0&&this.emitter.emit(s.default.events.SCROLL_UPDATE,r,e)}}}]),t}(i.default.Scroll);m.blotName="scroll",m.className="ql-editor",m.tagName="DIV",m.defaultChild="block",m.allowedChildren=[c.default,l.BlockEmbed,f.default],t.default=m},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SHORTKEY=t.default=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=m(r(21)),s=m(r(11)),l=m(r(3)),c=m(r(2)),u=m(r(20)),d=m(r(0)),f=m(r(5)),p=m(r(10)),h=m(r(9));function m(e){return e&&e.__esModule?e:{default:e}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var g=(0,p.default)("quill:keyboard"),v=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",b=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.bindings={},Object.keys(n.options.bindings).forEach(function(t){("list autofill"!==t||null==e.scroll.whitelist||e.scroll.whitelist.list)&&n.options.bindings[t]&&n.addBinding(n.options.bindings[t])}),n.addBinding({key:t.keys.ENTER,shiftKey:null},_),n.addBinding({key:t.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(n.addBinding({key:t.keys.BACKSPACE},{collapsed:!0},w),n.addBinding({key:t.keys.DELETE},{collapsed:!0},N)):(n.addBinding({key:t.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},w),n.addBinding({key:t.keys.DELETE},{collapsed:!0,suffix:/^.?$/},N)),n.addBinding({key:t.keys.BACKSPACE},{collapsed:!1},j),n.addBinding({key:t.keys.DELETE},{collapsed:!1},j),n.addBinding({key:t.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},w),n.listen(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,null,[{key:"match",value:function(e,t){return t=E(t),!["altKey","ctrlKey","metaKey","shiftKey"].some(function(r){return!!t[r]!==e[r]&&null!==t[r]})&&t.key===(e.which||e.keyCode)}}]),a(t,[{key:"addBinding",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=E(e);if(null==n||null==n.key)return g.warn("Attempted to add invalid keyboard binding",n);"function"==typeof t&&(t={handler:t}),"function"==typeof r&&(r={handler:r}),n=(0,l.default)(n,t,r),this.bindings[n.key]=this.bindings[n.key]||[],this.bindings[n.key].push(n)}},{key:"listen",value:function(){var e=this;this.quill.root.addEventListener("keydown",function(r){if(!r.defaultPrevented){var a=r.which||r.keyCode,i=(e.bindings[a]||[]).filter(function(e){return t.match(r,e)});if(0!==i.length){var l=e.quill.getSelection();if(null!=l&&e.quill.hasFocus()){var c=e.quill.getLine(l.index),u=o(c,2),f=u[0],p=u[1],h=e.quill.getLeaf(l.index),m=o(h,2),y=m[0],g=m[1],v=0===l.length?[y,g]:e.quill.getLeaf(l.index+l.length),b=o(v,2),x=b[0],w=b[1],N=y instanceof d.default.Text?y.value().slice(0,g):"",j=x instanceof d.default.Text?x.value().slice(w):"",_={collapsed:0===l.length,empty:0===l.length&&f.length()<=1,format:e.quill.getFormat(l),offset:p,prefix:N,suffix:j};i.some(function(t){if(null!=t.collapsed&&t.collapsed!==_.collapsed)return!1;if(null!=t.empty&&t.empty!==_.empty)return!1;if(null!=t.offset&&t.offset!==_.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(function(e){return null==_.format[e]}))return!1}else if("object"===n(t.format)&&!Object.keys(t.format).every(function(e){return!0===t.format[e]?null!=_.format[e]:!1===t.format[e]?null==_.format[e]:(0,s.default)(t.format[e],_.format[e])}))return!1;return!(null!=t.prefix&&!t.prefix.test(_.prefix)||null!=t.suffix&&!t.suffix.test(_.suffix)||!0===t.handler.call(e,l,_))})&&r.preventDefault()}}}})}}]),t}(h.default);function x(e,t){var r,n=e===b.keys.LEFT?"prefix":"suffix";return y(r={key:e,shiftKey:t,altKey:null},n,/^$/),y(r,"handler",function(r){var n=r.index;e===b.keys.RIGHT&&(n+=r.length+1);var a=this.quill.getLeaf(n);return!(o(a,1)[0]instanceof d.default.Embed&&(e===b.keys.LEFT?t?this.quill.setSelection(r.index-1,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index-1,f.default.sources.USER):t?this.quill.setSelection(r.index,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index+r.length+1,f.default.sources.USER),1))}),r}function w(e,t){if(!(0===e.index||this.quill.getLength()<=1)){var r=this.quill.getLine(e.index),n=o(r,1)[0],a={};if(0===t.offset){var i=this.quill.getLine(e.index-1),s=o(i,1)[0];if(null!=s&&s.length()>1){var l=n.formats(),c=this.quill.getFormat(e.index-1,1);a=u.default.attributes.diff(l,c)||{}}}var d=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;this.quill.deleteText(e.index-d,d,f.default.sources.USER),Object.keys(a).length>0&&this.quill.formatLine(e.index-d,d,a,f.default.sources.USER),this.quill.focus()}}function N(e,t){var r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(!(e.index>=this.quill.getLength()-r)){var n={},a=0,i=this.quill.getLine(e.index),s=o(i,1)[0];if(t.offset>=s.length()-1){var l=this.quill.getLine(e.index+1),c=o(l,1)[0];if(c){var d=s.formats(),p=this.quill.getFormat(e.index,1);n=u.default.attributes.diff(d,p)||{},a=c.length()}}this.quill.deleteText(e.index,r,f.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(e.index+a-1,r,n,f.default.sources.USER)}}function j(e){var t=this.quill.getLines(e),r={};if(t.length>1){var n=t[0].formats(),o=t[t.length-1].formats();r=u.default.attributes.diff(o,n)||{}}this.quill.deleteText(e,f.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index,1,r,f.default.sources.USER),this.quill.setSelection(e.index,f.default.sources.SILENT),this.quill.focus()}function _(e,t){var r=this;e.length>0&&this.quill.scroll.deleteAt(e.index,e.length);var n=Object.keys(t.format).reduce(function(e,r){return d.default.query(r,d.default.Scope.BLOCK)&&!Array.isArray(t.format[r])&&(e[r]=t.format[r]),e},{});this.quill.insertText(e.index,"\n",n,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(function(e){null==n[e]&&(Array.isArray(t.format[e])||"link"!==e&&r.quill.format(e,t.format[e],f.default.sources.USER))})}function k(e){return{key:b.keys.TAB,shiftKey:!e,format:{"code-block":!0},handler:function(t){var r=d.default.query("code-block"),n=t.index,a=t.length,i=this.quill.scroll.descendant(r,n),s=o(i,2),l=s[0],c=s[1];if(null!=l){var u=this.quill.getIndex(l),p=l.newlineIndex(c,!0)+1,h=l.newlineIndex(u+c+a),m=l.domNode.textContent.slice(p,h).split("\n");c=0,m.forEach(function(t,o){e?(l.insertAt(p+c,r.TAB),c+=r.TAB.length,0===o?n+=r.TAB.length:a+=r.TAB.length):t.startsWith(r.TAB)&&(l.deleteAt(p+c,r.TAB.length),c-=r.TAB.length,0===o?n-=r.TAB.length:a-=r.TAB.length),c+=t.length+1}),this.quill.update(f.default.sources.USER),this.quill.setSelection(n,a,f.default.sources.SILENT)}}}}function O(e){return{key:e[0].toUpperCase(),shortKey:!0,handler:function(t,r){this.quill.format(e,!r.format[e],f.default.sources.USER)}}}function E(e){if("string"==typeof e||"number"==typeof e)return E({key:e});if("object"===(void 0===e?"undefined":n(e))&&(e=(0,i.default)(e,!1)),"string"==typeof e.key)if(null!=b.keys[e.key.toUpperCase()])e.key=b.keys[e.key.toUpperCase()];else{if(1!==e.key.length)return null;e.key=e.key.toUpperCase().charCodeAt(0)}return e.shortKey&&(e[v]=e.shortKey,delete e.shortKey),e}b.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},b.DEFAULTS={bindings:{bold:O("bold"),italic:O("italic"),underline:O("underline"),indent:{key:b.keys.TAB,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","+1",f.default.sources.USER)}},outdent:{key:b.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","-1",f.default.sources.USER)}},"outdent backspace":{key:b.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(e,t){null!=t.format.indent?this.quill.format("indent","-1",f.default.sources.USER):null!=t.format.list&&this.quill.format("list",!1,f.default.sources.USER)}},"indent code-block":k(!0),"outdent code-block":k(!1),"remove tab":{key:b.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(e){this.quill.deleteText(e.index-1,1,f.default.sources.USER)}},tab:{key:b.keys.TAB,handler:function(e){this.quill.history.cutoff();var t=(new c.default).retain(e.index).delete(e.length).insert("\t");this.quill.updateContents(t,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,f.default.sources.SILENT)}},"list empty enter":{key:b.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(e,t){this.quill.format("list",!1,f.default.sources.USER),t.format.indent&&this.quill.format("indent",!1,f.default.sources.USER)}},"checklist enter":{key:b.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(e){var t=this.quill.getLine(e.index),r=o(t,2),n=r[0],a=r[1],i=(0,l.default)({},n.formats(),{list:"checked"}),s=(new c.default).retain(e.index).insert("\n",i).retain(n.length()-a-1).retain(1,{list:"unchecked"});this.quill.updateContents(s,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:b.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(e,t){var r=this.quill.getLine(e.index),n=o(r,2),a=n[0],i=n[1],s=(new c.default).retain(e.index).insert("\n",t.format).retain(a.length()-i-1).retain(1,{header:null});this.quill.updateContents(s,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(e,t){var r=t.prefix.length,n=this.quill.getLine(e.index),a=o(n,2),i=a[0],s=a[1];if(s>r)return!0;var l=void 0;switch(t.prefix.trim()){case"[]":case"[ ]":l="unchecked";break;case"[x]":l="checked";break;case"-":case"*":l="bullet";break;default:l="ordered"}this.quill.insertText(e.index," ",f.default.sources.USER),this.quill.history.cutoff();var u=(new c.default).retain(e.index-s).delete(r+1).retain(i.length()-2-s).retain(1,{list:l});this.quill.updateContents(u,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-r,f.default.sources.SILENT)}},"code exit":{key:b.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(e){var t=this.quill.getLine(e.index),r=o(t,2),n=r[0],a=r[1],i=(new c.default).retain(e.index+n.length()-a-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(i,f.default.sources.USER)}},"embed left":x(b.keys.LEFT,!1),"embed left shift":x(b.keys.LEFT,!0),"embed right":x(b.keys.RIGHT,!1),"embed right shift":x(b.keys.RIGHT,!0)}},t.default=b,t.SHORTKEY=v},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=l(r(0)),s=l(r(7));function l(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.selection=r,n.textNode=document.createTextNode(t.CONTENTS),n.domNode.appendChild(n.textNode),n._length=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,null,[{key:"value",value:function(){}}]),a(t,[{key:"detach",value:function(){null!=this.parent&&this.parent.removeChild(this)}},{key:"format",value:function(e,r){if(0!==this._length)return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r);for(var n=this,a=0;null!=n&&n.statics.scope!==i.default.Scope.BLOCK_BLOT;)a+=n.offset(n.parent),n=n.parent;null!=n&&(this._length=t.CONTENTS.length,n.optimize(),n.formatAt(a,t.CONTENTS.length,e,r),this._length=0)}},{key:"index",value:function(e,r){return e===this.textNode?0:o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,r)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!this.selection.composing&&null!=this.parent){var e=this.textNode,r=this.selection.getNativeRange(),o=void 0,a=void 0,l=void 0;if(null!=r&&r.start.node===e&&r.end.node===e){var c=[e,r.start.offset,r.end.offset];o=c[0],a=c[1],l=c[2]}for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==t.CONTENTS){var u=this.textNode.data.split(t.CONTENTS).join("");this.next instanceof s.default?(o=this.next.domNode,this.next.insertAt(0,u),this.textNode.data=t.CONTENTS):(this.textNode.data=u,this.parent.insertBefore(i.default.create(this.textNode),this),this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),null!=a){var d=[a,l].map(function(e){return Math.max(0,Math.min(o.data.length,e-1))}),f=n(d,2);return a=f[0],l=f[1],{startNode:o,startOffset:a,endNode:o,endOffset:l}}}}},{key:"update",value:function(e,t){var r=this;if(e.some(function(e){return"characterData"===e.type&&e.target===r.textNode})){var n=this.restore();n&&(t.range=n)}}},{key:"value",value:function(){return""}}]),t}(i.default.Embed);c.blotName="cursor",c.className="ql-cursor",c.tagName="span",c.CONTENTS="\ufeff",t.default=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=i(r(0)),o=r(4),a=i(o);function i(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(n.default.Container);s.allowedChildren=[a.default,o.BlockEmbed,s],t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorStyle=t.ColorClass=t.ColorAttributor=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"value",value:function(e){var r=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e);return r.startsWith("rgb(")?(r=r.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),"#"+r.split(",").map(function(e){return("00"+parseInt(e).toString(16)).slice(-2)}).join("")):r}}]),t}(s.default.Attributor.Style),c=new s.default.Attributor.Class("color","ql-color",{scope:s.default.Scope.INLINE}),u=new l("color","color",{scope:s.default.Scope.INLINE});t.ColorAttributor=l,t.ColorClass=c,t.ColorStyle=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sanitize=t.default=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(6),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"format",value:function(e,r){if(e!==this.statics.blotName||!r)return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r);r=this.constructor.sanitize(r),this.domNode.setAttribute("href",r)}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return e=this.sanitize(e),r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer"),r.setAttribute("target","_blank"),r}},{key:"formats",value:function(e){return e.getAttribute("href")}},{key:"sanitize",value:function(e){return l(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);function l(e,t){var r=document.createElement("a");r.href=e;var n=r.href.slice(0,r.href.indexOf(":"));return t.indexOf(n)>-1}s.blotName="link",s.tagName="A",s.SANITIZED_URL="about:blank",s.PROTOCOL_WHITELIST=["http","https","mailto","tel"],t.default=s,t.sanitize=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=s(r(23)),i=s(r(107));function s(e){return e&&e.__esModule?e:{default:e}}var l=0;function c(e,t){e.setAttribute(t,!("true"===e.getAttribute(t)))}var u=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){r.togglePicker()}),this.label.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:r.togglePicker();break;case a.default.keys.ESCAPE:r.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}return o(e,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),c(this.label,"aria-expanded"),c(this.options,"aria-hidden")}},{key:"buildItem",value:function(e){var t=this,r=document.createElement("span");return r.tabIndex="0",r.setAttribute("role","button"),r.classList.add("ql-picker-item"),e.hasAttribute("value")&&r.setAttribute("data-value",e.getAttribute("value")),e.textContent&&r.setAttribute("data-label",e.textContent),r.addEventListener("click",function(){t.selectItem(r,!0)}),r.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:t.selectItem(r,!0),e.preventDefault();break;case a.default.keys.ESCAPE:t.escape(),e.preventDefault()}}),r}},{key:"buildLabel",value:function(){var e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML=i.default,e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}},{key:"buildOptions",value:function(){var e=this,t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id="ql-picker-options-"+l,l+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,[].slice.call(this.select.options).forEach(function(r){var n=e.buildItem(r);t.appendChild(n),!0===r.selected&&e.selectItem(n)}),this.container.appendChild(t)}},{key:"buildPicker",value:function(){var e=this;[].slice.call(this.select.attributes).forEach(function(t){e.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var e=this;this.close(),setTimeout(function(){return e.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.container.querySelector(".ql-selected");if(e!==r&&(null!=r&&r.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(e.parentNode.children,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))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if("object"===("undefined"==typeof Event?"undefined":n(Event))){var o=document.createEvent("Event");o.initEvent("change",!0,!0),this.select.dispatchEvent(o)}this.close()}}},{key:"update",value:function(){var e=void 0;if(this.select.selectedIndex>-1){var 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);var r=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",r)}}]),e}();t.default=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=g(r(0)),o=g(r(5)),a=r(4),i=g(a),s=g(r(16)),l=g(r(25)),c=g(r(24)),u=g(r(35)),d=g(r(6)),f=g(r(22)),p=g(r(7)),h=g(r(55)),m=g(r(42)),y=g(r(23));function g(e){return e&&e.__esModule?e:{default:e}}o.default.register({"blots/block":i.default,"blots/block/embed":a.BlockEmbed,"blots/break":s.default,"blots/container":l.default,"blots/cursor":c.default,"blots/embed":u.default,"blots/inline":d.default,"blots/scroll":f.default,"blots/text":p.default,"modules/clipboard":h.default,"modules/history":m.default,"modules/keyboard":y.default}),n.default.register(i.default,s.default,c.default,d.default,f.default,p.default),t.default=o.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e){this.domNode=e,this.domNode[n.DATA_KEY]={blot:this}}return Object.defineProperty(e.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),e.create=function(e){if(null==this.tagName)throw new n.ParchmentError("Blot definition missing tagName");var t;return Array.isArray(this.tagName)?("string"==typeof e&&(e=e.toUpperCase(),parseInt(e).toString()===e&&(e=parseInt(e))),t="number"==typeof e?document.createElement(this.tagName[e-1]):this.tagName.indexOf(e)>-1?document.createElement(e):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t},e.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},e.prototype.clone=function(){var e=this.domNode.cloneNode(!1);return n.create(e)},e.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[n.DATA_KEY]},e.prototype.deleteAt=function(e,t){this.isolate(e,t).remove()},e.prototype.formatAt=function(e,t,r,o){var a=this.isolate(e,t);if(null!=n.query(r,n.Scope.BLOT)&&o)a.wrap(r,o);else if(null!=n.query(r,n.Scope.ATTRIBUTE)){var i=n.create(this.statics.scope);a.wrap(i),i.format(r,o)}},e.prototype.insertAt=function(e,t,r){var o=null==r?n.create("text",t):n.create(t,r),a=this.split(e);this.parent.insertBefore(o,a)},e.prototype.insertInto=function(e,t){void 0===t&&(t=null),null!=this.parent&&this.parent.children.remove(this);var r=null;e.children.insertBefore(this,t),null!=t&&(r=t.domNode),this.domNode.parentNode==e.domNode&&this.domNode.nextSibling==r||e.domNode.insertBefore(this.domNode,r),this.parent=e,this.attach()},e.prototype.isolate=function(e,t){var r=this.split(e);return r.split(t),r},e.prototype.length=function(){return 1},e.prototype.offset=function(e){return void 0===e&&(e=this.parent),null==this.parent||this==e?0:this.parent.children.offset(this)+this.parent.offset(e)},e.prototype.optimize=function(e){null!=this.domNode[n.DATA_KEY]&&delete this.domNode[n.DATA_KEY].mutations},e.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},e.prototype.replace=function(e){null!=e.parent&&(e.parent.insertBefore(this,e.next),e.remove())},e.prototype.replaceWith=function(e,t){var r="string"==typeof e?n.create(e,t):e;return r.replace(this),r},e.prototype.split=function(e,t){return 0===e?this:this.next},e.prototype.update=function(e,t){},e.prototype.wrap=function(e,t){var r="string"==typeof e?n.create(e,t):e;return null!=this.parent&&this.parent.insertBefore(r,this.next),r.appendChild(this),r},e.blotName="abstract",e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(12),o=r(32),a=r(33),i=r(1),s=function(){function e(e){this.attributes={},this.domNode=e,this.build()}return e.prototype.attribute=function(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])},e.prototype.build=function(){var e=this;this.attributes={};var t=n.default.keys(this.domNode),r=o.default.keys(this.domNode),s=a.default.keys(this.domNode);t.concat(r).concat(s).forEach(function(t){var r=i.query(t,i.Scope.ATTRIBUTE);r instanceof n.default&&(e.attributes[r.attrName]=r)})},e.prototype.copy=function(e){var t=this;Object.keys(this.attributes).forEach(function(r){var n=t.attributes[r].value(t.domNode);e.format(r,n)})},e.prototype.move=function(e){var t=this;this.copy(e),Object.keys(this.attributes).forEach(function(e){t.attributes[e].remove(t.domNode)}),this.attributes={}},e.prototype.values=function(){var e=this;return Object.keys(this.attributes).reduce(function(t,r){return t[r]=e.attributes[r].value(e.domNode),t},{})},e}();t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function a(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return 0===e.indexOf(t+"-")})}Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.keys=function(e){return(e.getAttribute("class")||"").split(/\s+/).map(function(e){return e.split("-").slice(0,-1).join("-")})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(this.keyName+"-"+t),!0)},t.prototype.remove=function(e){a(e,this.keyName).forEach(function(t){e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")},t.prototype.value=function(e){var t=(a(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""},t}(r(12).default);t.default=i},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function a(e){var t=e.split("-"),r=t.slice(1).map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("");return t[0]+r}Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.keys=function(e){return(e.getAttribute("style")||"").split(";").map(function(e){return e.split(":")[0].trim()})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.style[a(this.keyName)]=t,!0)},t.prototype.remove=function(e){e.style[a(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")},t.prototype.value=function(e){var t=e.style[a(this.keyName)];return this.canAdd(e,t)?t:""},t}(r(12).default);t.default=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.quill=t,this.options=r,this.modules={}}return n(e,[{key:"init",value:function(){var e=this;Object.keys(this.options.modules).forEach(function(t){null==e.modules[t]&&e.addModule(t)})}},{key:"addModule",value:function(e){var t=this.quill.constructor.import("modules/"+e);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}}]),e}();o.DEFAULTS={modules:{}},o.themes={default:o},t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=s(r(0)),i=s(r(7));function s(e){return e&&e.__esModule?e:{default:e}}var l="\ufeff",c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.contentNode=document.createElement("span"),r.contentNode.setAttribute("contenteditable",!1),[].slice.call(r.domNode.childNodes).forEach(function(e){r.contentNode.appendChild(e)}),r.leftGuard=document.createTextNode(l),r.rightGuard=document.createTextNode(l),r.domNode.appendChild(r.leftGuard),r.domNode.appendChild(r.contentNode),r.domNode.appendChild(r.rightGuard),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"index",value:function(e,r){return e===this.leftGuard?0:e===this.rightGuard?1:o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,r)}},{key:"restore",value:function(e){var t=void 0,r=void 0,n=e.data.split(l).join("");if(e===this.leftGuard)if(this.prev instanceof i.default){var o=this.prev.length();this.prev.insertAt(o,n),t={startNode:this.prev.domNode,startOffset:o+n.length}}else r=document.createTextNode(n),this.parent.insertBefore(a.default.create(r),this),t={startNode:r,startOffset:n.length};else e===this.rightGuard&&(this.next instanceof i.default?(this.next.insertAt(0,n),t={startNode:this.next.domNode,startOffset:n.length}):(r=document.createTextNode(n),this.parent.insertBefore(a.default.create(r),this.next),t={startNode:r,startOffset:n.length}));return e.data=l,t}},{key:"update",value:function(e,t){var r=this;e.forEach(function(e){if("characterData"===e.type&&(e.target===r.leftGuard||e.target===r.rightGuard)){var n=r.restore(e.target);n&&(t.range=n)}})}}]),t}(a.default.Embed);t.default=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AlignStyle=t.AlignClass=t.AlignAttribute=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i={scope:a.default.Scope.BLOCK,whitelist:["right","center","justify"]},s=new a.default.Attributor.Attribute("align","align",i),l=new a.default.Attributor.Class("align","ql-align",i),c=new a.default.Attributor.Style("align","text-align",i);t.AlignAttribute=s,t.AlignClass=l,t.AlignStyle=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundStyle=t.BackgroundClass=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i=r(26),s=new a.default.Attributor.Class("background","ql-bg",{scope:a.default.Scope.INLINE}),l=new i.ColorAttributor("background","background-color",{scope:a.default.Scope.INLINE});t.BackgroundClass=s,t.BackgroundStyle=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.DirectionStyle=t.DirectionClass=t.DirectionAttribute=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i={scope:a.default.Scope.BLOCK,whitelist:["rtl"]},s=new a.default.Attributor.Attribute("direction","dir",i),l=new a.default.Attributor.Class("direction","ql-direction",i),c=new a.default.Attributor.Style("direction","direction",i);t.DirectionAttribute=s,t.DirectionClass=l,t.DirectionStyle=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.FontClass=t.FontStyle=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l={scope:s.default.Scope.INLINE,whitelist:["serif","monospace"]},c=new s.default.Attributor.Class("font","ql-font",l),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"value",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e).replace(/["']/g,"")}}]),t}(s.default.Attributor.Style),d=new u("font","font-family",l);t.FontStyle=d,t.FontClass=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SizeStyle=t.SizeClass=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i=new a.default.Attributor.Class("size","ql-size",{scope:a.default.Scope.INLINE,whitelist:["small","large","huge"]}),s=new a.default.Attributor.Style("size","font-size",{scope:a.default.Scope.INLINE,whitelist:["10px","18px","32px"]});t.SizeClass=i,t.SizeStyle=s},function(e,t,r){e.exports={align:{"":r(76),center:r(77),right:r(78),justify:r(79)},background:r(80),blockquote:r(81),bold:r(82),clean:r(83),code:r(58),"code-block":r(58),color:r(84),direction:{"":r(85),rtl:r(86)},float:{center:r(87),full:r(88),left:r(89),right:r(90)},formula:r(91),header:{1:r(92),2:r(93)},italic:r(94),image:r(95),indent:{"+1":r(96),"-1":r(97)},link:r(98),list:{ordered:r(99),bullet:r(100),check:r(101)},script:{sub:r(102),super:r(103)},strike:r(104),underline:r(105),video:r(106)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getLastChangeIndex=t.default=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=i(r(0)),a=i(r(5));function i(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.lastRecorded=0,n.ignoreChange=!1,n.clear(),n.quill.on(a.default.events.EDITOR_CHANGE,function(e,t,r,o){e!==a.default.events.TEXT_CHANGE||n.ignoreChange||(n.options.userOnly&&o!==a.default.sources.USER?n.transform(t):n.record(t,r))}),n.quill.keyboard.addBinding({key:"Z",shortKey:!0},n.undo.bind(n)),n.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},n.redo.bind(n)),/Win/i.test(navigator.platform)&&n.quill.keyboard.addBinding({key:"Y",shortKey:!0},n.redo.bind(n)),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"change",value:function(e,t){if(0!==this.stack[e].length){var r=this.stack[e].pop();this.stack[t].push(r),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(r[e],a.default.sources.USER),this.ignoreChange=!1;var n=l(r[e]);this.quill.setSelection(n)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(e,t){if(0!==e.ops.length){this.stack.redo=[];var r=this.quill.getContents().diff(t),n=Date.now();if(this.lastRecorded+this.options.delay>n&&this.stack.undo.length>0){var o=this.stack.undo.pop();r=r.compose(o.undo),e=o.redo.compose(e)}else this.lastRecorded=n;this.stack.undo.push({redo:e,undo:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(e){this.stack.undo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)}),this.stack.redo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),t}(i(r(9)).default);function l(e){var t=e.reduce(function(e,t){return e+=t.delete||0},0),r=e.length()-t;return function(e){var t=e.ops[e.ops.length-1];return null!=t&&(null!=t.insert?"string"==typeof t.insert&&t.insert.endsWith("\n"):null!=t.attributes&&Object.keys(t.attributes).some(function(e){return null!=o.default.query(e,o.default.Scope.BLOCK)}))}(e)&&(r-=1),r}s.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},t.default=s,t.getLastChangeIndex=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BaseTooltip=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=h(r(3)),i=h(r(2)),s=h(r(8)),l=h(r(23)),c=h(r(34)),u=h(r(59)),d=h(r(60)),f=h(r(28)),p=h(r(61));function h(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var v=[!1,"center","right","justify"],b=["#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"],x=[!1,"serif","monospace"],w=["1","2","3",!1],N=["small",!1,"large","huge"],j=function(e){function t(e,r){m(this,t);var n=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return e.emitter.listenDOM("click",document.body,function t(r){if(!document.body.contains(e.root))return document.body.removeEventListener("click",t);null==n.tooltip||n.tooltip.root.contains(r.target)||document.activeElement===n.tooltip.textbox||n.quill.hasFocus()||n.tooltip.hide(),null!=n.pickers&&n.pickers.forEach(function(e){e.container.contains(r.target)||e.close()})}),n}return g(t,e),n(t,[{key:"addModule",value:function(e){var r=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addModule",this).call(this,e);return"toolbar"===e&&this.extendToolbar(r),r}},{key:"buildButtons",value:function(e,t){e.forEach(function(e){(e.getAttribute("class")||"").split(/\s+/).forEach(function(r){if(r.startsWith("ql-")&&(r=r.slice(3),null!=t[r]))if("direction"===r)e.innerHTML=t[r][""]+t[r].rtl;else if("string"==typeof t[r])e.innerHTML=t[r];else{var n=e.value||"";null!=n&&t[r][n]&&(e.innerHTML=t[r][n])}})})}},{key:"buildPickers",value:function(e,t){var r=this;this.pickers=e.map(function(e){if(e.classList.contains("ql-align"))return null==e.querySelector("option")&&k(e,v),new d.default(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){var r=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&k(e,b,"background"===r?"#ffffff":"#000000"),new u.default(e,t[r])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?k(e,x):e.classList.contains("ql-header")?k(e,w):e.classList.contains("ql-size")&&k(e,N)),new f.default(e)}),this.quill.on(s.default.events.EDITOR_CHANGE,function(){r.pickers.forEach(function(e){e.update()})})}}]),t}(c.default);j.DEFAULTS=(0,a.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var e=this,t=this.container.querySelector("input.ql-image[type=file]");null==t&&((t=document.createElement("input")).setAttribute("type","file"),t.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),t.classList.add("ql-image"),t.addEventListener("change",function(){if(null!=t.files&&null!=t.files[0]){var r=new FileReader;r.onload=function(r){var n=e.quill.getSelection(!0);e.quill.updateContents((new i.default).retain(n.index).delete(n.length).insert({image:r.target.result}),s.default.sources.USER),e.quill.setSelection(n.index+1,s.default.sources.SILENT),t.value=""},r.readAsDataURL(t.files[0])}}),this.container.appendChild(t)),t.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var _=function(e){function t(e,r){m(this,t);var n=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.textbox=n.root.querySelector('input[type="text"]'),n.listen(),n}return g(t,e),n(t,[{key:"listen",value:function(){var e=this;this.textbox.addEventListener("keydown",function(t){l.default.match(t,"enter")?(e.save(),t.preventDefault()):l.default.match(t,"escape")&&(e.cancel(),t.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+e)||""),this.root.setAttribute("data-mode",e)}},{key:"restoreFocus",value:function(){var e=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=e}},{key:"save",value:function(){var e=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var t=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,s.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,s.default.sources.USER)),this.quill.root.scrollTop=t;break;case"video":e=function(e){var 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_-]+)/);return t?(t[1]||"https")+"://www.youtube.com/embed/"+t[2]+"?showinfo=0":(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(t[1]||"https")+"://player.vimeo.com/video/"+t[2]+"/":e}(e);case"formula":if(!e)break;var r=this.quill.getSelection(!0);if(null!=r){var n=r.index+r.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,s.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",s.default.sources.USER),this.quill.setSelection(n+2,s.default.sources.USER)}}this.textbox.value="",this.hide()}}]),t}(p.default);function k(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(function(t){var n=document.createElement("option");t===r?n.setAttribute("selected","selected"):n.setAttribute("value",t),e.appendChild(n)})}t.BaseTooltip=_,t.default=j},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.head=this.tail=null,this.length=0}return e.prototype.append=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.insertBefore(e[0],null),e.length>1&&this.append.apply(this,e.slice(1))},e.prototype.contains=function(e){for(var t,r=this.iterator();t=r();)if(t===e)return!0;return!1},e.prototype.insertBefore=function(e,t){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)},e.prototype.offset=function(e){for(var t=0,r=this.head;null!=r;){if(r===e)return t;t+=r.length(),r=r.next}return-1},e.prototype.remove=function(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)},e.prototype.iterator=function(e){return void 0===e&&(e=this.head),function(){var t=e;return null!=e&&(e=e.next),t}},e.prototype.find=function(e,t){void 0===t&&(t=!1);for(var r,n=this.iterator();r=n();){var o=r.length();if(e<o||t&&e===o&&(null==r.next||0!==r.next.length()))return[r,e];e-=o}return[null,0]},e.prototype.forEach=function(e){for(var t,r=this.iterator();t=r();)e(t)},e.prototype.forEachAt=function(e,t,r){if(!(t<=0))for(var n,o=this.find(e),a=o[0],i=e-o[1],s=this.iterator(a);(n=s())&&i<e+t;){var l=n.length();e>i?r(n,e-i,Math.min(t,i+l-e)):r(n,0,Math.min(l,e+t-i)),i+=l}},e.prototype.map=function(e){return this.reduce(function(t,r){return t.push(e(r)),t},[])},e.prototype.reduce=function(e,t){for(var r,n=this.iterator();r=n();)t=e(t,r);return t},e}();t.default=n},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(17),i=r(1),s={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},l=function(e){function t(t){var r=e.call(this,t)||this;return r.scroll=r,r.observer=new MutationObserver(function(e){r.update(e)}),r.observer.observe(r.domNode,s),r.attach(),r}return o(t,e),t.prototype.detach=function(){e.prototype.detach.call(this),this.observer.disconnect()},t.prototype.deleteAt=function(t,r){this.update(),0===t&&r===this.length()?this.children.forEach(function(e){e.remove()}):e.prototype.deleteAt.call(this,t,r)},t.prototype.formatAt=function(t,r,n,o){this.update(),e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.insertAt=function(t,r,n){this.update(),e.prototype.insertAt.call(this,t,r,n)},t.prototype.optimize=function(t,r){var n=this;void 0===t&&(t=[]),void 0===r&&(r={}),e.prototype.optimize.call(this,r);for(var o=[].slice.call(this.observer.takeRecords());o.length>0;)t.push(o.pop());for(var s=function(e,t){void 0===t&&(t=!0),null!=e&&e!==n&&null!=e.domNode.parentNode&&(null==e.domNode[i.DATA_KEY].mutations&&(e.domNode[i.DATA_KEY].mutations=[]),t&&s(e.parent))},l=function(e){null!=e.domNode[i.DATA_KEY]&&null!=e.domNode[i.DATA_KEY].mutations&&(e instanceof a.default&&e.children.forEach(l),e.optimize(r))},c=t,u=0;c.length>0;u+=1){if(u>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(c.forEach(function(e){var t=i.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(s(i.find(e.previousSibling,!1)),[].forEach.call(e.addedNodes,function(e){var t=i.find(e,!1);s(t,!1),t instanceof a.default&&t.children.forEach(function(e){s(e,!1)})})):"attributes"===e.type&&s(t.prev)),s(t))}),this.children.forEach(l),o=(c=[].slice.call(this.observer.takeRecords())).slice();o.length>0;)t.push(o.pop())}},t.prototype.update=function(t,r){var n=this;void 0===r&&(r={}),(t=t||this.observer.takeRecords()).map(function(e){var t=i.find(e.target,!0);return null==t?null:null==t.domNode[i.DATA_KEY].mutations?(t.domNode[i.DATA_KEY].mutations=[e],t):(t.domNode[i.DATA_KEY].mutations.push(e),null)}).forEach(function(e){null!=e&&e!==n&&null!=e.domNode[i.DATA_KEY]&&e.update(e.domNode[i.DATA_KEY].mutations||[],r)}),null!=this.domNode[i.DATA_KEY].mutations&&e.prototype.update.call(this,this.domNode[i.DATA_KEY].mutations,r),this.optimize(t,r)},t.blotName="scroll",t.defaultChild="block",t.scope=i.Scope.BLOCK_BLOT,t.tagName="DIV",t}(a.default);t.default=l},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(18),i=r(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.formats=function(r){if(r.tagName!==t.tagName)return e.formats.call(this,r)},t.prototype.format=function(r,n){var o=this;r!==this.statics.blotName||n?e.prototype.format.call(this,r,n):(this.children.forEach(function(e){e instanceof a.default||(e=e.wrap(t.blotName,!0)),o.attributes.copy(e)}),this.unwrap())},t.prototype.formatAt=function(t,r,n,o){null!=this.formats()[n]||i.query(n,i.Scope.ATTRIBUTE)?this.isolate(t,r).format(n,o):e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.optimize=function(r){e.prototype.optimize.call(this,r);var n=this.formats();if(0===Object.keys(n).length)return this.unwrap();var o=this.next;o instanceof t&&o.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if(e[r]!==t[r])return!1;return!0}(n,o.formats())&&(o.moveChildren(this),o.remove())},t.blotName="inline",t.scope=i.Scope.INLINE_BLOT,t.tagName="SPAN",t}(a.default);t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(18),i=r(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.formats=function(r){var n=i.query(t.blotName).tagName;if(r.tagName!==n)return e.formats.call(this,r)},t.prototype.format=function(r,n){null!=i.query(r,i.Scope.BLOCK)&&(r!==this.statics.blotName||n?e.prototype.format.call(this,r,n):this.replaceWith(t.blotName))},t.prototype.formatAt=function(t,r,n,o){null!=i.query(n,i.Scope.BLOCK)?this.format(n,o):e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.insertAt=function(t,r,n){if(null==n||null!=i.query(r,i.Scope.INLINE))e.prototype.insertAt.call(this,t,r,n);else{var o=this.split(t),a=i.create(r,n);o.parent.insertBefore(a,o)}},t.prototype.update=function(t,r){navigator.userAgent.match(/Trident/)?this.build():e.prototype.update.call(this,t,r)},t.blotName="block",t.scope=i.Scope.BLOCK_BLOT,t.tagName="P",t}(a.default);t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.formats=function(e){},t.prototype.format=function(t,r){e.prototype.formatAt.call(this,0,this.length(),t,r)},t.prototype.formatAt=function(t,r,n,o){0===t&&r===this.length()?this.format(n,o):e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.formats=function(){return this.statics.formats(this.domNode)},t}(r(19).default);t.default=a},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(19),i=r(1),s=function(e){function t(t){var r=e.call(this,t)||this;return r.text=r.statics.value(r.domNode),r}return o(t,e),t.create=function(e){return document.createTextNode(e)},t.value=function(e){var t=e.data;return t.normalize&&(t=t.normalize()),t},t.prototype.deleteAt=function(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)},t.prototype.index=function(e,t){return this.domNode===e?t:-1},t.prototype.insertAt=function(t,r,n){null==n?(this.text=this.text.slice(0,t)+r+this.text.slice(t),this.domNode.data=this.text):e.prototype.insertAt.call(this,t,r,n)},t.prototype.length=function(){return this.text.length},t.prototype.optimize=function(r){e.prototype.optimize.call(this,r),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},t.prototype.position=function(e,t){return[this.domNode,e]},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var r=i.create(this.domNode.splitText(e));return this.parent.insertBefore(r,this.next),this.text=this.statics.value(this.domNode),r},t.prototype.update=function(e,t){var r=this;e.some(function(e){return"characterData"===e.type&&e.target===r.domNode})&&(this.text=this.statics.value(this.domNode))},t.prototype.value=function(){return this.text},t.blotName="text",t.scope=i.Scope.INLINE_BLOT,t}(a.default);t.default=s},function(e,t,r){var n=document.createElement("div");if(n.classList.toggle("test-class",!1),n.classList.contains("test-class")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return arguments.length>1&&!this.contains(e)==!t?t:o.call(this,e)}}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var r=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return-1!==n&&n===t}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,r=Object(this),n=r.length>>>0,o=arguments[1],a=0;a<n;a++)if(t=r[a],e.call(o,t,a,r))return t}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})},function(e,t){var r=-1;function n(e,t,l){if(e==t)return e?[[0,e]]:[];(l<0||e.length<l)&&(l=null);var u=a(e,t),d=e.substring(0,u);u=i(e=e.substring(u),t=t.substring(u));var f=e.substring(e.length-u),p=function(e,t){var s;if(!e)return[[1,t]];if(!t)return[[r,e]];var l=e.length>t.length?e:t,c=e.length>t.length?t:e,u=l.indexOf(c);if(-1!=u)return s=[[1,l.substring(0,u)],[0,c],[1,l.substring(u+c.length)]],e.length>t.length&&(s[0][0]=s[2][0]=r),s;if(1==c.length)return[[r,e],[1,t]];var d=function(e,t){var r=e.length>t.length?e:t,n=e.length>t.length?t:e;if(r.length<4||2*n.length<r.length)return null;function o(e,t,r){for(var n,o,s,l,c=e.substring(r,r+Math.floor(e.length/4)),u=-1,d="";-1!=(u=t.indexOf(c,u+1));){var f=a(e.substring(r),t.substring(u)),p=i(e.substring(0,r),t.substring(0,u));d.length<p+f&&(d=t.substring(u-p,u)+t.substring(u,u+f),n=e.substring(0,r-p),o=e.substring(r+f),s=t.substring(0,u-p),l=t.substring(u+f))}return 2*d.length>=e.length?[n,o,s,l,d]:null}var s,l,c,u,d,f=o(r,n,Math.ceil(r.length/4)),p=o(r,n,Math.ceil(r.length/2));if(!f&&!p)return null;s=p?f&&f[4].length>p[4].length?f:p:f,e.length>t.length?(l=s[0],c=s[1],u=s[2],d=s[3]):(u=s[0],d=s[1],l=s[2],c=s[3]);var h=s[4];return[l,c,u,d,h]}(e,t);if(d){var f=d[0],p=d[1],h=d[2],m=d[3],y=d[4],g=n(f,h),v=n(p,m);return g.concat([[0,y]],v)}return function(e,t){for(var n=e.length,a=t.length,i=Math.ceil((n+a)/2),s=i,l=2*i,c=new Array(l),u=new Array(l),d=0;d<l;d++)c[d]=-1,u[d]=-1;c[s+1]=0,u[s+1]=0;for(var f=n-a,p=f%2!=0,h=0,m=0,y=0,g=0,v=0;v<i;v++){for(var b=-v+h;b<=v-m;b+=2){for(var x=s+b,w=(O=b==-v||b!=v&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-b;O<n&&w<a&&e.charAt(O)==t.charAt(w);)O++,w++;if(c[x]=O,O>n)m+=2;else if(w>a)h+=2;else if(p&&(_=s+f-b)>=0&&_<l&&-1!=u[_]&&O>=(j=n-u[_]))return o(e,t,O,w)}for(var N=-v+y;N<=v-g;N+=2){for(var j,_=s+N,k=(j=N==-v||N!=v&&u[_-1]<u[_+1]?u[_+1]:u[_-1]+1)-N;j<n&&k<a&&e.charAt(n-j-1)==t.charAt(a-k-1);)j++,k++;if(u[_]=j,j>n)g+=2;else if(k>a)y+=2;else if(!p){var O;if((x=s+f-N)>=0&&x<l&&-1!=c[x]&&(w=s+(O=c[x])-x,O>=(j=n-j)))return o(e,t,O,w)}}}return[[r,e],[1,t]]}(e,t)}(e=e.substring(0,e.length-u),t=t.substring(0,t.length-u));return d&&p.unshift([0,d]),f&&p.push([0,f]),s(p),null!=l&&(p=function(e,t){var n=function(e,t){if(0===t)return[0,e];for(var n=0,o=0;o<e.length;o++){var a=e[o];if(a[0]===r||0===a[0]){var i=n+a[1].length;if(t===i)return[o+1,e];if(t<i){e=e.slice();var s=t-n,l=[a[0],a[1].slice(0,s)],c=[a[0],a[1].slice(s)];return e.splice(o,1,l,c),[o+1,e]}n=i}}throw new Error("cursor_pos is out of bounds!")}(e,t),o=n[1],a=n[0],i=o[a],s=o[a+1];if(null==i)return e;if(0!==i[0])return e;if(null!=s&&i[1]+s[1]===s[1]+i[1])return o.splice(a,2,s,i),c(o,a,2);if(null!=s&&0===s[1].indexOf(i[1])){o.splice(a,2,[s[0],i[1]],[0,i[1]]);var l=s[1].slice(i[1].length);return l.length>0&&o.splice(a+2,0,[s[0],l]),c(o,a,3)}return e}(p,l)),p=function(e){for(var t=!1,n=function(e){return e.charCodeAt(0)>=56320&&e.charCodeAt(0)<=57343},o=function(e){return e.charCodeAt(e.length-1)>=55296&&e.charCodeAt(e.length-1)<=56319},a=2;a<e.length;a+=1)0===e[a-2][0]&&o(e[a-2][1])&&e[a-1][0]===r&&n(e[a-1][1])&&1===e[a][0]&&n(e[a][1])&&(t=!0,e[a-1][1]=e[a-2][1].slice(-1)+e[a-1][1],e[a][1]=e[a-2][1].slice(-1)+e[a][1],e[a-2][1]=e[a-2][1].slice(0,-1));if(!t)return e;var i=[];for(a=0;a<e.length;a+=1)e[a][1].length>0&&i.push(e[a]);return i}(p)}function o(e,t,r,o){var a=e.substring(0,r),i=t.substring(0,o),s=e.substring(r),l=t.substring(o),c=n(a,i),u=n(s,l);return c.concat(u)}function a(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var r=0,n=Math.min(e.length,t.length),o=n,a=0;r<o;)e.substring(a,o)==t.substring(a,o)?a=r=o:n=o,o=Math.floor((n-r)/2+r);return o}function i(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var r=0,n=Math.min(e.length,t.length),o=n,a=0;r<o;)e.substring(e.length-o,e.length-a)==t.substring(t.length-o,t.length-a)?a=r=o:n=o,o=Math.floor((n-r)/2+r);return o}function s(e){e.push([0,""]);for(var t,n=0,o=0,l=0,c="",u="";n<e.length;)switch(e[n][0]){case 1:l++,u+=e[n][1],n++;break;case r:o++,c+=e[n][1],n++;break;case 0:o+l>1?(0!==o&&0!==l&&(0!==(t=a(u,c))&&(n-o-l>0&&0==e[n-o-l-1][0]?e[n-o-l-1][1]+=u.substring(0,t):(e.splice(0,0,[0,u.substring(0,t)]),n++),u=u.substring(t),c=c.substring(t)),0!==(t=i(u,c))&&(e[n][1]=u.substring(u.length-t)+e[n][1],u=u.substring(0,u.length-t),c=c.substring(0,c.length-t))),0===o?e.splice(n-l,o+l,[1,u]):0===l?e.splice(n-o,o+l,[r,c]):e.splice(n-o-l,o+l,[r,c],[1,u]),n=n-o-l+(o?1:0)+(l?1:0)+1):0!==n&&0==e[n-1][0]?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,l=0,o=0,c="",u=""}""===e[e.length-1][1]&&e.pop();var d=!1;for(n=1;n<e.length-1;)0==e[n-1][0]&&0==e[n+1][0]&&(e[n][1].substring(e[n][1].length-e[n-1][1].length)==e[n-1][1]?(e[n][1]=e[n-1][1]+e[n][1].substring(0,e[n][1].length-e[n-1][1].length),e[n+1][1]=e[n-1][1]+e[n+1][1],e.splice(n-1,1),d=!0):e[n][1].substring(0,e[n+1][1].length)==e[n+1][1]&&(e[n-1][1]+=e[n+1][1],e[n][1]=e[n][1].substring(e[n+1][1].length)+e[n+1][1],e.splice(n+1,1),d=!0)),n++;d&&s(e)}var l=n;function c(e,t,r){for(var n=t+r-1;n>=0&&n>=t-1;n--)if(n+1<e.length){var o=e[n],a=e[n+1];o[0]===a[1]&&e.splice(n,2,[o[0],o[1]+a[1]])}return e}l.INSERT=1,l.DELETE=r,l.EQUAL=0,e.exports=l},function(e,t){function r(e){var t=[];for(var r in e)t.push(r);return t}(e.exports="function"==typeof Object.keys?Object.keys:r).shim=r},function(e,t){var r="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function o(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}(t=e.exports=r?n:o).supported=n,t.unsupported=o},function(e,t){var r=Object.prototype.hasOwnProperty,n="~";function o(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,t,o=[];if(0===this._eventsCount)return o;for(t in e=this._events)r.call(e,t)&&o.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},i.prototype.listeners=function(e,t){var r=n?n+e:e,o=this._events[r];if(t)return!!o;if(!o)return[];if(o.fn)return[o.fn];for(var a=0,i=o.length,s=new Array(i);a<i;a++)s[a]=o[a].fn;return s},i.prototype.emit=function(e,t,r,o,a,i){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],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,o),!0;case 5:return u.fn.call(u.context,t,r,o,a),!0;case 6:return u.fn.call(u.context,t,r,o,a,i),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,p=u.length;for(c=0;c<p;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,o);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},i.prototype.on=function(e,t,r){var o=new a(t,r||this),i=n?n+e:e;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):(this._events[i]=o,this._eventsCount++),this},i.prototype.once=function(e,t,r){var o=new a(t,r||this,!0),i=n?n+e:e;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):(this._events[i]=o,this._eventsCount++),this},i.prototype.removeListener=function(e,t,r,a){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return 0===--this._eventsCount?this._events=new o:delete this._events[i],this;var s=this._events[i];if(s.fn)s.fn!==t||a&&!s.once||r&&s.context!==r||(0===--this._eventsCount?this._events=new o:delete this._events[i]);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||a&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[i]=1===c.length?c[0]:c:0===--this._eventsCount?this._events=new o:delete this._events[i]}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&(0===--this._eventsCount?this._events=new o:delete this._events[t])):(this._events=new o,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.prefixed=n,i.EventEmitter=i,void 0!==e&&(e.exports=i)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.matchText=t.matchSpacing=t.matchNewline=t.matchBlot=t.matchAttributor=t.default=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=b(r(3)),s=b(r(2)),l=b(r(0)),c=b(r(5)),u=b(r(10)),d=b(r(9)),f=r(36),p=r(37),h=b(r(13)),m=r(26),y=r(38),g=r(39),v=r(40);function b(e){return e&&e.__esModule?e:{default:e}}function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var w=(0,u.default)("quill:clipboard"),N="__ql-matcher",j=[[Node.TEXT_NODE,M],[Node.TEXT_NODE,L],["br",function(e,t){return A(t,"\n")||t.insert("\n"),t}],[Node.ELEMENT_NODE,L],[Node.ELEMENT_NODE,R],[Node.ELEMENT_NODE,I],[Node.ELEMENT_NODE,q],[Node.ELEMENT_NODE,function(e,t){var r={},n=e.style||{};return n.fontStyle&&"italic"===S(e).fontStyle&&(r.italic=!0),n.fontWeight&&(S(e).fontWeight.startsWith("bold")||parseInt(S(e).fontWeight)>=700)&&(r.bold=!0),Object.keys(r).length>0&&(t=E(t,r)),parseFloat(n.textIndent||0)>0&&(t=(new s.default).insert("\t").concat(t)),t}],["li",function(e,t){var r=l.default.query(e);if(null==r||"list-item"!==r.blotName||!A(t,"\n"))return t;for(var n=-1,o=e.parentNode;!o.classList.contains("ql-clipboard");)"list"===(l.default.query(o)||{}).blotName&&(n+=1),o=o.parentNode;return n<=0?t:t.compose((new s.default).retain(t.length()-1).retain(1,{indent:n}))}],["b",P.bind(P,"bold")],["i",P.bind(P,"italic")],["style",function(){return new s.default}]],_=[f.AlignAttribute,y.DirectionAttribute].reduce(function(e,t){return e[t.keyName]=t,e},{}),k=[f.AlignStyle,p.BackgroundStyle,m.ColorStyle,y.DirectionStyle,g.FontStyle,v.SizeStyle].reduce(function(e,t){return e[t.keyName]=t,e},{}),O=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.root.addEventListener("paste",n.onPaste.bind(n)),n.container=n.quill.addContainer("ql-clipboard"),n.container.setAttribute("contenteditable",!0),n.container.setAttribute("tabindex",-1),n.matchers=[],j.concat(n.options.matchers).forEach(function(e){var t=o(e,2),a=t[0],i=t[1];(r.matchVisual||i!==I)&&n.addMatcher(a,i)}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"addMatcher",value:function(e,t){this.matchers.push([e,t])}},{key:"convert",value:function(e){if("string"==typeof e)return this.container.innerHTML=e.replace(/\>\r?\n +\</g,"><"),this.convert();var t=this.quill.getFormat(this.quill.selection.savedRange.index);if(t[h.default.blotName]){var r=this.container.innerText;return this.container.innerHTML="",(new s.default).insert(r,x({},h.default.blotName,t[h.default.blotName]))}var n=this.prepareMatching(),a=o(n,2),i=a[0],l=a[1],c=C(this.container,i,l);return A(c,"\n")&&null==c.ops[c.ops.length-1].attributes&&(c=c.compose((new s.default).retain(c.length()-1).delete(1))),w.log("convert",this.container.innerHTML,c),this.container.innerHTML="",c}},{key:"dangerouslyPasteHTML",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.default.sources.API;if("string"==typeof e)this.quill.setContents(this.convert(e),t),this.quill.setSelection(0,c.default.sources.SILENT);else{var n=this.convert(t);this.quill.updateContents((new s.default).retain(e).concat(n),r),this.quill.setSelection(e+n.length(),c.default.sources.SILENT)}}},{key:"onPaste",value:function(e){var t=this;if(!e.defaultPrevented&&this.quill.isEnabled()){var r=this.quill.getSelection(),n=(new s.default).retain(r.index),o=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(c.default.sources.SILENT),setTimeout(function(){n=n.concat(t.convert()).delete(r.length),t.quill.updateContents(n,c.default.sources.USER),t.quill.setSelection(n.length()-r.length,c.default.sources.SILENT),t.quill.scrollingContainer.scrollTop=o,t.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var e=this,t=[],r=[];return this.matchers.forEach(function(n){var a=o(n,2),i=a[0],s=a[1];switch(i){case Node.TEXT_NODE:r.push(s);break;case Node.ELEMENT_NODE:t.push(s);break;default:[].forEach.call(e.container.querySelectorAll(i),function(e){e[N]=e[N]||[],e[N].push(s)})}}),[t,r]}}]),t}(d.default);function E(e,t,r){return"object"===(void 0===t?"undefined":n(t))?Object.keys(t).reduce(function(e,r){return E(e,r,t[r])},e):e.reduce(function(e,n){return n.attributes&&n.attributes[t]?e.push(n):e.insert(n.insert,(0,i.default)({},x({},t,r),n.attributes))},new s.default)}function S(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};var t="__ql-computed-style";return e[t]||(e[t]=window.getComputedStyle(e))}function A(e,t){for(var r="",n=e.ops.length-1;n>=0&&r.length<t.length;--n){var o=e.ops[n];if("string"!=typeof o.insert)break;r=o.insert+r}return r.slice(-1*t.length)===t}function T(e){if(0===e.childNodes.length)return!1;var t=S(e);return["block","list-item"].indexOf(t.display)>-1}function C(e,t,r){return e.nodeType===e.TEXT_NODE?r.reduce(function(t,r){return r(e,t)},new s.default):e.nodeType===e.ELEMENT_NODE?[].reduce.call(e.childNodes||[],function(n,o){var a=C(o,t,r);return o.nodeType===e.ELEMENT_NODE&&(a=t.reduce(function(e,t){return t(o,e)},a),a=(o[N]||[]).reduce(function(e,t){return t(o,e)},a)),n.concat(a)},new s.default):new s.default}function P(e,t,r){return E(r,e,!0)}function q(e,t){var r=l.default.Attributor.Attribute.keys(e),n=l.default.Attributor.Class.keys(e),o=l.default.Attributor.Style.keys(e),a={};return r.concat(n).concat(o).forEach(function(t){var r=l.default.query(t,l.default.Scope.ATTRIBUTE);null!=r&&(a[r.attrName]=r.value(e),a[r.attrName])||(null==(r=_[t])||r.attrName!==t&&r.keyName!==t||(a[r.attrName]=r.value(e)||void 0),null==(r=k[t])||r.attrName!==t&&r.keyName!==t||(r=k[t],a[r.attrName]=r.value(e)||void 0))}),Object.keys(a).length>0&&(t=E(t,a)),t}function R(e,t){var r=l.default.query(e);if(null==r)return t;if(r.prototype instanceof l.default.Embed){var n={},o=r.value(e);null!=o&&(n[r.blotName]=o,t=(new s.default).insert(n,r.formats(e)))}else"function"==typeof r.formats&&(t=E(t,r.blotName,r.formats(e)));return t}function L(e,t){return A(t,"\n")||(T(e)||t.length()>0&&e.nextSibling&&T(e.nextSibling))&&t.insert("\n"),t}function I(e,t){if(T(e)&&null!=e.nextElementSibling&&!A(t,"\n\n")){var r=e.offsetHeight+parseFloat(S(e).marginTop)+parseFloat(S(e).marginBottom);e.nextElementSibling.offsetTop>e.offsetTop+1.5*r&&t.insert("\n")}return t}function M(e,t){var r=e.data;if("O:P"===e.parentNode.tagName)return t.insert(r.trim());if(0===r.trim().length&&e.parentNode.classList.contains("ql-clipboard"))return t;if(!S(e.parentNode).whiteSpace.startsWith("pre")){var n=function(e,t){return(t=t.replace(/[^\u00a0]/g,"")).length<1&&e?" ":t};r=(r=r.replace(/\r\n/g," ").replace(/\n/g," ")).replace(/\s\s+/g,n.bind(n,!0)),(null==e.previousSibling&&T(e.parentNode)||null!=e.previousSibling&&T(e.previousSibling))&&(r=r.replace(/^\s+/,n.bind(n,!1))),(null==e.nextSibling&&T(e.parentNode)||null!=e.nextSibling&&T(e.nextSibling))&&(r=r.replace(/\s+$/,n.bind(n,!1)))}return t.insert(r)}O.DEFAULTS={matchers:[],matchVisual:!0},t.default=O,t.matchAttributor=q,t.matchBlot=R,t.matchNewline=L,t.matchSpacing=I,t.matchText=M},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(6),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"optimize",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);s.blotName="bold",s.tagName=["STRONG","B"],t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.addControls=t.default=void 0;var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=u(r(2)),i=u(r(0)),s=u(r(5)),l=u(r(10)),c=u(r(9));function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var f=(0,l.default)("quill:toolbar"),p=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o,a=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));if(Array.isArray(a.options.container)){var i=document.createElement("div");m(i,a.options.container),e.container.parentNode.insertBefore(i,e.container),a.container=i}else"string"==typeof a.options.container?a.container=document.querySelector(a.options.container):a.container=a.options.container;return a.container instanceof HTMLElement?(a.container.classList.add("ql-toolbar"),a.controls=[],a.handlers={},Object.keys(a.options.handlers).forEach(function(e){a.addHandler(e,a.options.handlers[e])}),[].forEach.call(a.container.querySelectorAll("button, select"),function(e){a.attach(e)}),a.quill.on(s.default.events.EDITOR_CHANGE,function(e,t){e===s.default.events.SELECTION_CHANGE&&a.update(t)}),a.quill.on(s.default.events.SCROLL_OPTIMIZE,function(){var e=a.quill.selection.getRange(),t=n(e,1)[0];a.update(t)}),a):(o=f.error("Container required for toolbar",a.options),d(a,o))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"addHandler",value:function(e,t){this.handlers[e]=t}},{key:"attach",value:function(e){var t=this,r=[].find.call(e.classList,function(e){return 0===e.indexOf("ql-")});if(r){if(r=r.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[r]){if(null!=this.quill.scroll.whitelist&&null==this.quill.scroll.whitelist[r])return void f.warn("ignoring attaching to disabled format",r,e);if(null==i.default.query(r))return void f.warn("ignoring attaching to nonexistent format",r,e)}var o="SELECT"===e.tagName?"change":"click";e.addEventListener(o,function(o){var l=void 0;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;var c=e.options[e.selectedIndex];l=!c.hasAttribute("selected")&&(c.value||!1)}else l=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),o.preventDefault();t.quill.focus();var u=t.quill.selection.getRange(),d=n(u,1)[0];if(null!=t.handlers[r])t.handlers[r].call(t,l);else if(i.default.query(r).prototype instanceof i.default.Embed){if(!(l=prompt("Enter "+r)))return;t.quill.updateContents((new a.default).retain(d.index).delete(d.length).insert(function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},r,l)),s.default.sources.USER)}else t.quill.format(r,l,s.default.sources.USER);t.update(d)}),this.controls.push([r,e])}}},{key:"update",value:function(e){var t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(function(r){var o=n(r,2),a=o[0],i=o[1];if("SELECT"===i.tagName){var s=void 0;if(null==e)s=null;else if(null==t[a])s=i.querySelector("option[selected]");else if(!Array.isArray(t[a])){var l=t[a];"string"==typeof l&&(l=l.replace(/\"/g,'\\"')),s=i.querySelector('option[value="'+l+'"]')}null==s?(i.value="",i.selectedIndex=-1):s.selected=!0}else if(null==e)i.classList.remove("ql-active");else if(i.hasAttribute("value")){var c=t[a]===i.getAttribute("value")||null!=t[a]&&t[a].toString()===i.getAttribute("value")||null==t[a]&&!i.getAttribute("value");i.classList.toggle("ql-active",c)}else i.classList.toggle("ql-active",null!=t[a])})}}]),t}(c.default);function h(e,t,r){var n=document.createElement("button");n.setAttribute("type","button"),n.classList.add("ql-"+t),null!=r&&(n.value=r),e.appendChild(n)}function m(e,t){Array.isArray(t[0])||(t=[t]),t.forEach(function(t){var r=document.createElement("span");r.classList.add("ql-formats"),t.forEach(function(e){if("string"==typeof e)h(r,e);else{var t=Object.keys(e)[0],n=e[t];Array.isArray(n)?function(e,t,r){var n=document.createElement("select");n.classList.add("ql-"+t),r.forEach(function(e){var t=document.createElement("option");!1!==e?t.setAttribute("value",e):t.setAttribute("selected","selected"),n.appendChild(t)}),e.appendChild(n)}(r,t,n):h(r,t,n)}}),e.appendChild(r)})}p.DEFAULTS={},p.DEFAULTS={container:null,handlers:{clean:function(){var e=this,t=this.quill.getSelection();if(null!=t)if(0==t.length){var r=this.quill.getFormat();Object.keys(r).forEach(function(t){null!=i.default.query(t,i.default.Scope.INLINE)&&e.quill.format(t,!1)})}else this.quill.removeFormat(t,s.default.sources.USER)},direction:function(e){var t=this.quill.getFormat().align;"rtl"===e&&null==t?this.quill.format("align","right",s.default.sources.USER):e||"right"!==t||this.quill.format("align",!1,s.default.sources.USER),this.quill.format("direction",e,s.default.sources.USER)},indent:function(e){var t=this.quill.getSelection(),r=this.quill.getFormat(t),n=parseInt(r.indent||0);if("+1"===e||"-1"===e){var o="+1"===e?1:-1;"rtl"===r.direction&&(o*=-1),this.quill.format("indent",n+o,s.default.sources.USER)}},link:function(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,s.default.sources.USER)},list:function(e){var t=this.quill.getSelection(),r=this.quill.getFormat(t);"check"===e?"checked"===r.list||"unchecked"===r.list?this.quill.format("list",!1,s.default.sources.USER):this.quill.format("list","unchecked",s.default.sources.USER):this.quill.format("list",e,s.default.sources.USER)}}},t.default=p,t.addControls=m},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(28),s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.label.innerHTML=r,n.container.classList.add("ql-color-picker"),[].slice.call(n.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(e){e.classList.add("ql-primary")}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"buildItem",value:function(e){var r=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"buildItem",this).call(this,e);return r.style.backgroundColor=e.getAttribute("value")||"",r}},{key:"selectItem",value:function(e,r){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,r);var n=this.label.querySelector(".ql-color-label"),o=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=o:n.style.fill=o)}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(28),s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.container.classList.add("ql-icon-picker"),[].forEach.call(n.container.querySelectorAll(".ql-picker-item"),function(e){e.innerHTML=r[e.getAttribute("data-value")||""]}),n.defaultItem=n.container.querySelector(".ql-selected"),n.selectItem(n.defaultItem),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"selectItem",value:function(e,r){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,r),e=e||this.defaultItem,this.label.innerHTML=e.innerHTML}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(){function e(t,r){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.quill=t,this.boundsContainer=r||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){n.root.style.marginTop=-1*n.quill.root.scrollTop+"px"}),this.hide()}return n(e,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(e){var t=e.left+e.width/2-this.root.offsetWidth/2,r=e.bottom+this.quill.root.scrollTop;this.root.style.left=t+"px",this.root.style.top=r+"px",this.root.classList.remove("ql-flip");var n=this.boundsContainer.getBoundingClientRect(),o=this.root.getBoundingClientRect(),a=0;if(o.right>n.right&&(a=n.right-o.right,this.root.style.left=t+a+"px"),o.left<n.left&&(a=n.left-o.left,this.root.style.left=t+a+"px"),o.bottom>n.bottom){var i=o.bottom-o.top,s=e.bottom-e.top+i;this.root.style.top=r-s+"px",this.root.classList.add("ql-flip")}return a}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=p(r(3)),s=p(r(8)),l=r(43),c=p(l),u=p(r(27)),d=r(15),f=p(r(41));function p(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var g=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],v=function(e){function t(e,r){h(this,t),null!=r.modules.toolbar&&null==r.modules.toolbar.container&&(r.modules.toolbar.container=g);var n=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.container.classList.add("ql-snow"),n}return y(t,e),a(t,[{key:"extendToolbar",value:function(e){e.container.classList.add("ql-snow"),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),f.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),f.default),this.tooltip=new b(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(t,r){e.handlers.link.call(e,!r.format.link)})}}]),t}(c.default);v.DEFAULTS=(0,i.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){if(e){var t=this.quill.getSelection();if(null==t||0==t.length)return;var r=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(r)&&0!==r.indexOf("mailto:")&&(r="mailto:"+r),this.quill.theme.tooltip.edit("link",r)}else this.quill.format("link",!1)}}}}});var b=function(e){function t(e,r){h(this,t);var n=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.preview=n.root.querySelector("a.ql-preview"),n}return y(t,e),a(t,[{key:"listen",value:function(){var e=this;o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(t){e.root.classList.contains("ql-editing")?e.save():e.edit("link",e.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(t){if(null!=e.linkRange){var r=e.linkRange;e.restoreFocus(),e.quill.formatText(r,"link",!1,s.default.sources.USER),delete e.linkRange}t.preventDefault(),e.hide()}),this.quill.on(s.default.events.SELECTION_CHANGE,function(t,r,o){if(null!=t){if(0===t.length&&o===s.default.sources.USER){var a=e.quill.scroll.descendant(u.default,t.index),i=n(a,2),l=i[0],c=i[1];if(null!=l){e.linkRange=new d.Range(t.index-c,l.length());var f=u.default.formats(l.domNode);return e.preview.textContent=f,e.preview.setAttribute("href",f),e.show(),void e.position(e.quill.getBounds(e.linkRange))}}else delete e.linkRange;e.hide()}})}},{key:"show",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),t}(l.BaseTooltip);b.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(""),t.default=v},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=L(r(29)),o=r(36),a=r(38),i=r(64),s=L(r(65)),l=L(r(66)),c=r(67),u=L(c),d=r(37),f=r(26),p=r(39),h=r(40),m=L(r(56)),y=L(r(68)),g=L(r(27)),v=L(r(69)),b=L(r(70)),x=L(r(71)),w=L(r(72)),N=L(r(73)),j=r(13),_=L(j),k=L(r(74)),O=L(r(75)),E=L(r(57)),S=L(r(41)),A=L(r(28)),T=L(r(59)),C=L(r(60)),P=L(r(61)),q=L(r(108)),R=L(r(62));function L(e){return e&&e.__esModule?e:{default:e}}n.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":o.AlignClass,"attributors/class/background":d.BackgroundClass,"attributors/class/color":f.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":p.FontClass,"attributors/class/size":h.SizeClass,"attributors/style/align":o.AlignStyle,"attributors/style/background":d.BackgroundStyle,"attributors/style/color":f.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":p.FontStyle,"attributors/style/size":h.SizeStyle},!0),n.default.register({"formats/align":o.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":i.IndentClass,"formats/background":d.BackgroundStyle,"formats/color":f.ColorStyle,"formats/font":p.FontClass,"formats/size":h.SizeClass,"formats/blockquote":s.default,"formats/code-block":_.default,"formats/header":l.default,"formats/list":u.default,"formats/bold":m.default,"formats/code":j.Code,"formats/italic":y.default,"formats/link":g.default,"formats/script":v.default,"formats/strike":b.default,"formats/underline":x.default,"formats/image":w.default,"formats/video":N.default,"formats/list/item":c.ListItem,"modules/formula":k.default,"modules/syntax":O.default,"modules/toolbar":E.default,"themes/bubble":q.default,"themes/snow":R.default,"ui/icons":S.default,"ui/picker":A.default,"ui/icon-picker":C.default,"ui/color-picker":T.default,"ui/tooltip":P.default},!0),t.default=n.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.IndentClass=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"add",value:function(e,r){if("+1"===r||"-1"===r){var n=this.value(e)||0;r="+1"===r?n+1:n-1}return 0===r?(this.remove(e),!0):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"add",this).call(this,e,r)}},{key:"canAdd",value:function(e,r){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,r)||a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,parseInt(r))}},{key:"value",value:function(e){return parseInt(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e))||void 0}}]),t}(s.default.Attributor.Class),c=new l("indent","ql-indent",{scope:s.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});t.IndentClass=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(4),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="blockquote",a.tagName="blockquote",t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(4),i=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,null,[{key:"formats",value:function(e){return this.tagName.indexOf(e.tagName)+1}}]),t}(((n=a)&&n.__esModule?n:{default:n}).default);i.blotName="header",i.tagName=["H1","H2","H3","H4","H5","H6"],t.default=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ListItem=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=l(r(0)),i=l(r(4)),s=l(r(25));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),n(t,[{key:"format",value:function(e,r){e!==p.blotName||r?o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r):this.replaceWith(a.default.create(this.statics.scope))}},{key:"remove",value:function(){null==this.prev&&null==this.next?this.parent.remove():o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(e,r){return this.parent.isolate(this.offset(this.parent),this.length()),e===this.parent.statics.blotName?(this.parent.replaceWith(e,r),this):(this.parent.unwrap(),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e,r))}}],[{key:"formats",value:function(e){return e.tagName===this.tagName?void 0:o(t.__proto__||Object.getPrototypeOf(t),"formats",this).call(this,e)}}]),t}(i.default);f.blotName="list-item",f.tagName="LI";var p=function(e){function t(e){c(this,t);var r=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=function(t){if(t.target.parentNode===e){var n=r.statics.formats(e),o=a.default.find(t.target);"checked"===n?o.format("list","unchecked"):"unchecked"===n&&o.format("list","checked")}};return e.addEventListener("touchstart",n),e.addEventListener("mousedown",n),r}return d(t,e),n(t,null,[{key:"create",value:function(e){var r="ordered"===e?"OL":"UL",n=o(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,r);return"checked"!==e&&"unchecked"!==e||n.setAttribute("data-checked","checked"===e),n}},{key:"formats",value:function(e){return"OL"===e.tagName?"ordered":"UL"===e.tagName?e.hasAttribute("data-checked")?"true"===e.getAttribute("data-checked")?"checked":"unchecked":"bullet":void 0}}]),n(t,[{key:"format",value:function(e,t){this.children.length>0&&this.children.tail.format(e,t)}},{key:"formats",value:function(){return e={},t=this.statics.blotName,r=this.statics.formats(this.domNode),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;var e,t,r}},{key:"insertBefore",value:function(e,r){if(e instanceof f)o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,r);else{var n=null==r?this.length():r.offset(this),a=this.split(n);a.parent.insertBefore(e,a)}}},{key:"optimize",value:function(e){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&r.domNode.tagName===this.domNode.tagName&&r.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(r.moveChildren(this),r.remove())}},{key:"replace",value:function(e){if(e.statics.blotName!==this.statics.blotName){var r=a.default.create(this.statics.defaultChild);e.moveChildren(r),this.appendChild(r)}o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e)}}]),t}(s.default);p.blotName="list",p.scope=a.default.Scope.BLOCK_BLOT,p.tagName=["OL","UL"],p.defaultChild="list-item",p.allowedChildren=[f],t.ListItem=f,t.default=p},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(56),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="italic",a.tagName=["EM","I"],t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(6),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,null,[{key:"create",value:function(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e)}},{key:"formats",value:function(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);s.blotName="script",s.tagName=["SUB","SUP"],t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(6),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="strike",a.tagName="S",t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(6),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="underline",a.tagName="U",t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l=r(27),c=["alt","height","width"],u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"format",value:function(e,r){c.indexOf(e)>-1?r?this.domNode.setAttribute(e,r):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r)}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&r.setAttribute("src",this.sanitize(e)),r}},{key:"formats",value:function(e){return c.reduce(function(t,r){return e.hasAttribute(r)&&(t[r]=e.getAttribute(r)),t},{})}},{key:"match",value:function(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}},{key:"sanitize",value:function(e){return(0,l.sanitize)(e,["http","https","data"])?e:"//:0"}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(s.default.Embed);u.blotName="image",u.tagName="IMG",t.default=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(4),s=r(27),l=(n=s)&&n.__esModule?n:{default:n},c=["height","width"],u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"format",value:function(e,r){c.indexOf(e)>-1?r?this.domNode.setAttribute(e,r):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r)}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen",!0),r.setAttribute("src",this.sanitize(e)),r}},{key:"formats",value:function(e){return c.reduce(function(t,r){return e.hasAttribute(r)&&(t[r]=e.getAttribute(r)),t},{})}},{key:"sanitize",value:function(e){return l.default.sanitize(e)}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(i.BlockEmbed);u.blotName="video",u.className="ql-video",u.tagName="IFRAME",t.default=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FormulaBlot=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=l(r(35)),i=l(r(5)),s=l(r(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),n(t,null,[{key:"create",value:function(e){var r=o(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&(window.katex.render(e,r,{throwOnError:!1,errorColor:"#f00"}),r.setAttribute("data-value",e)),r}},{key:"value",value:function(e){return e.getAttribute("data-value")}}]),t}(a.default);f.blotName="formula",f.className="ql-formula",f.tagName="SPAN";var p=function(e){function t(){c(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(null==window.katex)throw new Error("Formula module requires KaTeX.");return e}return d(t,e),n(t,null,[{key:"register",value:function(){i.default.register(f,!0)}}]),t}(s.default);t.FormulaBlot=f,t.default=p},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.CodeToken=t.CodeBlock=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=l(r(0)),i=l(r(5)),s=l(r(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),n(t,[{key:"replaceWith",value:function(e){this.domNode.textContent=this.domNode.textContent,this.attach(),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e)}},{key:"highlight",value:function(e){var t=this.domNode.textContent;this.cachedText!==t&&((t.trim().length>0||null==this.cachedText)&&(this.domNode.innerHTML=e(t),this.domNode.normalize(),this.attach()),this.cachedText=t)}}]),t}(l(r(13)).default);f.className="ql-syntax";var p=new a.default.Attributor.Class("token","hljs",{scope:a.default.Scope.INLINE}),h=function(e){function t(e,r){c(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));if("function"!=typeof n.options.highlight)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var o=null;return n.quill.on(i.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(o),o=setTimeout(function(){n.highlight(),o=null},n.options.interval)}),n.highlight(),n}return d(t,e),n(t,null,[{key:"register",value:function(){i.default.register(p,!0),i.default.register(f,!0)}}]),n(t,[{key:"highlight",value:function(){var e=this;if(!this.quill.selection.composing){this.quill.update(i.default.sources.USER);var t=this.quill.getSelection();this.quill.scroll.descendants(f).forEach(function(t){t.highlight(e.options.highlight)}),this.quill.update(i.default.sources.SILENT),null!=t&&this.quill.setSelection(t,i.default.sources.SILENT)}}}]),t}(s.default);h.DEFAULTS={highlight:null==window.hljs?null:function(e){return window.hljs.highlightAuto(e).value},interval:1e3},t.CodeBlock=f,t.CodeToken=p,t.default=h},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<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"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <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"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'},function(e,t){e.exports='<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> <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></path> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'},function(e,t){e.exports='<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></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <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></path> </svg>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <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> <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></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <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> <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> <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></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <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> <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></path> </svg>'},function(e,t){e.exports='<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></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BubbleTooltip=void 0;var n=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=d(r(3)),i=d(r(8)),s=r(43),l=d(s),c=r(15),u=d(r(41));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],y=function(e){function t(e,r){f(this,t),null!=r.modules.toolbar&&null==r.modules.toolbar.container&&(r.modules.toolbar.container=m);var n=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.container.classList.add("ql-bubble"),n}return h(t,e),o(t,[{key:"extendToolbar",value:function(e){this.tooltip=new g(this.quill,this.options.bounds),this.tooltip.root.appendChild(e.container),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),u.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),u.default)}}]),t}(l.default);y.DEFAULTS=(0,a.default)(!0,{},l.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var g=function(e){function t(e,r){f(this,t);var n=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.on(i.default.events.EDITOR_CHANGE,function(e,t,r,o){if(e===i.default.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&o===i.default.sources.USER){n.show(),n.root.style.left="0px",n.root.style.width="",n.root.style.width=n.root.offsetWidth+"px";var a=n.quill.getLines(t.index,t.length);if(1===a.length)n.position(n.quill.getBounds(t));else{var s=a[a.length-1],l=n.quill.getIndex(s),u=Math.min(s.length()-1,t.index+t.length-l),d=n.quill.getBounds(new c.Range(l,u));n.position(d)}}else document.activeElement!==n.textbox&&n.quill.hasFocus()&&n.hide()}),n}return h(t,e),o(t,[{key:"listen",value:function(){var e=this;n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){e.root.classList.remove("ql-editing")}),this.quill.on(i.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!e.root.classList.contains("ql-hidden")){var t=e.quill.getSelection();null!=t&&e.position(e.quill.getBounds(t))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(e){var r=n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"position",this).call(this,e),o=this.root.querySelector(".ql-tooltip-arrow");if(o.style.marginLeft="",0===r)return r;o.style.marginLeft=-1*r-o.offsetWidth/2+"px"}}]),t}(s.BaseTooltip);g.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(""),t.BubbleTooltip=g,t.default=y},function(e,t,r){e.exports=r(63)}]).default},Tu.exports=e());var e}var Pu=function(){if(Au)return Su;Au=1;var e,r=Su&&Su.__extends||(e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),n=Su&&Su.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=Su&&Su.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,o++)n[o]=a[i];return n},a=Su&&Su.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=a(t),s=a(bt),l=a(Ou()),c=a(Cu()),u=function(e){function t(t){var r=e.call(this,t)||this;r.dirtyProps=["modules","formats","bounds","theme","children"],r.cleanProps=["id","className","style","placeholder","tabIndex","onChange","onChangeSelection","onFocus","onBlur","onKeyPress","onKeyDown","onKeyUp"],r.state={generation:0},r.selection=null,r.onEditorChange=function(e,t,n,o){var a,i,s,l;"text-change"===e?null===(i=(a=r).onEditorChangeText)||void 0===i||i.call(a,r.editor.root.innerHTML,t,o,r.unprivilegedEditor):"selection-change"===e&&(null===(l=(s=r).onEditorChangeSelection)||void 0===l||l.call(s,t,o,r.unprivilegedEditor))};var n=r.isControlled()?t.value:t.defaultValue;return r.value=null!=n?n:"",r}return r(t,e),t.prototype.validateProps=function(e){var t;if(i.default.Children.count(e.children)>1)throw new Error("The Quill editing area can only be composed of a single React element.");if(i.default.Children.count(e.children)&&"textarea"===(null===(t=i.default.Children.only(e.children))||void 0===t?void 0:t.type))throw new Error("Quill does not support editing on a <textarea>. Use a <div> instead.");if(this.lastDeltaChangeSet&&e.value===this.lastDeltaChangeSet)throw new Error("You are passing the `delta` object from the `onChange` event back as `value`. You most probably want `editor.getContents()` instead. See: https://github.com/zenoamaro/react-quill#using-deltas")},t.prototype.shouldComponentUpdate=function(e,t){var r,n=this;if(this.validateProps(e),!this.editor||this.state.generation!==t.generation)return!0;if("value"in e){var a=this.getEditorContents(),i=null!=(r=e.value)?r:"";this.isEqualValue(i,a)||this.setEditorContents(this.editor,i)}return e.readOnly!==this.props.readOnly&&this.setEditorReadOnly(this.editor,e.readOnly),o(this.cleanProps,this.dirtyProps).some(function(t){return!l.default(e[t],n.props[t])})},t.prototype.shouldComponentRegenerate=function(e){var t=this;return this.dirtyProps.some(function(r){return!l.default(e[r],t.props[r])})},t.prototype.componentDidMount=function(){this.instantiateEditor(),this.setEditorContents(this.editor,this.getEditorContents())},t.prototype.componentWillUnmount=function(){this.destroyEditor()},t.prototype.componentDidUpdate=function(e,t){var r=this;if(this.editor&&this.shouldComponentRegenerate(e)){var n=this.editor.getContents(),o=this.editor.getSelection();this.regenerationSnapshot={delta:n,selection:o},this.setState({generation:this.state.generation+1}),this.destroyEditor()}if(this.state.generation!==t.generation){var a=this.regenerationSnapshot,i=(n=a.delta,a.selection);delete this.regenerationSnapshot,this.instantiateEditor();var s=this.editor;s.setContents(n),d(function(){return r.setEditorSelection(s,i)})}},t.prototype.instantiateEditor=function(){this.editor?this.hookEditor(this.editor):this.editor=this.createEditor(this.getEditingArea(),this.getEditorConfig())},t.prototype.destroyEditor=function(){this.editor&&this.unhookEditor(this.editor)},t.prototype.isControlled=function(){return"value"in this.props},t.prototype.getEditorConfig=function(){return{bounds:this.props.bounds,formats:this.props.formats,modules:this.props.modules,placeholder:this.props.placeholder,readOnly:this.props.readOnly,scrollingContainer:this.props.scrollingContainer,tabIndex:this.props.tabIndex,theme:this.props.theme}},t.prototype.getEditor=function(){if(!this.editor)throw new Error("Accessing non-instantiated editor");return this.editor},t.prototype.createEditor=function(e,t){var r=new c.default(e,t);return null!=t.tabIndex&&this.setEditorTabIndex(r,t.tabIndex),this.hookEditor(r),r},t.prototype.hookEditor=function(e){this.unprivilegedEditor=this.makeUnprivilegedEditor(e),e.on("editor-change",this.onEditorChange)},t.prototype.unhookEditor=function(e){e.off("editor-change",this.onEditorChange)},t.prototype.getEditorContents=function(){return this.value},t.prototype.getEditorSelection=function(){return this.selection},t.prototype.isDelta=function(e){return e&&e.ops},t.prototype.isEqualValue=function(e,t){return this.isDelta(e)&&this.isDelta(t)?l.default(e.ops,t.ops):l.default(e,t)},t.prototype.setEditorContents=function(e,t){var r=this;this.value=t;var n=this.getEditorSelection();"string"==typeof t?e.setContents(e.clipboard.convert(t)):e.setContents(t),d(function(){return r.setEditorSelection(e,n)})},t.prototype.setEditorSelection=function(e,t){if(this.selection=t,t){var r=e.getLength();t.index=Math.max(0,Math.min(t.index,r-1)),t.length=Math.max(0,Math.min(t.length,r-1-t.index)),e.setSelection(t)}},t.prototype.setEditorTabIndex=function(e,t){var r,n;(null===(n=null===(r=e)||void 0===r?void 0:r.scroll)||void 0===n?void 0:n.domNode)&&(e.scroll.domNode.tabIndex=t)},t.prototype.setEditorReadOnly=function(e,t){t?e.disable():e.enable()},t.prototype.makeUnprivilegedEditor=function(e){var t=e;return{getHTML:function(){return t.root.innerHTML},getLength:t.getLength.bind(t),getText:t.getText.bind(t),getContents:t.getContents.bind(t),getSelection:t.getSelection.bind(t),getBounds:t.getBounds.bind(t)}},t.prototype.getEditingArea=function(){if(!this.editingArea)throw new Error("Instantiating on missing editing area");var e=s.default.findDOMNode(this.editingArea);if(!e)throw new Error("Cannot find element for editing area");if(3===e.nodeType)throw new Error("Editing area cannot be a text node");return e},t.prototype.renderEditingArea=function(){var e=this,t=this.props,r=t.children,o=t.preserveWhitespace,a={key:this.state.generation,ref:function(t){e.editingArea=t}};return i.default.Children.count(r)?i.default.cloneElement(i.default.Children.only(r),a):o?i.default.createElement("pre",n({},a)):i.default.createElement("div",n({},a))},t.prototype.render=function(){var e;return i.default.createElement("div",{id:this.props.id,style:this.props.style,key:this.state.generation,className:"quill "+(e=this.props.className,null!=e?e:""),onKeyPress:this.props.onKeyPress,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp},this.renderEditingArea())},t.prototype.onEditorChangeText=function(e,t,r,n){var o,a;if(this.editor){var i=this.isDelta(this.value)?n.getContents():n.getHTML();i!==this.getEditorContents()&&(this.lastDeltaChangeSet=t,this.value=i,null===(a=(o=this.props).onChange)||void 0===a||a.call(o,e,t,r,n))}},t.prototype.onEditorChangeSelection=function(e,t,r){var n,o,a,i,s,c;if(this.editor){var u=this.getEditorSelection(),d=!u&&e,f=u&&!e;l.default(e,u)||(this.selection=e,null===(o=(n=this.props).onChangeSelection)||void 0===o||o.call(n,e,t,r),d?null===(i=(a=this.props).onFocus)||void 0===i||i.call(a,e,t,r):f&&(null===(c=(s=this.props).onBlur)||void 0===c||c.call(s,u,t,r)))}},t.prototype.focus=function(){this.editor&&this.editor.focus()},t.prototype.blur=function(){this.editor&&(this.selection=null,this.editor.blur())},t.displayName="React Quill",t.Quill=c.default,t.defaultProps={theme:"snow",modules:{},readOnly:!1},t}(i.default.Component);function d(e){Promise.resolve().then(e)}return Su=u}(),qu=St(Pu);const Ru=async(e,t)=>new Promise(t=>{const r=new FileReader;r.onload=()=>t(r.result),r.readAsDataURL(e)}),Lu=async(e,t)=>{const r=Array.from(e.files).find(e=>e.type.startsWith("image/"));return r?Ru(r):null},Iu=(e,t)=>{const r=$u(e),n=$u(t);return r.filter(e=>!n.includes(e))},Mu=(e,t)=>{console.log("Images marked for deletion:",e,"for article:",t)},Du=(e,t)=>{const r=$u(e);return $u(t).filter(e=>!r.includes(e))},Fu=async(e,t)=>(console.log("Image restored from deleted:",e,"for article:",t),!0),Bu=e=>{const t=/<img[^>]+src="([^"]+)"/g,r=[];let n;for(;null!==(n=t.exec(e));)n[1].startsWith("http")&&r.push(n[1]);return r},zu=e=>{const t=/<img[^>]+src="([^"]+)"/g,r=[];let n;for(;null!==(n=t.exec(e));)n[1].startsWith("data:")&&r.push(n[1]);return r},Uu=async(e,t)=>e,$u=e=>{const t=/<img[^>]+src="([^"]+)"/g,r=[];let n;for(;null!==(n=t.exec(e));)r.push(n[1]);return r},Hu=l(({value:e="",onChange:t,placeholder:r="Digite o conteúdo...",className:o,sessionId:i,articleId:s},l)=>{const u=c(e),d=c(),f=n(()=>{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("accept","image/*"),e.click(),e.onchange=async()=>{const t=e.files?.[0];if(t)try{nt.loading("Fazendo upload da imagem...");i||Date.now();const e=await Ru(t);if(e){const t=l&&"object"==typeof l&&"current"in l?l.current:null;if(t){const r=t.getEditor(),n=r.getSelection(),o=n?n.index:0;r.insertEmbed(o,"image",e),r.setSelection({index:o+1,length:0})}nt.success("Imagem inserida com sucesso!")}}catch(e){console.error("Error uploading image:",e),nt.error("Erro ao fazer upload da imagem")}finally{nt.dismiss()}}},[l,i]),p=n(async e=>{const r=u.current;d.current&&clearTimeout(d.current);const n=Du(r,e);if(n.length>0)for(const e of n){await Fu(e,s)&&nt.success("Imagem restaurada automaticamente")}const o=Iu(r,e);o.length>0&&i&&(d.current=setTimeout(()=>{Mu(o,s),nt.info("Imagens marcadas para exclusão")},2e3));const a=zu(e),l=Bu(e),c=a.length+l.length;c>0&&i&&h(e,i,c),u.current=e,t?.(e)},[t,i,s]),h=n(async(e,r,n)=>{try{nt.loading(`Processando ${n} imagem(ns) em segundo plano...`);const r=await Uu(e);if(r!==e){const e=l&&"object"==typeof l&&"current"in l?l.current:null;if(e){const o=e.getEditor(),a=o.root.innerHTML;(a.includes("data:image/")||a.includes("http"))&&(o.root.innerHTML=r,t?.(r),nt.success(`${n} imagem(ns) processada(s) com sucesso!`))}}}catch(e){console.error("Error processing images in background:",e),nt.error("Erro ao processar imagens em segundo plano")}finally{nt.dismiss()}},[l,t]),m=n(async e=>{const t=e.clipboardData;if(!t)return;if(Array.from(t.items).some(e=>e.type.startsWith("image/")&&"file"===e.kind)){e.preventDefault(),e.stopPropagation();const r=await Lu(t);if(r){const e=l&&"object"==typeof l&&"current"in l?l.current:null;if(e){const t=e.getEditor(),n=t.getSelection(),o=n?n.index:0;t.insertEmbed(o,"image",r),t.setSelection({index:o+1,length:0}),nt.success("Imagem colada com sucesso!")}}}},[l,i]);a(()=>{u.current=e},[e]),a(()=>()=>{d.current&&clearTimeout(d.current)},[]),a(()=>{const e=l&&"object"==typeof l&&"current"in l?l.current:null;if(e){const t=e.getEditor().root;return t.addEventListener("paste",m,!0),()=>{t.removeEventListener("paste",m,!0)}}},[m,l,i]);const y={toolbar:{container:[[{header:[1,2,3,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],["blockquote","code-block"],["link","image"],["clean"]],handlers:{image:f}}};return It.jsx("div",{className:Mt("rich-text-editor",o),children:It.jsx(qu,{ref:l,theme:"snow",value:e,onChange:p,modules:y,formats:["header","bold","italic","underline","strike","list","bullet","blockquote","code-block","link","image"],placeholder:r,style:{backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",borderRadius:"calc(var(--radius) - 2px)"}})})});Hu.displayName="RichTextEditor";const Vu=e.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>It.jsx(xt.Root,{ref:o,decorative:r,orientation:t,className:Mt("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Vu.displayName=xt.Root.displayName;const Ku=x.Root,Wu=x.Trigger,Zu=x.Close,Gu=x.Portal,Yu=e.forwardRef(({className:e,...t},r)=>It.jsx(x.Overlay,{className:Mt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));Yu.displayName=x.Overlay.displayName;const Qu=p("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Xu=e.forwardRef(({side:e="right",className:t,children:r,...n},o)=>It.jsxs(Gu,{children:[It.jsx(Yu,{}),It.jsxs(x.Content,{ref:o,className:Mt(Qu({side:e}),t),...n,children:[r,It.jsxs(x.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[It.jsx(w,{className:"h-4 w-4"}),It.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xu.displayName=x.Content.displayName;const Ju=({className:e,...t})=>It.jsx("div",{className:Mt("flex flex-col space-y-2 text-center sm:text-left",e),...t});Ju.displayName="SheetHeader";const ed=({className:e,...t})=>It.jsx("div",{className:Mt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ed.displayName="SheetFooter";const td=e.forwardRef(({className:e,...t},r)=>It.jsx(x.Title,{ref:r,className:Mt("text-lg font-semibold text-foreground",e),...t}));td.displayName=x.Title.displayName;const rd=e.forwardRef(({className:e,...t},r)=>It.jsx(x.Description,{ref:r,className:Mt("text-sm text-muted-foreground",e),...t}));rd.displayName=x.Description.displayName;const nd=wt.Provider,od=wt.Root,ad=wt.Trigger,id=e.forwardRef(({className:e,sideOffset:t=4,...r},n)=>It.jsx(wt.Content,{ref:n,sideOffset:t,className:Mt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));id.displayName=wt.Content.displayName;const sd="sidebar:state",ld=e.createContext(null);function cd(){const t=e.useContext(ld);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const ud=e.forwardRef(({defaultOpen:t=!0,open:r,onOpenChange:n,className:o,style:a,children:i,...s},l)=>{const[c,u]=e.useState(!1);e.useEffect(()=>{const e=()=>u(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const[d,f]=e.useState(!1),[p,h]=e.useState(()=>{if("undefined"!=typeof window){const e=localStorage.getItem(sd);return null!==e?"true"===e:t}return t}),m=r??p,y=e.useCallback(e=>{const t="function"==typeof e?e(m):e;n?n(t):h(t),"undefined"!=typeof window&&localStorage.setItem(sd,String(t))},[n,m]),g=e.useCallback(()=>c?f(e=>!e):y(e=>!e),[c,y,f]);e.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),g())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g]);const v=m?"expanded":"collapsed",b=e.useMemo(()=>({state:v,open:m,setOpen:y,isMobile:c,openMobile:d,setOpenMobile:f,toggleSidebar:g}),[v,m,y,c,d,f,g]);return It.jsx(ld.Provider,{value:b,children:It.jsx(nd,{delayDuration:0,children:It.jsx("div",{className:Mt("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",o),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4.5rem",...a},ref:l,...s,children:i})})})});ud.displayName="SidebarProvider";const dd=e.forwardRef(({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:o,...a},i)=>{const{isMobile:s,state:l,openMobile:c,setOpenMobile:u}=cd();return"none"===r?It.jsx("div",{className:Mt("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",n),ref:i,...a,children:o}):s?It.jsx(Ku,{open:c,onOpenChange:u,...a,children:It.jsxs(Xu,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[It.jsx(td,{className:"sr-only",children:"Menu de Navegação"}),It.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):It.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":l,"data-collapsible":"collapsed"===l?r:"","data-variant":t,"data-side":e,children:[It.jsx("div",{className:Mt("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),It.jsx("div",{className:Mt("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...a,children:It.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:o})})]})});dd.displayName="Sidebar";const fd=e.forwardRef(({className:e,onClick:t,...r},n)=>{const{toggleSidebar:o}=cd();return It.jsxs($t,{ref:n,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Mt("h-7 w-7",e),onClick:e=>{t?.(e),o()},...r,children:[It.jsx(Me,{}),It.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});fd.displayName="SidebarTrigger";const pd=e.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:n}=cd();return It.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Mt("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});pd.displayName="SidebarRail";const hd=e.forwardRef(({className:e,...t},r)=>It.jsx("main",{ref:r,className:Mt("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));hd.displayName="SidebarInset";const md=e.forwardRef(({className:e,...t},r)=>It.jsx(Ht,{ref:r,"data-sidebar":"input",className:Mt("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));md.displayName="SidebarInput";const yd=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,"data-sidebar":"header",className:Mt("flex flex-col gap-2 p-2",e),...t}));yd.displayName="SidebarHeader";const gd=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,"data-sidebar":"footer",className:Mt("flex flex-col gap-2 p-2",e),...t}));gd.displayName="SidebarFooter";const vd=e.forwardRef(({className:e,...t},r)=>It.jsx(Vu,{ref:r,"data-sidebar":"separator",className:Mt("mx-2 w-auto bg-sidebar-border",e),...t}));vd.displayName="SidebarSeparator";const bd=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,"data-sidebar":"content",className:Mt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));bd.displayName="SidebarContent";const xd=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,"data-sidebar":"group",className:Mt("relative flex w-full min-w-0 flex-col p-2",e),...t}));xd.displayName="SidebarGroup";const wd=e.forwardRef(({className:e,asChild:t=!1,...r},n)=>{const o=t?d:"div";return It.jsx(o,{ref:n,"data-sidebar":"group-label",className:Mt("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})});wd.displayName="SidebarGroupLabel";const Nd=e.forwardRef(({className:e,asChild:t=!1,...r},n)=>{const o=t?d:"button";return It.jsx(o,{ref:n,"data-sidebar":"group-action",className:Mt("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...r})});Nd.displayName="SidebarGroupAction";const jd=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,"data-sidebar":"group-content",className:Mt("w-full text-sm",e),...t}));jd.displayName="SidebarGroupContent";const _d=e.forwardRef(({className:e,...t},r)=>It.jsx("ul",{ref:r,"data-sidebar":"menu",className:Mt("flex w-full min-w-0 flex-col gap-1",e),...t}));_d.displayName="SidebarMenu";const kd=e.forwardRef(({className:e,...t},r)=>It.jsx("li",{ref:r,"data-sidebar":"menu-item",className:Mt("group/menu-item relative",e),...t}));kd.displayName="SidebarMenuItem";const Od=p("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-primary data-[active=true]:font-medium data-[active=true]:text-sidebar-primary-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Ed=e.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:o,className:a,...i},s)=>{const l=e?d:"button",{isMobile:c,state:u}=cd(),f=It.jsx(l,{ref:s,"data-sidebar":"menu-button","data-size":n,"data-active":t,className:Mt(Od({variant:r,size:n}),a),...i});return o?("string"==typeof o&&(o={children:o}),It.jsxs(od,{children:[It.jsx(ad,{asChild:!0,children:f}),It.jsx(id,{side:"right",align:"center",hidden:"collapsed"!==u||c,...o})]})):f});Ed.displayName="SidebarMenuButton";const Sd=e.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},o)=>{const a=t?d:"button";return It.jsx(a,{ref:o,"data-sidebar":"menu-action",className:Mt("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});Sd.displayName="SidebarMenuAction";const Ad=e.forwardRef(({className:e,...t},r)=>It.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:Mt("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));Ad.displayName="SidebarMenuBadge";const Td=e.forwardRef(({className:t,showIcon:r=!1,...n},o)=>{const a=e.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return It.jsxs("div",{ref:o,"data-sidebar":"menu-skeleton",className:Mt("rounded-md h-8 flex gap-2 px-2 items-center",t),...n,children:[r&&It.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),It.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":a}})]})});Td.displayName="SidebarMenuSkeleton";const Cd=e.forwardRef(({className:e,...t},r)=>It.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:Mt("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));Cd.displayName="SidebarMenuSub";const Pd=e.forwardRef(({...e},t)=>It.jsx("li",{ref:t,...e}));Pd.displayName="SidebarMenuSubItem";const qd=e.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...o},a)=>{const i=e?d:"a";return It.jsx(i,{ref:a,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Mt("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===t&&"text-xs","md"===t&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});qd.displayName="SidebarMenuSubButton";const Rd=e.forwardRef(({className:e,...t},r)=>It.jsxs(Nt.Root,{ref:r,className:Mt("relative flex w-full touch-none select-none items-center",e),...t,children:[It.jsx(Nt.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:It.jsx(Nt.Range,{className:"absolute h-full bg-primary"})}),It.jsx(Nt.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Rd.displayName=Nt.Root.displayName;const Ld=({...e})=>{const{theme:t="system"}=jt();return It.jsx(ot,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};function Id(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function Md(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Dd(...t){return e.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=Md(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():Md(e[t],null)}}}}(...t),t)}function Fd(...t){const r=t[0];if(1===t.length)return r;const n=()=>{const n=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const o=n.reduce((e,{useScope:r,scopeName:n})=>({...e,...r(t)[`__scope${n}`]}),{});return e.useMemo(()=>({[`__scope${r.scopeName}`]:o}),[o])}};return n.scopeName=r.scopeName,n}var Bd=globalThis?.document?e.useLayoutEffect:()=>{},zd=e[" useInsertionEffect ".trim().toString()]||Bd;function Ud({prop:t,defaultProp:r,onChange:n=()=>{},caller:o}){const[a,i,s]=function({defaultProp:t,onChange:r}){const[n,o]=e.useState(t),a=e.useRef(n),i=e.useRef(r);return zd(()=>{i.current=r},[r]),e.useEffect(()=>{a.current!==n&&(i.current?.(n),a.current=n)},[n,a]),[n,o,i]}({defaultProp:r,onChange:n}),l=void 0!==t,c=l?t:a;{const r=e.useRef(void 0!==t);e.useEffect(()=>{const e=r.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${o} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=l},[l,o])}const u=e.useCallback(e=>{if(l){const r=function(e){return"function"==typeof e}(e)?e(t):e;r!==t&&s.current?.(r)}else i(e)},[l,t,i,s]);return[c,u]}var $d=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=f(`Primitive.${r}`),o=e.forwardRef((e,t)=>{const{asChild:o,...a}=e,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),It.jsx(i,{...a,ref:t})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Hd="Switch",[Vd]=function(t,r=[]){let n=[];const o=()=>{const r=n.map(t=>e.createContext(t));return function(n){const o=n?.[t]||r;return e.useMemo(()=>({[`__scope${t}`]:{...n,[t]:o}}),[n,o])}};return o.scopeName=t,[function(r,o){const a=e.createContext(o),i=n.length;n=[...n,o];const s=r=>{const{scope:n,children:o,...s}=r,l=n?.[t]?.[i]||a,c=e.useMemo(()=>s,Object.values(s));return It.jsx(l.Provider,{value:c,children:o})};return s.displayName=r+"Provider",[s,function(n,s){const l=s?.[t]?.[i]||a,c=e.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${n}\` must be used within \`${r}\``)}]},Fd(o,...r)]}(Hd),[Kd,Wd]=Vd(Hd),Zd=e.forwardRef((t,r)=>{const{__scopeSwitch:n,name:o,checked:a,defaultChecked:i,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[p,h]=e.useState(null),m=Dd(r,e=>h(e)),y=e.useRef(!1),g=!p||(d||!!p.closest("form")),[v,b]=Ud({prop:a,defaultProp:i??!1,onChange:u,caller:Hd});return It.jsxs(Kd,{scope:n,checked:v,disabled:l,children:[It.jsx($d.button,{type:"button",role:"switch","aria-checked":v,"aria-required":s,"data-state":Xd(v),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:m,onClick:Id(t.onClick,e=>{b(e=>!e),g&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),g&&It.jsx(Qd,{control:p,bubbles:!y.current,name:o,value:c,checked:v,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Zd.displayName=Hd;var Gd="SwitchThumb",Yd=e.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,o=Wd(Gd,r);return It.jsx($d.span,{"data-state":Xd(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:t})});Yd.displayName=Gd;var Qd=e.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:o=!0,...a},i)=>{const s=e.useRef(null),l=Dd(s,i),c=function(t){const r=e.useRef({value:t,previous:t});return e.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}(n),u=function(t){const[r,n]=e.useState(void 0);return Bd(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const r=e[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}n(void 0)},[t]),r}(r);return e.useEffect(()=>{const e=s.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==n&&r){const t=new Event("click",{bubbles:o});r.call(e,n),e.dispatchEvent(t)}},[c,n,o]),It.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function Xd(e){return e?"checked":"unchecked"}Qd.displayName="SwitchBubbleInput";var Jd=Zd,ef=Yd;const tf=e.forwardRef(({className:e,...t},r)=>It.jsx(Jd,{className:Mt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:It.jsx(ef,{className:Mt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));tf.displayName=Jd.displayName;const rf={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},nf={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},of={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function af({children:e,direction:t="column",gap:r="md",align:n="stretch",justify:o="start",wrap:a=!1,className:i}){return It.jsx("div",{className:Mt("flex","column"===t?"flex-col":"flex-row",rf[r],nf[n],of[o],a&&"flex-wrap",i),children:e})}const sf=_t.Root,lf=e.forwardRef(({className:e,...t},r)=>It.jsx(_t.List,{ref:r,className:Mt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));lf.displayName=_t.List.displayName;const cf=e.forwardRef(({className:e,...t},r)=>It.jsx(_t.Trigger,{ref:r,className:Mt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));cf.displayName=_t.Trigger.displayName;const uf=e.forwardRef(({className:e,...t},r)=>It.jsx(_t.Content,{ref:r,className:Mt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function df({children:e,className:t}){return It.jsx("div",{className:Mt("flex flex-col h-full",t),children:It.jsx(Co,{className:"flex-1",children:It.jsx("div",{className:"space-y-6 p-6",children:e})})})}function ff({title:e,description:t,actions:r,className:n}){return It.jsxs("div",{className:Mt("space-y-4",n),children:[It.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[It.jsxs("div",{className:"space-y-1",children:[It.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),t&&It.jsx("p",{className:"text-muted-foreground text-sm",children:t})]}),r&&It.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),It.jsx(Vu,{})]})}function pf({children:e,className:t}){return It.jsx("div",{className:Mt("space-y-6",t),children:e})}uf.displayName=_t.Content.displayName;const hf=p("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),mf=e.forwardRef(({className:e,variant:t,size:r,...n},o)=>It.jsx(kt.Root,{ref:o,className:Mt(hf({variant:t,size:r,className:e})),...n}));mf.displayName=kt.Root.displayName;const yf=e.createContext({size:"default",variant:"default"}),gf=e.forwardRef(({className:e,variant:t,size:r,children:n,...o},a)=>It.jsx(Ot.Root,{ref:a,className:Mt("flex items-center justify-center gap-1",e),...o,children:It.jsx(yf.Provider,{value:{variant:t,size:r},children:n})}));gf.displayName=Ot.Root.displayName;const vf=e.forwardRef(({className:t,children:r,variant:n,size:o,...a},i)=>{const s=e.useContext(yf);return It.jsx(Ot.Item,{ref:i,className:Mt(hf({variant:s.variant||n,size:s.size||o}),t),...a,children:r})});vf.displayName=Ot.Item.displayName;const bf=t.forwardRef(({variant:e="default",className:t,children:r,...n},o)=>It.jsx($t,{ref:o,variant:"outline",size:"sm",className:Mt("h-7 px-2 text-xs","border-primary/20 text-primary hover:bg-primary/5",t),...n,children:r||It.jsx(L,{size:12})}));function xf({manager:e,config:t,onEdit:r,onDelete:n}){return e.isLoading?It.jsx(di,{children:Array.from({length:3}).map((e,t)=>It.jsxs(Wt,{children:[It.jsxs(Zt,{children:[It.jsx(Xn,{className:"h-4 w-3/4"}),It.jsx(Xn,{className:"h-3 w-1/2"})]}),It.jsx(Qt,{children:It.jsxs("div",{className:"space-y-2",children:[It.jsx(Xn,{className:"h-3 w-full"}),It.jsx(Xn,{className:"h-3 w-2/3"})]})})]},t))}):It.jsx(si.Root,{children:e.entities.map(e=>It.jsxs(si.Item,{onClick:()=>r(e),children:[It.jsx(Zt,{className:"pb-3",children:It.jsxs("div",{className:"flex items-start justify-between",children:[It.jsxs("div",{className:"flex-1 min-w-0",children:[It.jsx(Gt,{className:"text-base leading-6 truncate",children:e.title||e.name||"Sem título"}),It.jsx(Yt,{className:"text-sm",children:v(new Date(e.created_at),"dd/MM/yyyy HH:mm",{locale:qa})})]}),It.jsxs("div",{className:"flex items-center gap-2 ml-2",children:[e.link&&It.jsx($t,{variant:"external-link",size:"icon-xs",onClick:t=>{t.stopPropagation(),(e=>{try{const t=window.open(e,"_blank");t&&!t.closed&&void 0!==t.closed||(navigator.clipboard.writeText(e),nt.info("Link copiado para a área de transferência"))}catch(t){window.location.href=e}})(e.link)},title:"Abrir link externo",children:It.jsx(De,{className:"h-4 w-4"})}),It.jsx("div",{onClick:e=>e.stopPropagation(),children:It.jsx(jo,{onEdit:()=>r(e),onDelete:n?()=>n(e):void 0,canDelete:!!n})})]})]})}),It.jsx(Qt,{className:"pt-0",children:It.jsx("div",{className:"space-y-2",children:t.cardFields?.map(t=>{const r=e[t.key];return r?It.jsx(si.Field,{label:t.label,value:t.render?t.render(r,e):String(r)},String(t.key)):null})})})]},e.id))})}function wf({manager:e,filters:t}){const{isSearchVisible:r}=zo(),n=e.searchTerm;return It.jsx(af,{direction:"column",gap:"md",className:"mb-6",children:It.jsxs(af,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:[t.some(e=>"search"===e.type)&&!r&&It.jsxs("div",{className:"relative flex-1",children:[It.jsx(E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),It.jsx(Ht,{placeholder:"Buscar...",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),t.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return It.jsx("div",{className:"w-full sm:w-auto",children:It.jsx(r,{...e.props})},t)}),n&&It.jsxs($t,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[It.jsx(w,{className:"h-4 w-4 mr-2"}),"Limpar Filtros"]})]})})}function Nf(e){const t=tt();return{onNew:()=>{const r=e.newPath||`${e.basePath}/new`;t(r)},onEdit:r=>{const n=e.editPath?e.editPath.replace(":id",r.id):`${e.basePath}/${r.id}/edit`;t(n)}}}function jf(e){return Nf({basePath:e})}function _f({open:e,onCancel:t,onSubmit:r,editingEntity:n,isLoading:o=!1,title:a,editTitle:i,sections:s,transformData:l}){const{alias:c}=zo();return It.jsx(Ko,{open:e,title:n?i:a,sections:s,initialData:n,onSubmit:e=>{if(l){const t=l(e,c||"");r(t)}else{const t={...e,alias:c||""};n?.id&&(t.id=n.id),r(t)}},onCancel:t,isLoading:o,submitButtonText:n?"Atualizar":"Salvar"})}bf.displayName="ActionButton";const kf=t.memo(({variant:e="card",className:r="",selectedUnit:n,onUnitChange:o})=>{const{user:a,companies:i,alias:s,isAuthenticated:l,logout:c,switchUnit:u}=zo(),d=i?.[0]||null,f=s?i?.find(e=>e.alias===s):d,p=i||[],h=n||f||d||d,m=t.useCallback(e=>{o?o(e):u(e)},[o,u]),y=t.useMemo(()=>{if(!p?.length)return[];const e=new Map;p.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),r=t.find(e=>e.alias===h?.alias),n=t.filter(e=>e.alias!==h?.alias);return n.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),r?[r,...n]:n},[p,h?.alias]);if(!l||!a)return null;const g=()=>It.jsxs(It.Fragment,{children:[It.jsxs("div",{className:"flex items-center space-x-3",children:[It.jsx("div",{className:"flex-shrink-0",children:It.jsx("div",{className:"w-10 h-10 bg-primary rounded-full flex items-center justify-center",children:It.jsx(Ee,{className:"h-5 w-5 text-primary-foreground"})})}),It.jsxs("div",{className:"flex-1 min-w-0",children:[It.jsx("p",{className:"text-sm font-medium truncate",children:a.name}),It.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",h?.name||"N/A"]})]})]}),h&&It.jsx("div",{className:"mt-3",children:It.jsxs("div",{className:"flex items-center space-x-2",children:[It.jsx(Fe,{className:"h-4 w-4 text-muted-foreground"}),It.jsx("span",{className:"text-sm font-medium",children:h.name})]})}),y.length>1&&It.jsxs("div",{className:"mt-2",children:[It.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",y.length]}),It.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.slice(0,3).map(e=>It.jsx(Sr,{variant:e.alias===h?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>m(e),children:e.name},e.alias)),y.length>3&&It.jsxs(Sr,{variant:"outline",className:"text-xs",children:["+",y.length-3]})]})]})]});return"dropdown"===e?It.jsxs(io,{children:[It.jsx(so,{asChild:!0,children:It.jsx($t,{variant:"ghost",className:`h-auto p-2 ${r}`,children:It.jsxs("div",{className:"flex items-center space-x-2",children:[It.jsxs("div",{className:"hidden md:block text-left",children:[It.jsx("p",{className:"text-sm font-medium",children:a.name}),It.jsx("p",{className:"text-xs text-muted-foreground",children:h?.name||"N/A"})]}),It.jsx("div",{className:"w-8 h-8 bg-primary rounded-full flex items-center justify-center",children:It.jsx(Ee,{className:"h-4 w-4 text-primary-foreground"})}),It.jsx(N,{className:"h-4 w-4"})]})})}),It.jsxs(mo,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[It.jsxs(uo,{children:[It.jsxs(po,{children:[It.jsx(qe,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),It.jsx(ho,{children:y.map(e=>It.jsxs(yo,{onClick:()=>m(e),className:e.alias===h?.alias?"bg-muted":"",children:[It.jsx(Fe,{className:"mr-2 h-4 w-4"}),e.name,e.alias===h?.alias&&It.jsx(Sr,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),It.jsx(xo,{}),It.jsx(li,{variant:"menuItem"}),It.jsxs(yo,{onClick:c,children:[It.jsx(Be,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}):It.jsxs(Wt,{className:r,children:[It.jsx(Zt,{children:It.jsx(Gt,{className:"text-lg",children:"Informações do Usuário"})}),It.jsxs(Qt,{className:"space-y-4",children:[It.jsx(g,{}),It.jsx(Vu,{}),It.jsxs("div",{className:"flex space-x-2",children:[It.jsx(li,{className:"flex-1"}),It.jsxs($t,{variant:"outline",onClick:c,size:"sm",className:"flex-1",children:[It.jsx(Be,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})}),Of=i({});function Ef({children:e,config:t}){return It.jsx(Of.Provider,{value:{navigation:t?.navigation,appName:t?.appName},children:e})}function Sf(){return s(Of)}function Af(){const e=et(),{navigation:t}=Sf(),r=t?.find(t=>t.path===e.pathname);return r?.label||"Página"}function Tf(e,t){const[r,i]=o(e),s=c(),l=n(()=>{s.current&&(clearTimeout(s.current),s.current=void 0)},[]);return a(()=>(l(),s.current=setTimeout(()=>{i(e)},t),l),[e,t,l]),[r,l]}const Cf=({actions:e})=>{const t=et(),r=Af(),{navigation:n,appName:i}=Sf(),{companies:s,alias:l,isSearchVisible:c,clearSearch:u,refreshData:d,switchUnit:f}=zo(),p=l?s?.find(e=>e.alias===l)||s?.[0]||null:s?.[0]||null,[h,m]=Je(),[y,g]=o(()=>h.get("search")||""),[v,b]=Tf(y,wn.debounceDelay);a(()=>{if(!c)return;const e=new URLSearchParams(h);v?(e.set("search",v),e.set("page","1")):e.delete("search"),m(e)},[v,m,c]);const x=n?.find(e=>e.path===t.pathname);return It.jsx("header",{className:"bg-white border-b border-gray-200 px-2 md:px-4 py-2",children:It.jsxs("div",{className:"flex items-center justify-between gap-4",children:[It.jsx("div",{className:"flex items-center space-x-1 md:space-x-2 min-w-0",children:It.jsxs("div",{className:"min-w-0 flex flex-col md:flex-row md:items-center md:space-x-3 space-y-2 md:space-y-0",children:[It.jsxs("div",{className:"min-w-0",children:[It.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[It.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:r}),It.jsx(Sr,{variant:"default",className:"bg-primary hover:bg-primary/90 text-primary-foreground text-xs px-2 py-1",children:i||"Módulo"})]}),It.jsx("p",{className:"text-sm text-muted-foreground truncate",children:x?.complementaryText||"Detalhes do item"})]}),c&&It.jsxs("div",{className:"flex items-center space-x-1 w-full md:w-auto",children:[It.jsxs("div",{className:"relative w-full md:w-48",children:[It.jsx(E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),It.jsx(Ht,{placeholder:"/wiki"===t.pathname?"Buscar artigos...":"Buscar...",value:y,onChange:e=>{return t=e.target.value,void g(t);var t},className:"w-full pl-10 pr-8"}),y&&It.jsx($t,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-gray-100",onClick:()=>{b(),g("");const e=new URLSearchParams(h);e.delete("search"),e.delete("page"),m(e)},title:"Limpar busca",children:It.jsx(w,{size:14})})]}),It.jsx($t,{variant:"outline",size:"sm",onClick:d,className:"flex-shrink-0 h-10 w-10 p-0",title:"Atualizar dados",children:It.jsx(qe,{size:14})})]})]})}),It.jsxs("div",{className:"flex-shrink-0 flex items-center gap-3",children:[e&&It.jsx("div",{className:"flex items-center gap-2",children:e}),It.jsx("div",{className:"text-sm",children:It.jsx(kf,{variant:"dropdown",selectedUnit:p,onUnitChange:f})})]})]})})},Pf=(e={})=>{const{enabled:t=!0}=e,{alias:r}=zo();return Ye({queryKey:["active-modules",r],queryFn:async()=>{if(!r)return[];const e=hn(),{data:t,error:n}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",r).eq("status","active").order("name");if(n){if(!Do.handleError(n))throw n;return[]}return t||[]},enabled:t&&!!r})},qf=import.meta.env.VITE_SUPABASE_PROJECT_ID,Rf={logo:`https://${qf}.supabase.co/storage/v1/object/public/library-assets/logo.svg`,smallLogo:`https://${qf}.supabase.co/storage/v1/object/public/library-assets/small.svg`},Lf=Rf.logo,If=Rf.smallLogo,Mf="forlogic-sidebar-pinned",Df=()=>{try{const e=localStorage.getItem(Mf);return!!e&&JSON.parse(e)}catch{return!1}};function Ff({config:e}={}){const{state:t,open:r,setOpen:n}=cd(),i=et(),[s,l]=o(!1),[c,u]=o(Df),[d,f]=o(!1);a(()=>{n(!!c||!(!d&&!s))},[c,d,s,n]);const{data:p,isLoading:h,error:m}=Pf({enabled:s}),y=e=>{const t=["border-l-yellow-400","border-l-green-400","border-l-blue-400","border-l-red-400","border-l-purple-400","border-l-pink-400"];return t[e%t.length]};return It.jsxs(dd,{collapsible:"icon",onMouseEnter:()=>{c||f(!0)},onMouseLeave:()=>{c||f(!1)},className:"app-sidebar transition-all duration-300 ease-in-out bg-white border-r border-gray-200 py-6 px-3",children:[It.jsxs(yd,{className:"p-0 gap-0",children:[It.jsx("div",{className:"flex items-center justify-between h-[34px]",children:r?It.jsxs(It.Fragment,{children:[It.jsx("div",{className:"flex items-center pl-[12px]",children:It.jsx("img",{src:Rf.logo,alt:"Logo",className:"h-6 max-w-full object-contain"})}),It.jsx("button",{onClick:()=>{const e=!c;u(e),(e=>{try{localStorage.setItem(Mf,JSON.stringify(e))}catch{}})(e)},className:"h-8 w-8 flex items-center justify-center rounded-md transition-colors duration-200 "+(c?"bg-primary text-primary-foreground":"hover:bg-muted text-muted-foreground"),children:It.jsx(Me,{className:"h-4 w-4"})})]}):It.jsx("div",{className:"flex items-center justify-center w-full h-[34px]",children:It.jsx("img",{src:Rf.smallLogo,alt:"Logo",className:"h-[34px] w-[34px] object-contain"})})}),It.jsx("div",{className:"mt-2 pt-0",children:It.jsxs(io,{onOpenChange:l,children:[It.jsx(so,{asChild:!0,children:r?It.jsxs("div",{className:"bg-muted hover:bg-muted/80 text-foreground font-medium text-sm flex items-center justify-between cursor-pointer transition-all duration-200 h-8 px-3 gap-3 rounded-md w-full",children:[It.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[It.jsx("img",{src:"https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets/composit.svg",alt:"Menu",className:"h-6 w-6 text-muted-foreground flex-shrink-0"}),It.jsx("span",{className:"truncate group-data-[collapsible=icon]:hidden",children:e?.appName||"Título do módulo"})]}),It.jsx(N,{className:"h-6 w-6 flex-shrink-0 text-muted-foreground"})]}):It.jsx("div",{className:"flex items-center justify-center w-full h-8 bg-muted hover:bg-muted/80 rounded-md cursor-pointer transition-all duration-200 p-[5px]",children:It.jsx(N,{className:"h-6 w-6 text-muted-foreground"})})}),It.jsx(mo,{className:r?"w-80 bg-white rounded-lg shadow-lg border border-gray-200 p-4 z-50":"w-[58px] bg-white rounded-lg shadow-lg border border-gray-200 p-2 z-50",align:r?"start":"center",children:h?It.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-muted-foreground",children:[It.jsx(k,{className:"h-4 w-4 animate-spin"}),It.jsx("span",{className:"text-sm",children:"Carregando módulos..."})]}):m?It.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-destructive",children:[It.jsx(O,{className:"h-4 w-4"}),It.jsx("span",{className:"text-sm",children:"Erro ao carregar módulos"})]}):p&&0!==p.length?It.jsx("div",{className:"space-y-2",children:p.map((e,t)=>It.jsx("div",{onClick:()=>(e=>{const t=p?.find(t=>t.url===e);t?.url&&window.open(t.url,"_blank")})(e.url||""),className:`\n bg-muted/50 hover:bg-muted rounded-md p-3 cursor-pointer \n border-l-4 ${y(t)} transition-colors duration-200\n `,children:It.jsxs("div",{className:"flex items-center justify-between",children:[It.jsx("span",{className:"font-medium text-foreground text-sm",children:e.name}),e.url&&It.jsx(De,{className:"h-4 w-4 text-muted-foreground"})]})},e.id))}):It.jsx("div",{className:"py-3 px-3 text-muted-foreground text-sm",children:"Nenhum módulo disponível"})})]})})]}),It.jsx(bd,{children:It.jsx(xd,{className:"p-0 mt-6",children:It.jsx(jd,{children:It.jsx(_d,{className:"space-y-2",children:e?.navigation?.map(e=>{return It.jsx(kd,{children:It.jsx(Ed,{asChild:!0,isActive:(t=e.path,i.pathname===t),size:"lg",className:"h-10",children:It.jsxs(rt,{to:e.path,className:"flex w-full items-center gap-3",children:[It.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:It.jsx(e.icon,{className:"h-5 w-4"})}),It.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label})]})})},e.path);var t})})})})})]})}function Bf({children:e,sidebar:t,sidebarConfig:r,showHeader:n=!0}){const o=t||It.jsx(Ff,{config:r});return It.jsx(Ef,{config:r,children:It.jsx(ud,{defaultOpen:!1,style:{"--sidebar-width":"240px","--sidebar-width-icon":"58px"},children:It.jsxs("div",{className:"min-h-screen flex w-full",children:[o,It.jsxs("main",{className:"flex-1 flex flex-col min-h-screen",children:[n&&It.jsx("div",{className:"flex-shrink-0",children:It.jsx(Cf,{})}),It.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50",children:e})]})]})})})}class zf extends u{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){sn.handleError(e,!1),console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:It.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:It.jsxs(Wt,{className:"w-full max-w-md",children:[It.jsxs(Zt,{className:"text-center",children:[It.jsx("div",{className:"flex justify-center mb-4",children:It.jsx(ze,{className:"h-12 w-12 text-destructive"})}),It.jsx(Gt,{children:"Algo deu errado"})]}),It.jsxs(Qt,{className:"text-center space-y-4",children:[It.jsx("p",{className:"text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),It.jsx($t,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})}):this.props.children}}export{bn as AUTH_CONFIG,da as Accordion,ha as AccordionContent,fa as AccordionItem,pa as AccordionTrigger,bf as ActionButton,No as ActionMenuItems,aa as Alert,sa as AlertDescription,Pn as AlertDialog,zn as AlertDialogAction,Un as AlertDialogCancel,In as AlertDialogContent,Bn as AlertDialogDescription,Dn as AlertDialogFooter,Mn as AlertDialogHeader,Ln as AlertDialogOverlay,Rn as AlertDialogPortal,Fn as AlertDialogTitle,qn as AlertDialogTrigger,ia as AlertTitle,Cf as AppHeader,Bf as AppLayout,Ff as AppSidebar,ma as AspectRatio,Do as AuthErrorInterceptor,Bo as AuthProvider,Io as AuthService,ya as Avatar,va as AvatarFallback,ga as AvatarImage,Sr as Badge,Go as BaseCrudPage,Vo as BaseForm,ba as Breadcrumb,ka as BreadcrumbEllipsis,wa as BreadcrumbItem,Na as BreadcrumbLink,xa as BreadcrumbList,ja as BreadcrumbPage,_a as BreadcrumbSeparator,$t as Button,xn as CRUD_CONFIG,Ra as Calendar,la as CallbackPage,Wt as Card,Qt as CardContent,Yt as CardDescription,Xt as CardFooter,Zt as CardHeader,eo as CardSkeleton,Gt as CardTitle,Ma as Carousel,Da as CarouselContent,Fa as CarouselItem,za as CarouselNext,Ba as CarouselPrevious,Va as ChartContainer,Ga as ChartLegend,Ya as ChartLegendContent,Ka as ChartStyle,Wa as ChartTooltip,Za as ChartTooltipContent,kr as Checkbox,To as ColorPicker,Xa as Command,Ja as CommandDialog,ri as CommandEmpty,ni as CommandGroup,ei as CommandInput,ai as CommandItem,ti as CommandList,oi as CommandSeparator,ii as CommandShortcut,xf as CrudCards,Ko as CrudForm,_o as CrudTable,si as DataList,$n as DeleteConfirmationDialog,Jt as Dialog,rr as DialogClose,or as DialogContent,lr as DialogDescription,ir as DialogFooter,ar as DialogHeader,nr as DialogOverlay,tr as DialogPortal,sr as DialogTitle,er as DialogTrigger,io as DropdownMenu,go as DropdownMenuCheckboxItem,mo as DropdownMenuContent,lo as DropdownMenuGroup,yo as DropdownMenuItem,bo as DropdownMenuLabel,co as DropdownMenuPortal,fo as DropdownMenuRadioGroup,vo as DropdownMenuRadioItem,xo as DropdownMenuSeparator,wo as DropdownMenuShortcut,uo as DropdownMenuSub,ho as DropdownMenuSubContent,po as DropdownMenuSubTrigger,so as DropdownMenuTrigger,ao as EmptyState,zf as ErrorBoundary,li as FeedbackDialog,wf as FilterBar,cr as Form,yr as FormControl,dr as FormField,hr as FormItem,mr as FormLabel,gr as FormMessage,to as FormSkeleton,_f as GenericEntityForm,di as Grid,ro as HeaderSkeleton,Ro as IconPicker,Ht as Input,fi as InputOTP,pi as InputOTPGroup,mi as InputOTPSeparator,hi as InputOTPSlot,Kt as Label,Cr as LoadingState,ca as LoginPage,En as MESSAGES,Ef as NavigationProvider,yi as PageBreadcrumb,vi as Pagination,bi as PaginationContent,_i as PaginationEllipsis,xi as PaginationItem,wi as PaginationLink,ji as PaginationNext,Ni as PaginationPrevious,Oo as Popover,So as PopoverContent,Eo as PopoverTrigger,ki as Progress,na as ProtectedRoute,jn as QUERY_KEYS,vn as QualiexEnrichmentService,Ho as QualiexResponsibleSelectField,$o as QualiexUserField,Oi as RadioGroup,Ei as RadioGroupItem,Hu as RichTextEditor,wn as SEARCH_CONFIG,Co as ScrollArea,Po as ScrollBar,vr as Select,jr as SelectContent,_r as SelectItem,xr as SelectTrigger,br as SelectValue,Vu as Separator,Ku as Sheet,Zu as SheetClose,Xu as SheetContent,rd as SheetDescription,ed as SheetFooter,Ju as SheetHeader,Yu as SheetOverlay,Gu as SheetPortal,td as SheetTitle,Wu as SheetTrigger,dd as Sidebar,bd as SidebarContent,gd as SidebarFooter,xd as SidebarGroup,Nd as SidebarGroupAction,jd as SidebarGroupContent,wd as SidebarGroupLabel,yd as SidebarHeader,md as SidebarInput,hd as SidebarInset,_d as SidebarMenu,Sd as SidebarMenuAction,Ad as SidebarMenuBadge,Ed as SidebarMenuButton,kd as SidebarMenuItem,Td as SidebarMenuSkeleton,Cd as SidebarMenuSub,qd as SidebarMenuSubButton,Pd as SidebarMenuSubItem,ud as SidebarProvider,pd as SidebarRail,vd as SidebarSeparator,no as SidebarSkeleton,fd as SidebarTrigger,Xn as Skeleton,Rd as Slider,Ld as SonnerToaster,Tr as Spinner,af as Stack,tf as Switch,pf as TabPageContent,ff as TabPageHeader,df as TabPageLayout,Hn as Table,Kn as TableBody,Qn as TableCaption,Yn as TableCell,Wn as TableFooter,Gn as TableHead,Vn as TableHeader,Zn as TableRow,jo as TableRowActions,Jn as TableSkeleton,sf as Tabs,uf as TabsContent,lf as TabsList,cf as TabsTrigger,Or as Textarea,Hr as Toast,Vr as ToastAction,Kr as ToastClose,Zr as ToastDescription,zr as ToastProvider,Wr as ToastTitle,Ur as ToastViewport,Gr as Toaster,mf as Toggle,gf as ToggleGroup,vf as ToggleGroupItem,nn as TokenManager,od as Tooltip,id as TooltipContent,nd as TooltipProvider,ad as TooltipTrigger,Rf as assets,Er as badgeVariants,Ut as buttonVariants,Mt as cn,Yo as createCrudPage,Nf as createRoutingHandlers,An as createService,Qo as createSimpleSaveHandler,Cn as createSimpleService,ta as crudPresets,zt as debounce,Iu as detectRemovedImages,Du as detectRestoredImages,sn as errorService,zu as extractDataUrls,Bu as extractExternalImageUrls,Bt as formatCurrency,Ft as formatDatetime,Xo as generateCrudConfig,kn as getQualiexConfig,hn as getSupabaseClient,Lu as handleClipboardImageWithSession,Nn as isDevEnvironment,Lf as logoSrc,Mu as markImageForDeletion,Uu as processHtmlWithAllImages,gn as qualiexApi,Fu as restoreImageFromDeleted,On as setQualiexConfig,ua as setupQualiexCore,If as smallLogoSrc,Fr as toast,hf as toggleVariants,Dt as trimTextFields,Ru as uploadImageToSession,Pf as useActiveModules,zo as useAuth,ko as useBaseForm,Tn as useCrud,jf as useCrudRouting,Tf as useDebounce,Sf as useNavigation,Af as usePageTitle,Uo as useQualiexUsers,gi as useRouteBreadcrumbs,cd as useSidebar,Br as useToast,ra as withPreset};
|
|
16
|
+
*/function Lu(){return Cu?Ru.exports:(Cu=1,"undefined"!=typeof self&&self,e=function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=109)}([function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(17),o=r(18),a=r(19),i=r(45),s=r(46),l=r(47),c=r(48),u=r(49),d=r(12),f=r(32),p=r(33),h=r(31),m=r(1),y={Scope:m.Scope,create:m.create,find:m.find,query:m.query,register:m.register,Container:n.default,Format:o.default,Leaf:a.default,Embed:c.default,Scroll:i.default,Block:l.default,Inline:s.default,Text:u.default,Attributor:{Attribute:d.default,Class:f.default,Style:p.default,Store:h.default}};t.default=y},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(t){var r=this;return t="[Parchment] "+t,(r=e.call(this,t)||this).message=t,r.name=r.constructor.name,r}return o(t,e),t}(Error);t.ParchmentError=a;var i,s={},l={},c={},u={};function d(e,t){var r;if(void 0===t&&(t=i.ANY),"string"==typeof e)r=u[e]||s[e];else if(e instanceof Text||e.nodeType===Node.TEXT_NODE)r=u.text;else if("number"==typeof e)e&i.LEVEL&i.BLOCK?r=u.block:e&i.LEVEL&i.INLINE&&(r=u.inline);else if(e instanceof HTMLElement){var n=(e.getAttribute("class")||"").split(/\s+/);for(var o in n)if(r=l[n[o]])break;r=r||c[e.tagName]}return null==r?null:t&i.LEVEL&r.scope&&t&i.TYPE&r.scope?r:null}t.DATA_KEY="__blot",function(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"}(i=t.Scope||(t.Scope={})),t.create=function(e,t){var r=d(e);if(null==r)throw new a("Unable to create "+e+" blot");var n=r,o=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:n.create(t);return new n(o,t)},t.find=function e(r,n){return void 0===n&&(n=!1),null==r?null:null!=r[t.DATA_KEY]?r[t.DATA_KEY].blot:n?e(r.parentNode,n):null},t.query=d,t.register=function e(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];if(t.length>1)return t.map(function(t){return e(t)});var n=t[0];if("string"!=typeof n.blotName&&"string"!=typeof n.attrName)throw new a("Invalid definition");if("abstract"===n.blotName)throw new a("Cannot register abstract class");return u[n.blotName||n.attrName]=n,"string"==typeof n.keyName?s[n.keyName]=n:(null!=n.className&&(l[n.className]=n),null!=n.tagName&&(Array.isArray(n.tagName)?n.tagName=n.tagName.map(function(e){return e.toUpperCase()}):n.tagName=n.tagName.toUpperCase(),(Array.isArray(n.tagName)?n.tagName:[n.tagName]).forEach(function(e){null!=c[e]&&null!=n.className||(c[e]=n)}))),n}},function(e,t,r){var n=r(51),o=r(11),a=r(3),i=r(20),s=String.fromCharCode(0),l=function(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]};l.prototype.insert=function(e,t){var r={};return 0===e.length?this:(r.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(r.attributes=t),this.push(r))},l.prototype.delete=function(e){return e<=0?this:this.push({delete:e})},l.prototype.retain=function(e,t){if(e<=0)return this;var r={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(r.attributes=t),this.push(r)},l.prototype.push=function(e){var t=this.ops.length,r=this.ops[t-1];if(e=a(!0,{},e),"object"==typeof r){if("number"==typeof e.delete&&"number"==typeof r.delete)return this.ops[t-1]={delete:r.delete+e.delete},this;if("number"==typeof r.delete&&null!=e.insert&&(t-=1,"object"!=typeof(r=this.ops[t-1])))return this.ops.unshift(e),this;if(o(e.attributes,r.attributes)){if("string"==typeof e.insert&&"string"==typeof r.insert)return this.ops[t-1]={insert:r.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof r.retain)return this.ops[t-1]={retain:r.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},l.prototype.chop=function(){var e=this.ops[this.ops.length-1];return e&&e.retain&&!e.attributes&&this.ops.pop(),this},l.prototype.filter=function(e){return this.ops.filter(e)},l.prototype.forEach=function(e){this.ops.forEach(e)},l.prototype.map=function(e){return this.ops.map(e)},l.prototype.partition=function(e){var t=[],r=[];return this.forEach(function(n){(e(n)?t:r).push(n)}),[t,r]},l.prototype.reduce=function(e,t){return this.ops.reduce(e,t)},l.prototype.changeLength=function(){return this.reduce(function(e,t){return t.insert?e+i.length(t):t.delete?e-t.delete:e},0)},l.prototype.length=function(){return this.reduce(function(e,t){return e+i.length(t)},0)},l.prototype.slice=function(e,t){e=e||0,"number"!=typeof t&&(t=1/0);for(var r=[],n=i.iterator(this.ops),o=0;o<t&&n.hasNext();){var a;o<e?a=n.next(e-o):(a=n.next(t-o),r.push(a)),o+=i.length(a)}return new l(r)},l.prototype.compose=function(e){var t=i.iterator(this.ops),r=i.iterator(e.ops),n=[],a=r.peek();if(null!=a&&"number"==typeof a.retain&&null==a.attributes){for(var s=a.retain;"insert"===t.peekType()&&t.peekLength()<=s;)s-=t.peekLength(),n.push(t.next());a.retain-s>0&&r.next(a.retain-s)}for(var c=new l(n);t.hasNext()||r.hasNext();)if("insert"===r.peekType())c.push(r.next());else if("delete"===t.peekType())c.push(t.next());else{var u=Math.min(t.peekLength(),r.peekLength()),d=t.next(u),f=r.next(u);if("number"==typeof f.retain){var p={};"number"==typeof d.retain?p.retain=u:p.insert=d.insert;var h=i.attributes.compose(d.attributes,f.attributes,"number"==typeof d.retain);if(h&&(p.attributes=h),c.push(p),!r.hasNext()&&o(c.ops[c.ops.length-1],p)){var m=new l(t.rest());return c.concat(m).chop()}}else"number"==typeof f.delete&&"number"==typeof d.retain&&c.push(f)}return c.chop()},l.prototype.concat=function(e){var t=new l(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t},l.prototype.diff=function(e,t){if(this.ops===e.ops)return new l;var r=[this,e].map(function(t){return t.map(function(r){if(null!=r.insert)return"string"==typeof r.insert?r.insert:s;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")}),a=new l,c=n(r[0],r[1],t),u=i.iterator(this.ops),d=i.iterator(e.ops);return c.forEach(function(e){for(var t=e[1].length;t>0;){var r=0;switch(e[0]){case n.INSERT:r=Math.min(d.peekLength(),t),a.push(d.next(r));break;case n.DELETE:r=Math.min(t,u.peekLength()),u.next(r),a.delete(r);break;case n.EQUAL:r=Math.min(u.peekLength(),d.peekLength(),t);var s=u.next(r),l=d.next(r);o(s.insert,l.insert)?a.retain(r,i.attributes.diff(s.attributes,l.attributes)):a.push(l).delete(r)}t-=r}}),a.chop()},l.prototype.eachLine=function(e,t){t=t||"\n";for(var r=i.iterator(this.ops),n=new l,o=0;r.hasNext();){if("insert"!==r.peekType())return;var a=r.peek(),s=i.length(a)-r.peekLength(),c="string"==typeof a.insert?a.insert.indexOf(t,s)-s:-1;if(c<0)n.push(r.next());else if(c>0)n.push(r.next(c));else{if(!1===e(n,r.next(1).attributes||{},o))return;o+=1,n=new l}}n.length()>0&&e(n,{},o)},l.prototype.transform=function(e,t){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);for(var r=i.iterator(this.ops),n=i.iterator(e.ops),o=new l;r.hasNext()||n.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===n.peekType())if("insert"===n.peekType())o.push(n.next());else{var a=Math.min(r.peekLength(),n.peekLength()),s=r.next(a),c=n.next(a);if(s.delete)continue;c.delete?o.push(c):o.retain(a,i.attributes.transform(s.attributes,c.attributes,t))}else o.retain(i.length(r.next()));return o.chop()},l.prototype.transformPosition=function(e,t){t=!!t;for(var r=i.iterator(this.ops),n=0;r.hasNext()&&n<=e;){var o=r.peekLength(),a=r.peekType();r.next(),"delete"!==a?("insert"===a&&(n<e||!t)&&(e+=o),n+=o):e-=Math.min(o,e-n)}return e},e.exports=l},function(e,t){var r=Object.prototype.hasOwnProperty,n=Object.prototype.toString,o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===n.call(e)},s=function(e){if(!e||"[object Object]"!==n.call(e))return!1;var t,o=r.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&r.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!o&&!a)return!1;for(t in e);return void 0===t||r.call(e,t)},l=function(e,t){o&&"__proto__"===t.name?o(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!r.call(e,t))return;if(a)return a(e,t).value}return e[t]};e.exports=function e(){var t,r,n,o,a,u,d=arguments[0],f=1,p=arguments.length,h=!1;for("boolean"==typeof d&&(h=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<p;++f)if(null!=(t=arguments[f]))for(r in t)n=c(d,r),d!==(o=c(t,r))&&(h&&o&&(s(o)||(a=i(o)))?(a?(a=!1,u=n&&i(n)?n:[]):u=n&&s(n)?n:{},l(d,{name:r,newValue:e(h,u,o)})):void 0!==o&&l(d,{name:r,newValue:o}));return d}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BlockEmbed=t.bubbleFormats=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=d(r(3)),i=d(r(2)),s=d(r(0)),l=d(r(16)),c=d(r(6)),u=d(r(7));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),n(t,[{key:"attach",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"attach",this).call(this),this.attributes=new s.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return(new i.default).insert(this.value(),(0,a.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function(e,t){var r=s.default.query(e,s.default.Scope.BLOCK_ATTRIBUTE);null!=r&&this.attributes.attribute(r,t)}},{key:"formatAt",value:function(e,t,r,n){this.format(r,n)}},{key:"insertAt",value:function(e,r,n){if("string"==typeof r&&r.endsWith("\n")){var a=s.default.create(y.blotName);this.parent.insertBefore(a,0===e?this:this.next),a.insertAt(0,r.slice(0,-1))}else o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,r,n)}}]),t}(s.default.Embed);m.scope=s.default.Scope.BLOCK_BLOT;var y=function(e){function t(e){f(this,t);var r=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.cache={},r}return h(t,e),n(t,[{key:"delta",value:function(){return null==this.cache.delta&&(this.cache.delta=this.descendants(s.default.Leaf).reduce(function(e,t){return 0===t.length()?e:e.insert(t.value(),g(t))},new i.default).insert("\n",g(this))),this.cache.delta}},{key:"deleteAt",value:function(e,r){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,r),this.cache={}}},{key:"formatAt",value:function(e,r,n,a){r<=0||(s.default.query(n,s.default.Scope.BLOCK)?e+r===this.length()&&this.format(n,a):o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,Math.min(r,this.length()-e-1),n,a),this.cache={})}},{key:"insertAt",value:function(e,r,n){if(null!=n)return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,r,n);if(0!==r.length){var a=r.split("\n"),i=a.shift();i.length>0&&(e<this.length()-1||null==this.children.tail?o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});var s=this;a.reduce(function(e,t){return(s=s.split(e,!0)).insertAt(0,t),t.length},e+i.length)}}},{key:"insertBefore",value:function(e,r){var n=this.children.head;o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,r),n instanceof l.default&&n.remove(),this.cache={}}},{key:"length",value:function(){return null==this.cache.length&&(this.cache.length=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"length",this).call(this)+1),this.cache.length}},{key:"moveChildren",value:function(e,r){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"moveChildren",this).call(this,e,r),this.cache={}}},{key:"optimize",value:function(e){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.cache={}}},{key:"path",value:function(e){return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e,!0)}},{key:"removeChild",value:function(e){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"removeChild",this).call(this,e),this.cache={}}},{key:"split",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(r&&(0===e||e>=this.length()-1)){var n=this.clone();return 0===e?(this.parent.insertBefore(n,this),this):(this.parent.insertBefore(n,this.next),n)}var a=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"split",this).call(this,e,r);return this.cache={},a}}]),t}(s.default.Block);function g(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==e?t:("function"==typeof e.formats&&(t=(0,a.default)(t,e.formats())),null==e.parent||"scroll"==e.parent.blotName||e.parent.statics.scope!==e.statics.scope?t:g(e.parent,t))}y.blotName="block",y.tagName="P",y.defaultChild="break",y.allowedChildren=[c.default,s.default.Embed,u.default],t.bubbleFormats=g,t.BlockEmbed=m,t.default=y},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.overload=t.expandConfig=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();r(50);var i=y(r(2)),s=y(r(14)),l=y(r(8)),c=y(r(9)),u=y(r(0)),d=r(15),f=y(d),p=y(r(3)),h=y(r(10)),m=y(r(34));function y(e){return e&&e.__esModule?e:{default:e}}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var v=(0,h.default)("quill"),b=function(){function e(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=x(t,n),this.container=this.options.container,null==this.container)return v.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);var o=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new l.default,this.scroll=u.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new s.default(this.scroll),this.selection=new f.default(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.theme.init(),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e){e===l.default.events.TEXT_CHANGE&&r.root.classList.toggle("ql-blank",r.editor.isBlank())}),this.emitter.on(l.default.events.SCROLL_UPDATE,function(e,t){var n=r.selection.lastRange,o=n&&0===n.length?n.index:void 0;w.call(r,function(){return r.editor.update(null,t,o)},e)});var a=this.clipboard.convert("<div class='ql-editor' style=\"white-space: normal;\">"+o+"<p><br></p></div>");this.setContents(a),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return a(e,null,[{key:"debug",value:function(e){!0===e&&(e="log"),h.default.level(e)}},{key:"find",value:function(e){return e.__quill||u.default.find(e)}},{key:"import",value:function(e){return null==this.imports[e]&&v.error("Cannot import "+e+". Are you sure it was registered?"),this.imports[e]}},{key:"register",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof e){var o=e.attrName||e.blotName;"string"==typeof o?this.register("formats/"+o,e,t):Object.keys(e).forEach(function(n){r.register(n,e[n],t)})}else null==this.imports[e]||n||v.warn("Overwriting "+e+" with",t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&"abstract"!==t.blotName?u.default.register(t):e.startsWith("modules")&&"function"==typeof t.register&&t.register()}}]),a(e,[{key:"addContainer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){var r=e;(e=document.createElement("div")).classList.add(r)}return this.container.insertBefore(e,t),e}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(e,t,r){var n=this,a=N(e,t,r),i=o(a,4);return e=i[0],t=i[1],r=i[3],w.call(this,function(){return n.editor.deleteText(e,t)},r,e,-1*t)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}},{key:"focus",value:function(){var e=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=e,this.scrollIntoView()}},{key:"format",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;return w.call(this,function(){var n=r.getSelection(!0),o=new i.default;if(null==n)return o;if(u.default.query(e,u.default.Scope.BLOCK))o=r.editor.formatLine(n.index,n.length,g({},e,t));else{if(0===n.length)return r.selection.format(e,t),o;o=r.editor.formatText(n.index,n.length,g({},e,t))}return r.setSelection(n,l.default.sources.SILENT),o},n)}},{key:"formatLine",value:function(e,t,r,n,a){var i,s=this,l=N(e,t,r,n,a),c=o(l,4);return e=c[0],t=c[1],i=c[2],a=c[3],w.call(this,function(){return s.editor.formatLine(e,t,i)},a,e,0)}},{key:"formatText",value:function(e,t,r,n,a){var i,s=this,l=N(e,t,r,n,a),c=o(l,4);return e=c[0],t=c[1],i=c[2],a=c[3],w.call(this,function(){return s.editor.formatText(e,t,i)},a,e,0)}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=void 0;r="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length);var n=this.container.getBoundingClientRect();return{bottom:r.bottom-n.top,height:r.height,left:r.left-n.left,right:r.right-n.left,top:r.top-n.top,width:r.width}}},{key:"getContents",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,r=N(e,t),n=o(r,2);return e=n[0],t=n[1],this.editor.getContents(e,t)}},{key:"getFormat",value:function(){var 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)}},{key:"getIndex",value:function(e){return e.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(e){return this.scroll.leaf(e)}},{key:"getLine",value:function(e){return this.scroll.line(e)}},{key:"getLines",value:function(){var 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)}},{key:"getModule",value:function(e){return this.theme.modules[e]}},{key:"getSelection",value:function(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,r=N(e,t),n=o(r,2);return e=n[0],t=n[1],this.editor.getText(e,t)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(t,r,n){var o=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return w.call(this,function(){return o.editor.insertEmbed(t,r,n)},a,t)}},{key:"insertText",value:function(e,t,r,n,a){var i,s=this,l=N(e,0,r,n,a),c=o(l,4);return e=c[0],i=c[2],a=c[3],w.call(this,function(){return s.editor.insertText(e,t,i)},a,e,t.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(e,t,r){this.clipboard.dangerouslyPasteHTML(e,t,r)}},{key:"removeFormat",value:function(e,t,r){var n=this,a=N(e,t,r),i=o(a,4);return e=i[0],t=i[1],r=i[3],w.call(this,function(){return n.editor.removeFormat(e,t)},r,e)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){e=new i.default(e);var r=t.getLength(),n=t.editor.deleteText(0,r),o=t.editor.applyDelta(e),a=o.ops[o.ops.length-1];return null!=a&&"string"==typeof a.insert&&"\n"===a.insert[a.insert.length-1]&&(t.editor.deleteText(t.getLength()-1,1),o.delete(1)),n.compose(o)},r)}},{key:"setSelection",value:function(t,r,n){if(null==t)this.selection.setRange(null,r||e.sources.API);else{var a=N(t,r,n),i=o(a,4);t=i[0],r=i[1],n=i[3],this.selection.setRange(new d.Range(t,r),n),n!==l.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API,r=(new i.default).insert(e);return this.setContents(r,t)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.scroll.update(e);return this.selection.update(e),t}},{key:"updateContents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){return e=new i.default(e),t.editor.applyDelta(e,r)},r,!0)}}]),e}();function x(e,t){if((t=(0,p.default)(!0,{container:e,modules:{clipboard:!0,keyboard:!0,history:!0}},t)).theme&&t.theme!==b.DEFAULTS.theme){if(t.theme=b.import("themes/"+t.theme),null==t.theme)throw new Error("Invalid theme "+t.theme+". Did you register it?")}else t.theme=m.default;var r=(0,p.default)(!0,{},t.theme.DEFAULTS);[r,t].forEach(function(e){e.modules=e.modules||{},Object.keys(e.modules).forEach(function(t){!0===e.modules[t]&&(e.modules[t]={})})});var n=Object.keys(r.modules).concat(Object.keys(t.modules)).reduce(function(e,t){var r=b.import("modules/"+t);return null==r?v.error("Cannot load "+t+" module. Are you sure you registered it?"):e[t]=r.DEFAULTS||{},e},{});return null!=t.modules&&t.modules.toolbar&&t.modules.toolbar.constructor!==Object&&(t.modules.toolbar={container:t.modules.toolbar}),t=(0,p.default)(!0,{},b.DEFAULTS,{modules:n},r,t),["bounds","container","scrollingContainer"].forEach(function(e){"string"==typeof t[e]&&(t[e]=document.querySelector(t[e]))}),t.modules=Object.keys(t.modules).reduce(function(e,r){return t.modules[r]&&(e[r]=t.modules[r]),e},{}),t}function w(e,t,r,n){if(this.options.strict&&!this.isEnabled()&&t===l.default.sources.USER)return new i.default;var o=null==r?null:this.getSelection(),a=this.editor.delta,s=e();if(null!=o&&(!0===r&&(r=o.index),null==n?o=j(o,s,t):0!==n&&(o=j(o,r,n,t)),this.setSelection(o,l.default.sources.SILENT)),s.length()>0){var c,u,d=[l.default.events.TEXT_CHANGE,s,a,t];(c=this.emitter).emit.apply(c,[l.default.events.EDITOR_CHANGE].concat(d)),t!==l.default.sources.SILENT&&(u=this.emitter).emit.apply(u,d)}return s}function N(e,t,r,o,a){var i={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(a=o,o=r,r=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(a=o,o=r,r=t,t=0),"object"===(void 0===r?"undefined":n(r))?(i=r,a=o):"string"==typeof r&&(null!=o?i[r]=o:a=r),[e,t,i,a=a||l.default.sources.API]}function j(e,t,r,n){if(null==e)return null;var a=void 0,s=void 0;if(t instanceof i.default){var c=[e.index,e.index+e.length].map(function(e){return t.transformPosition(e,n!==l.default.sources.USER)}),u=o(c,2);a=u[0],s=u[1]}else{var f=[e.index,e.index+e.length].map(function(e){return e<t||e===t&&n===l.default.sources.USER?e:r>=0?e+r:Math.max(t,e+r)}),p=o(f,2);a=p[0],s=p[1]}return new d.Range(a,s-a)}b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},b.events=l.default.events,b.sources=l.default.sources,b.version="1.3.7",b.imports={delta:i.default,parchment:u.default,"core/module":c.default,"core/theme":m.default},t.expandConfig=x,t.overload=N,t.default=b},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=s(r(7)),i=s(r(0));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"formatAt",value:function(e,r,n,a){if(t.compare(this.statics.blotName,n)<0&&i.default.query(n,i.default.Scope.BLOT)){var s=this.isolate(e,r);a&&s.wrap(n,a)}else o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,r,n,a)}},{key:"optimize",value:function(e){if(o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){var r=this.parent.isolate(this.offset(),this.length());this.moveChildren(r),r.wrap(this)}}}],[{key:"compare",value:function(e,r){var n=t.order.indexOf(e),o=t.order.indexOf(r);return n>=0||o>=0?n-o:e===r?0:e<r?-1:1}}]),t}(i.default.Inline);l.allowedChildren=[l,i.default.Embed,a.default],l.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default.Text);t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=i(r(54));function i(e){return e&&e.__esModule?e:{default:e}}var s=(0,i(r(10)).default)("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(function(e){document.addEventListener(e,function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(e){var r;e.__quill&&e.__quill.emitter&&(r=e.__quill.emitter).handleDOM.apply(r,t)})})});var l=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.listeners={},e.on("error",s.error),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"emit",value:function(){s.log.apply(s,arguments),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];(this.listeners[e.type]||[]).forEach(function(t){var n=t.node,o=t.handler;(e.target===n||n.contains(e.target))&&o.apply(void 0,[e].concat(r))})}},{key:"listenDOM",value:function(e,t,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({node:t,handler:r})}}]),t}(a.default);l.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},l.sources={API:"api",SILENT:"silent",USER:"user"},t.default=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.quill=t,this.options=r};n.DEFAULTS={},t.default=n},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=["error","warn","log","info"],o="warn";function a(e){if(n.indexOf(e)<=n.indexOf(o)){for(var t,r=arguments.length,a=Array(r>1?r-1:0),i=1;i<r;i++)a[i-1]=arguments[i];(t=console)[e].apply(t,a)}}function i(e){return n.reduce(function(t,r){return t[r]=a.bind(console,r,e),t},{})}a.level=i.level=function(e){o=e},t.default=i},function(e,t,r){var n=Array.prototype.slice,o=r(52),a=r(53),i=e.exports=function(e,t,r){return r||(r={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?r.strict?e===t:e==t:function(e,t,r){var c,u;if(s(e)||s(t))return!1;if(e.prototype!==t.prototype)return!1;if(a(e))return!!a(t)&&(e=n.call(e),t=n.call(t),i(e,t,r));if(l(e)){if(!l(t))return!1;if(e.length!==t.length)return!1;for(c=0;c<e.length;c++)if(e[c]!==t[c])return!1;return!0}try{var d=o(e),f=o(t)}catch(e){return!1}if(d.length!=f.length)return!1;for(d.sort(),f.sort(),c=d.length-1;c>=0;c--)if(d[c]!=f[c])return!1;for(c=d.length-1;c>=0;c--)if(u=d[c],!i(e[u],t[u],r))return!1;return typeof e==typeof t}(e,t,r))};function s(e){return null==e}function l(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length||"function"!=typeof e.copy||"function"!=typeof e.slice||e.length>0&&"number"!=typeof e[0])}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e,t,r){void 0===r&&(r={}),this.attrName=e,this.keyName=t;var o=n.Scope.TYPE&n.Scope.ATTRIBUTE;null!=r.scope?this.scope=r.scope&n.Scope.LEVEL|o:this.scope=n.Scope.ATTRIBUTE,null!=r.whitelist&&(this.whitelist=r.whitelist)}return e.keys=function(e){return[].map.call(e.attributes,function(e){return e.name})},e.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)},e.prototype.canAdd=function(e,t){return null!=n.query(e,n.Scope.BLOT&(this.scope|n.Scope.TYPE))&&(null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1))},e.prototype.remove=function(e){e.removeAttribute(this.keyName)},e.prototype.value=function(e){var t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""},e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Code=void 0;var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=d(r(2)),s=d(r(0)),l=d(r(4)),c=d(r(6)),u=d(r(7));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),t}(c.default);m.blotName="code",m.tagName="CODE";var y=function(e){function t(){return f(this,t),p(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return h(t,e),o(t,[{key:"delta",value:function(){var e=this,t=this.domNode.textContent;return t.endsWith("\n")&&(t=t.slice(0,-1)),t.split("\n").reduce(function(t,r){return t.insert(r).insert("\n",e.formats())},new i.default)}},{key:"format",value:function(e,r){if(e!==this.statics.blotName||!r){var o=this.descendant(u.default,this.length()-1),i=n(o,1)[0];null!=i&&i.deleteAt(i.length()-1,1),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r)}}},{key:"formatAt",value:function(e,r,n,o){if(0!==r&&null!=s.default.query(n,s.default.Scope.BLOCK)&&(n!==this.statics.blotName||o!==this.statics.formats(this.domNode))){var a=this.newlineIndex(e);if(!(a<0||a>=e+r)){var i=this.newlineIndex(e,!0)+1,l=a-i+1,c=this.isolate(i,l),u=c.next;c.format(n,o),u instanceof t&&u.formatAt(0,e-i+r-l,n,o)}}}},{key:"insertAt",value:function(e,t,r){if(null==r){var o=this.descendant(u.default,e),a=n(o,2),i=a[0],s=a[1];i.insertAt(s,t)}}},{key:"length",value:function(){var e=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?e:e+1}},{key:"newlineIndex",value:function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1])return this.domNode.textContent.slice(0,e).lastIndexOf("\n");var t=this.domNode.textContent.slice(e).indexOf("\n");return t>-1?e+t:-1}},{key:"optimize",value:function(e){this.domNode.textContent.endsWith("\n")||this.appendChild(s.default.create("text","\n")),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===r.statics.formats(r.domNode)&&(r.optimize(e),r.moveChildren(this),r.remove())}},{key:"replace",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(e){var t=s.default.find(e);null==t?e.parentNode.removeChild(e):t instanceof s.default.Embed?t.remove():t.unwrap()})}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return r.setAttribute("spellcheck",!1),r}},{key:"formats",value:function(){return!0}}]),t}(l.default);y.blotName="code-block",y.tagName="PRE",y.TAB=" ",t.Code=m,t.default=y},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=g(r(2)),s=g(r(20)),l=g(r(0)),c=g(r(13)),u=g(r(24)),d=r(4),f=g(d),p=g(r(16)),h=g(r(21)),m=g(r(11)),y=g(r(3));function g(e){return e&&e.__esModule?e:{default:e}}var v=/^[ -~]*$/,b=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.scroll=t,this.delta=this.getDelta()}return a(e,[{key:"applyDelta",value:function(e){var t=this,r=!1;this.scroll.update();var a=this.scroll.length();return this.scroll.batchStart(),(e=function(e){return e.reduce(function(e,t){if(1===t.insert){var r=(0,h.default)(t.attributes);return delete r.image,e.insert({image:t.attributes.image},r)}if(null==t.attributes||!0!==t.attributes.list&&!0!==t.attributes.bullet||((t=(0,h.default)(t)).attributes.list?t.attributes.list="ordered":(t.attributes.list="bullet",delete t.attributes.bullet)),"string"==typeof t.insert){var n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new i.default)}(e)).reduce(function(e,i){var c=i.retain||i.delete||i.insert.length||1,u=i.attributes||{};if(null!=i.insert){if("string"==typeof i.insert){var p=i.insert;p.endsWith("\n")&&r&&(r=!1,p=p.slice(0,-1)),e>=a&&!p.endsWith("\n")&&(r=!0),t.scroll.insertAt(e,p);var h=t.scroll.line(e),m=o(h,2),g=m[0],v=m[1],b=(0,y.default)({},(0,d.bubbleFormats)(g));if(g instanceof f.default){var x=g.descendant(l.default.Leaf,v),w=o(x,1)[0];b=(0,y.default)(b,(0,d.bubbleFormats)(w))}u=s.default.attributes.diff(b,u)||{}}else if("object"===n(i.insert)){var N=Object.keys(i.insert)[0];if(null==N)return e;t.scroll.insertAt(e,N,i.insert[N])}a+=c}return Object.keys(u).forEach(function(r){t.scroll.formatAt(e,c,r,u[r])}),e+c},0),e.reduce(function(e,r){return"number"==typeof r.delete?(t.scroll.deleteAt(e,r.delete),e):e+(r.retain||r.insert.length||1)},0),this.scroll.batchEnd(),this.update(e)}},{key:"deleteText",value:function(e,t){return this.scroll.deleteAt(e,t),this.update((new i.default).retain(e).delete(t))}},{key:"formatLine",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(n).forEach(function(o){if(null==r.scroll.whitelist||r.scroll.whitelist[o]){var a=r.scroll.lines(e,Math.max(t,1)),i=t;a.forEach(function(t){var a=t.length();if(t instanceof c.default){var s=e-t.offset(r.scroll),l=t.newlineIndex(s+i)-s+1;t.formatAt(s,l,o,n[o])}else t.format(o,n[o]);i-=a})}}),this.scroll.optimize(),this.update((new i.default).retain(e).retain(t,(0,h.default)(n)))}},{key:"formatText",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(n).forEach(function(o){r.scroll.formatAt(e,t,o,n[o])}),this.update((new i.default).retain(e).retain(t,(0,h.default)(n)))}},{key:"getContents",value:function(e,t){return this.delta.slice(e,e+t)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(e,t){return e.concat(t.delta())},new i.default)}},{key:"getFormat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[],n=[];0===t?this.scroll.path(e).forEach(function(e){var t=o(e,1)[0];t instanceof f.default?r.push(t):t instanceof l.default.Leaf&&n.push(t)}):(r=this.scroll.lines(e,t),n=this.scroll.descendants(l.default.Leaf,e,t));var a=[r,n].map(function(e){if(0===e.length)return{};for(var t=(0,d.bubbleFormats)(e.shift());Object.keys(t).length>0;){var r=e.shift();if(null==r)return t;t=x((0,d.bubbleFormats)(r),t)}return t});return y.default.apply(y.default,a)}},{key:"getText",value:function(e,t){return this.getContents(e,t).filter(function(e){return"string"==typeof e.insert}).map(function(e){return e.insert}).join("")}},{key:"insertEmbed",value:function(e,t,r){return this.scroll.insertAt(e,t,r),this.update((new i.default).retain(e).insert(function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},t,r)))}},{key:"insertText",value:function(e,t){var r=this,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(function(o){r.scroll.formatAt(e,t.length,o,n[o])}),this.update((new i.default).retain(e).insert(t,(0,h.default)(n)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var e=this.scroll.children.head;return e.statics.blotName===f.default.blotName&&!(e.children.length>1)&&e.children.head instanceof p.default}},{key:"removeFormat",value:function(e,t){var r=this.getText(e,t),n=this.scroll.line(e+t),a=o(n,2),s=a[0],l=a[1],u=0,d=new i.default;null!=s&&(u=s instanceof c.default?s.newlineIndex(l)-l+1:s.length()-l,d=s.delta().slice(l,l+u-1).insert("\n"));var f=this.getContents(e,t+u).diff((new i.default).insert(r).concat(d)),p=(new i.default).retain(e).concat(f);return this.applyDelta(p)}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(v)&&l.default.find(t[0].target)){var o=l.default.find(t[0].target),a=(0,d.bubbleFormats)(o),s=o.offset(this.scroll),c=t[0].oldValue.replace(u.default.CONTENTS,""),f=(new i.default).insert(c),p=(new i.default).insert(o.value());e=(new i.default).retain(s).concat(f.diff(p,r)).reduce(function(e,t){return t.insert?e.insert(t.insert,a):e.push(t)},new i.default),this.delta=n.compose(e)}else this.delta=this.getDelta(),e&&(0,m.default)(n.compose(e),this.delta)||(e=n.diff(this.delta,r));return e}}]),e}();function x(e,t){return Object.keys(t).reduce(function(r,n){return null==e[n]||(t[n]===e[n]?r[n]=t[n]:Array.isArray(t[n])?t[n].indexOf(e[n])<0&&(r[n]=t[n].concat([e[n]])):r[n]=[t[n],e[n]]),r},{})}t.default=b},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Range=void 0;var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=c(r(0)),i=c(r(21)),s=c(r(11)),l=c(r(8));function c(e){return e&&e.__esModule?e:{default:e}}function u(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var f=(0,c(r(10)).default)("quill:selection"),p=function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;d(this,e),this.index=t,this.length=r},h=function(){function e(t,r){var n=this;d(this,e),this.emitter=r,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=a.default.create("cursor",this),this.lastRange=this.savedRange=new p(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){n.mouseDown||setTimeout(n.update.bind(n,l.default.sources.USER),1)}),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e,t){e===l.default.events.TEXT_CHANGE&&t.length()>0&&n.update(l.default.sources.SILENT)}),this.emitter.on(l.default.events.SCROLL_BEFORE_UPDATE,function(){if(n.hasFocus()){var e=n.getNativeRange();null!=e&&e.start.node!==n.cursor.textNode&&n.emitter.once(l.default.events.SCROLL_UPDATE,function(){try{n.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset)}catch(e){}})}}),this.emitter.on(l.default.events.SCROLL_OPTIMIZE,function(e,t){if(t.range){var r=t.range,o=r.startNode,a=r.startOffset,i=r.endNode,s=r.endOffset;n.setNativeRange(o,a,i,s)}}),this.update(l.default.sources.SILENT)}return o(e,[{key:"handleComposition",value:function(){var e=this;this.root.addEventListener("compositionstart",function(){e.composing=!0}),this.root.addEventListener("compositionend",function(){if(e.composing=!1,e.cursor.parent){var t=e.cursor.restore();if(!t)return;setTimeout(function(){e.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}},{key:"handleDragging",value:function(){var e=this;this.emitter.listenDOM("mousedown",document.body,function(){e.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){e.mouseDown=!1,e.update(l.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(e,t){if(null==this.scroll.whitelist||this.scroll.whitelist[e]){this.scroll.update();var r=this.getNativeRange();if(null!=r&&r.native.collapsed&&!a.default.query(e,a.default.Scope.BLOCK)){if(r.start.node!==this.cursor.textNode){var n=a.default.find(r.start.node,!1);if(null==n)return;if(n instanceof a.default.Leaf){var o=n.split(r.start.offset);n.parent.insertBefore(this.cursor,o)}else n.insertBefore(this.cursor,r.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()}}}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=this.scroll.length();e=Math.min(e,r-1),t=Math.min(e+t,r-1)-e;var o=void 0,a=this.scroll.leaf(e),i=n(a,2),s=i[0],l=i[1];if(null==s)return null;var c=s.position(l,!0),u=n(c,2);o=u[0],l=u[1];var d=document.createRange();if(t>0){d.setStart(o,l);var f=this.scroll.leaf(e+t),p=n(f,2);if(s=p[0],l=p[1],null==s)return null;var h=s.position(l,!0),m=n(h,2);return o=m[0],l=m[1],d.setEnd(o,l),d.getBoundingClientRect()}var y="left",g=void 0;return o instanceof Text?(l<o.data.length?(d.setStart(o,l),d.setEnd(o,l+1)):(d.setStart(o,l-1),d.setEnd(o,l),y="right"),g=d.getBoundingClientRect()):(g=s.domNode.getBoundingClientRect(),l>0&&(y="right")),{bottom:g.top+g.height,height:g.height,left:g[y],right:g[y],top:g.top,width:0}}},{key:"getNativeRange",value:function(){var e=document.getSelection();if(null==e||e.rangeCount<=0)return null;var t=e.getRangeAt(0);if(null==t)return null;var r=this.normalizeNative(t);return f.info("getNativeRange",r),r}},{key:"getRange",value:function(){var e=this.getNativeRange();return null==e?[null,null]:[this.normalizedToRange(e),e]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(e){var t=this,r=[[e.start.node,e.start.offset]];e.native.collapsed||r.push([e.end.node,e.end.offset]);var o=r.map(function(e){var r=n(e,2),o=r[0],i=r[1],s=a.default.find(o,!0),l=s.offset(t.scroll);return 0===i?l:s instanceof a.default.Container?l+s.length():l+s.index(o,i)}),i=Math.min(Math.max.apply(Math,u(o)),this.scroll.length()-1),s=Math.min.apply(Math,[i].concat(u(o)));return new p(s,i-s)}},{key:"normalizeNative",value:function(e){if(!m(this.root,e.startContainer)||!e.collapsed&&!m(this.root,e.endContainer))return null;var t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(function(e){for(var t=e.node,r=e.offset;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>r)t=t.childNodes[r],r=0;else{if(t.childNodes.length!==r)break;r=(t=t.lastChild)instanceof Text?t.data.length:t.childNodes.length+1}e.node=t,e.offset=r}),t}},{key:"rangeToNative",value:function(e){var t=this,r=e.collapsed?[e.index]:[e.index,e.index+e.length],o=[],a=this.scroll.length();return r.forEach(function(e,r){e=Math.min(a-1,e);var i,s=t.scroll.leaf(e),l=n(s,2),c=l[0],u=l[1],d=c.position(u,0!==r),f=n(d,2);i=f[0],u=f[1],o.push(i,u)}),o.length<2&&(o=o.concat(o)),o}},{key:"scrollIntoView",value:function(e){var t=this.lastRange;if(null!=t){var r=this.getBounds(t.index,t.length);if(null!=r){var o=this.scroll.length()-1,a=this.scroll.line(Math.min(t.index,o)),i=n(a,1)[0],s=i;if(t.length>0){var l=this.scroll.line(Math.min(t.index+t.length,o));s=n(l,1)[0]}if(null!=i&&null!=s){var c=e.getBoundingClientRect();r.top<c.top?e.scrollTop-=c.top-r.top:r.bottom>c.bottom&&(e.scrollTop+=r.bottom-c.bottom)}}}}},{key:"setNativeRange",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(f.info("setNativeRange",e,t,r,n),null==e||null!=this.root.parentNode&&null!=e.parentNode&&null!=r.parentNode){var a=document.getSelection();if(null!=a)if(null!=e){this.hasFocus()||this.root.focus();var i=(this.getNativeRange()||{}).native;if(null==i||o||e!==i.startContainer||t!==i.startOffset||r!==i.endContainer||n!==i.endOffset){"BR"==e.tagName&&(t=[].indexOf.call(e.parentNode.childNodes,e),e=e.parentNode),"BR"==r.tagName&&(n=[].indexOf.call(r.parentNode.childNodes,r),r=r.parentNode);var s=document.createRange();s.setStart(e,t),s.setEnd(r,n),a.removeAllRanges(),a.addRange(s)}}else a.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;if("string"==typeof t&&(r=t,t=!1),f.info("setRange",e),null!=e){var n=this.rangeToNative(e);this.setNativeRange.apply(this,u(n).concat([t]))}else this.setNativeRange(null);this.update(r)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.lastRange,r=this.getRange(),o=n(r,2),a=o[0],c=o[1];if(this.lastRange=a,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,s.default)(t,this.lastRange)){var u;!this.composing&&null!=c&&c.native.collapsed&&c.start.node!==this.cursor.textNode&&this.cursor.restore();var d,f=[l.default.events.SELECTION_CHANGE,(0,i.default)(this.lastRange),(0,i.default)(t),e];(u=this.emitter).emit.apply(u,[l.default.events.EDITOR_CHANGE].concat(f)),e!==l.default.sources.SILENT&&(d=this.emitter).emit.apply(d,f)}}}]),e}();function m(e,t){try{t.parentNode}catch(e){return!1}return t instanceof Text&&(t=t.parentNode),e.contains(t)}t.Range=p,t.default=h},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"insertInto",value:function(e,r){0===e.children.length?a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertInto",this).call(this,e,r):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default.Embed);s.blotName="break",s.tagName="BR",t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(44),i=r(30),s=r(1),l=function(e){function t(t){var r=e.call(this,t)||this;return r.build(),r}return o(t,e),t.prototype.appendChild=function(e){this.insertBefore(e)},t.prototype.attach=function(){e.prototype.attach.call(this),this.children.forEach(function(e){e.attach()})},t.prototype.build=function(){var e=this;this.children=new a.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(t){try{var r=c(t);e.insertBefore(r,e.children.head||void 0)}catch(e){if(e instanceof s.ParchmentError)return;throw e}})},t.prototype.deleteAt=function(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,function(e,t,r){e.deleteAt(t,r)})},t.prototype.descendant=function(e,r){var n=this.children.find(r),o=n[0],a=n[1];return null==e.blotName&&e(o)||null!=e.blotName&&o instanceof e?[o,a]:o instanceof t?o.descendant(e,a):[null,-1]},t.prototype.descendants=function(e,r,n){void 0===r&&(r=0),void 0===n&&(n=Number.MAX_VALUE);var o=[],a=n;return this.children.forEachAt(r,n,function(r,n,i){(null==e.blotName&&e(r)||null!=e.blotName&&r instanceof e)&&o.push(r),r instanceof t&&(o=o.concat(r.descendants(e,n,a))),a-=i}),o},t.prototype.detach=function(){this.children.forEach(function(e){e.detach()}),e.prototype.detach.call(this)},t.prototype.formatAt=function(e,t,r,n){this.children.forEachAt(e,t,function(e,t,o){e.formatAt(t,o,r,n)})},t.prototype.insertAt=function(e,t,r){var n=this.children.find(e),o=n[0],a=n[1];if(o)o.insertAt(a,t,r);else{var i=null==r?s.create("text",t):s.create(t,r);this.appendChild(i)}},t.prototype.insertBefore=function(e,t){if(null!=this.statics.allowedChildren&&!this.statics.allowedChildren.some(function(t){return e instanceof t}))throw new s.ParchmentError("Cannot insert "+e.statics.blotName+" into "+this.statics.blotName);e.insertInto(this,t)},t.prototype.length=function(){return this.children.reduce(function(e,t){return e+t.length()},0)},t.prototype.moveChildren=function(e,t){this.children.forEach(function(r){e.insertBefore(r,t)})},t.prototype.optimize=function(t){if(e.prototype.optimize.call(this,t),0===this.children.length)if(null!=this.statics.defaultChild){var r=s.create(this.statics.defaultChild);this.appendChild(r),r.optimize(t)}else this.remove()},t.prototype.path=function(e,r){void 0===r&&(r=!1);var n=this.children.find(e,r),o=n[0],a=n[1],i=[[this,e]];return o instanceof t?i.concat(o.path(a,r)):(null!=o&&i.push([o,a]),i)},t.prototype.removeChild=function(e){this.children.remove(e)},t.prototype.replace=function(r){r instanceof t&&r.moveChildren(this),e.prototype.replace.call(this,r)},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var r=this.clone();return this.parent.insertBefore(r,this.next),this.children.forEachAt(e,this.length(),function(e,n,o){e=e.split(n,t),r.appendChild(e)}),r},t.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},t.prototype.update=function(e,t){var r=this,n=[],o=[];e.forEach(function(e){e.target===r.domNode&&"childList"===e.type&&(n.push.apply(n,e.addedNodes),o.push.apply(o,e.removedNodes))}),o.forEach(function(e){if(!(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var t=s.find(e);null!=t&&(null!=t.domNode.parentNode&&t.domNode.parentNode!==r.domNode||t.detach())}}),n.filter(function(e){return e.parentNode==r.domNode}).sort(function(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(e){var t=null;null!=e.nextSibling&&(t=s.find(e.nextSibling));var n=c(e);n.next==t&&null!=n.next||(null!=n.parent&&n.parent.removeChild(r),r.insertBefore(n,t||void 0))})},t}(i.default);function c(e){var t=s.find(e);if(null==t)try{t=s.create(e)}catch(r){t=s.create(s.Scope.INLINE),[].slice.call(e.childNodes).forEach(function(e){t.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(t.domNode,e),t.attach()}return t}t.default=l},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(12),i=r(31),s=r(17),l=r(1),c=function(e){function t(t){var r=e.call(this,t)||this;return r.attributes=new i.default(r.domNode),r}return o(t,e),t.formats=function(e){return"string"==typeof this.tagName||(Array.isArray(this.tagName)?e.tagName.toLowerCase():void 0)},t.prototype.format=function(e,t){var r=l.query(e);r instanceof a.default?this.attributes.attribute(r,t):t&&(null==r||e===this.statics.blotName&&this.formats()[e]===t||this.replaceWith(e,t))},t.prototype.formats=function(){var e=this.attributes.values(),t=this.statics.formats(this.domNode);return null!=t&&(e[this.statics.blotName]=t),e},t.prototype.replaceWith=function(t,r){var n=e.prototype.replaceWith.call(this,t,r);return this.attributes.copy(n),n},t.prototype.update=function(t,r){var n=this;e.prototype.update.call(this,t,r),t.some(function(e){return e.target===n.domNode&&"attributes"===e.type})&&this.attributes.build()},t.prototype.wrap=function(r,n){var o=e.prototype.wrap.call(this,r,n);return o instanceof t&&o.statics.scope===this.statics.scope&&this.attributes.move(o),o},t}(s.default);t.default=c},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(30),i=r(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.value=function(e){return!0},t.prototype.index=function(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1},t.prototype.position=function(e,t){var r=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return e>0&&(r+=1),[this.parent.domNode,r]},t.prototype.value=function(){var e;return(e={})[this.statics.blotName]=this.statics.value(this.domNode)||!0,e},t.scope=i.Scope.INLINE_BLOT,t}(a.default);t.default=s},function(e,t,r){var n=r(11),o=r(3),a={attributes:{compose:function(e,t,r){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var n=o(!0,{},t);for(var a in r||(n=Object.keys(n).reduce(function(e,t){return null!=n[t]&&(e[t]=n[t]),e},{})),e)void 0!==e[a]&&void 0===t[a]&&(n[a]=e[a]);return Object.keys(n).length>0?n:void 0},diff:function(e,t){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var r=Object.keys(e).concat(Object.keys(t)).reduce(function(r,o){return n(e[o],t[o])||(r[o]=void 0===t[o]?null:t[o]),r},{});return Object.keys(r).length>0?r:void 0},transform:function(e,t,r){if("object"!=typeof e)return t;if("object"==typeof t){if(!r)return t;var n=Object.keys(t).reduce(function(r,n){return void 0===e[n]&&(r[n]=t[n]),r},{});return Object.keys(n).length>0?n:void 0}}},iterator:function(e){return new i(e)},length:function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"string"==typeof e.insert?e.insert.length:1}};function i(e){this.ops=e,this.index=0,this.offset=0}i.prototype.hasNext=function(){return this.peekLength()<1/0},i.prototype.next=function(e){e||(e=1/0);var t=this.ops[this.index];if(t){var r=this.offset,n=a.length(t);if(e>=n-r?(e=n-r,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof t.delete)return{delete:e};var o={};return t.attributes&&(o.attributes=t.attributes),"number"==typeof t.retain?o.retain=e:"string"==typeof t.insert?o.insert=t.insert.substr(r,e):o.insert=t.insert,o}return{retain:1/0}},i.prototype.peek=function(){return this.ops[this.index]},i.prototype.peekLength=function(){return this.ops[this.index]?a.length(this.ops[this.index])-this.offset:1/0},i.prototype.peekType=function(){return this.ops[this.index]?"number"==typeof this.ops[this.index].delete?"delete":"number"==typeof this.ops[this.index].retain?"retain":"insert":"retain"},i.prototype.rest=function(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);var e=this.offset,t=this.index,r=this.next(),n=this.ops.slice(this.index);return this.offset=e,this.index=t,[r].concat(n)}return[]},e.exports=a},function(e,t){var r=function(){function e(e,t){return null!=t&&e instanceof t}var t,r,n;try{t=Map}catch(e){t=function(){}}try{r=Set}catch(e){r=function(){}}try{n=Promise}catch(e){n=function(){}}function o(a,s,l,c,u){"object"==typeof s&&(l=s.depth,c=s.prototype,u=s.includeNonEnumerable,s=s.circular);var d=[],f=[],p="undefined"!=typeof Buffer;return void 0===s&&(s=!0),void 0===l&&(l=1/0),function a(l,h){if(null===l)return null;if(0===h)return l;var m,y;if("object"!=typeof l)return l;if(e(l,t))m=new t;else if(e(l,r))m=new r;else if(e(l,n))m=new n(function(e,t){l.then(function(t){e(a(t,h-1))},function(e){t(a(e,h-1))})});else if(o.__isArray(l))m=[];else if(o.__isRegExp(l))m=new RegExp(l.source,i(l)),l.lastIndex&&(m.lastIndex=l.lastIndex);else if(o.__isDate(l))m=new Date(l.getTime());else{if(p&&Buffer.isBuffer(l))return m=Buffer.allocUnsafe?Buffer.allocUnsafe(l.length):new Buffer(l.length),l.copy(m),m;e(l,Error)?m=Object.create(l):void 0===c?(y=Object.getPrototypeOf(l),m=Object.create(y)):(m=Object.create(c),y=c)}if(s){var g=d.indexOf(l);if(-1!=g)return f[g];d.push(l),f.push(m)}for(var v in e(l,t)&&l.forEach(function(e,t){var r=a(t,h-1),n=a(e,h-1);m.set(r,n)}),e(l,r)&&l.forEach(function(e){var t=a(e,h-1);m.add(t)}),l){var b;y&&(b=Object.getOwnPropertyDescriptor(y,v)),b&&null==b.set||(m[v]=a(l[v],h-1))}if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(l);for(v=0;v<x.length;v++){var w=x[v];(!(j=Object.getOwnPropertyDescriptor(l,w))||j.enumerable||u)&&(m[w]=a(l[w],h-1),j.enumerable||Object.defineProperty(m,w,{enumerable:!1}))}}if(u){var N=Object.getOwnPropertyNames(l);for(v=0;v<N.length;v++){var j,_=N[v];(j=Object.getOwnPropertyDescriptor(l,_))&&j.enumerable||(m[_]=a(l[_],h-1),Object.defineProperty(m,_,{enumerable:!1}))}}return m}(a,l)}function a(e){return Object.prototype.toString.call(e)}function i(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return o.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},o.__objToStr=a,o.__isDate=function(e){return"object"==typeof e&&"[object Date]"===a(e)},o.__isArray=function(e){return"object"==typeof e&&"[object Array]"===a(e)},o.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===a(e)},o.__getRegExpFlags=i,o}();"object"==typeof e&&e.exports&&(e.exports=r)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=p(r(0)),s=p(r(8)),l=r(4),c=p(l),u=p(r(16)),d=p(r(13)),f=p(r(25));function p(e){return e&&e.__esModule?e:{default:e}}function h(e){return e instanceof c.default||e instanceof l.BlockEmbed}var m=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.emitter=r.emitter,Array.isArray(r.whitelist)&&(n.whitelist=r.whitelist.reduce(function(e,t){return e[t]=!0,e},{})),n.domNode.addEventListener("DOMNodeInserted",function(){}),n.optimize(),n.enable(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(e,r){var o=this.line(e),i=n(o,2),s=i[0],c=i[1],f=this.line(e+r),p=n(f,1)[0];if(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,r),null!=p&&s!==p&&c>0){if(s instanceof l.BlockEmbed||p instanceof l.BlockEmbed)return void this.optimize();if(s instanceof d.default){var h=s.newlineIndex(s.length(),!0);if(h>-1&&(s=s.split(h+1))===p)return void this.optimize()}else if(p instanceof d.default){var m=p.newlineIndex(0);m>-1&&p.split(m+1)}var y=p.children.head instanceof u.default?null:p.children.head;s.moveChildren(p,y),s.remove()}this.optimize()}},{key:"enable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e)}},{key:"formatAt",value:function(e,r,n,o){(null==this.whitelist||this.whitelist[n])&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,r,n,o),this.optimize())}},{key:"insertAt",value:function(e,r,n){if(null==n||null==this.whitelist||this.whitelist[r]){if(e>=this.length())if(null==n||null==i.default.query(r,i.default.Scope.BLOCK)){var o=i.default.create(this.statics.defaultChild);this.appendChild(o),null==n&&r.endsWith("\n")&&(r=r.slice(0,-1)),o.insertAt(0,r,n)}else{var s=i.default.create(r,n);this.appendChild(s)}else a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,r,n);this.optimize()}}},{key:"insertBefore",value:function(e,r){if(e.statics.scope===i.default.Scope.INLINE_BLOT){var n=i.default.create(this.statics.defaultChild);n.appendChild(e),e=n}a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,r)}},{key:"leaf",value:function(e){return this.path(e).pop()||[null,-1]}},{key:"line",value:function(e){return e===this.length()?this.line(e-1):this.descendant(h,e)}},{key:"lines",value:function(){return function e(t,r,n){var o=[],a=n;return t.children.forEachAt(r,n,function(t,r,n){h(t)?o.push(t):t instanceof i.default.Container&&(o=o.concat(e(t,r,a))),a-=n}),o}(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE)}},{key:"optimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e,r),e.length>0&&this.emitter.emit(s.default.events.SCROLL_OPTIMIZE,e,r))}},{key:"path",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e).slice(1)}},{key:"update",value:function(e){if(!0!==this.batch){var r=s.default.sources.USER;"string"==typeof e&&(r=e),Array.isArray(e)||(e=this.observer.takeRecords()),e.length>0&&this.emitter.emit(s.default.events.SCROLL_BEFORE_UPDATE,r,e),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).call(this,e.concat([])),e.length>0&&this.emitter.emit(s.default.events.SCROLL_UPDATE,r,e)}}}]),t}(i.default.Scroll);m.blotName="scroll",m.className="ql-editor",m.tagName="DIV",m.defaultChild="block",m.allowedChildren=[c.default,l.BlockEmbed,f.default],t.default=m},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SHORTKEY=t.default=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=m(r(21)),s=m(r(11)),l=m(r(3)),c=m(r(2)),u=m(r(20)),d=m(r(0)),f=m(r(5)),p=m(r(10)),h=m(r(9));function m(e){return e&&e.__esModule?e:{default:e}}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var g=(0,p.default)("quill:keyboard"),v=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",b=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.bindings={},Object.keys(n.options.bindings).forEach(function(t){("list autofill"!==t||null==e.scroll.whitelist||e.scroll.whitelist.list)&&n.options.bindings[t]&&n.addBinding(n.options.bindings[t])}),n.addBinding({key:t.keys.ENTER,shiftKey:null},_),n.addBinding({key:t.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(n.addBinding({key:t.keys.BACKSPACE},{collapsed:!0},w),n.addBinding({key:t.keys.DELETE},{collapsed:!0},N)):(n.addBinding({key:t.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},w),n.addBinding({key:t.keys.DELETE},{collapsed:!0,suffix:/^.?$/},N)),n.addBinding({key:t.keys.BACKSPACE},{collapsed:!1},j),n.addBinding({key:t.keys.DELETE},{collapsed:!1},j),n.addBinding({key:t.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},w),n.listen(),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,null,[{key:"match",value:function(e,t){return t=E(t),!["altKey","ctrlKey","metaKey","shiftKey"].some(function(r){return!!t[r]!==e[r]&&null!==t[r]})&&t.key===(e.which||e.keyCode)}}]),a(t,[{key:"addBinding",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=E(e);if(null==n||null==n.key)return g.warn("Attempted to add invalid keyboard binding",n);"function"==typeof t&&(t={handler:t}),"function"==typeof r&&(r={handler:r}),n=(0,l.default)(n,t,r),this.bindings[n.key]=this.bindings[n.key]||[],this.bindings[n.key].push(n)}},{key:"listen",value:function(){var e=this;this.quill.root.addEventListener("keydown",function(r){if(!r.defaultPrevented){var a=r.which||r.keyCode,i=(e.bindings[a]||[]).filter(function(e){return t.match(r,e)});if(0!==i.length){var l=e.quill.getSelection();if(null!=l&&e.quill.hasFocus()){var c=e.quill.getLine(l.index),u=o(c,2),f=u[0],p=u[1],h=e.quill.getLeaf(l.index),m=o(h,2),y=m[0],g=m[1],v=0===l.length?[y,g]:e.quill.getLeaf(l.index+l.length),b=o(v,2),x=b[0],w=b[1],N=y instanceof d.default.Text?y.value().slice(0,g):"",j=x instanceof d.default.Text?x.value().slice(w):"",_={collapsed:0===l.length,empty:0===l.length&&f.length()<=1,format:e.quill.getFormat(l),offset:p,prefix:N,suffix:j};i.some(function(t){if(null!=t.collapsed&&t.collapsed!==_.collapsed)return!1;if(null!=t.empty&&t.empty!==_.empty)return!1;if(null!=t.offset&&t.offset!==_.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(function(e){return null==_.format[e]}))return!1}else if("object"===n(t.format)&&!Object.keys(t.format).every(function(e){return!0===t.format[e]?null!=_.format[e]:!1===t.format[e]?null==_.format[e]:(0,s.default)(t.format[e],_.format[e])}))return!1;return!(null!=t.prefix&&!t.prefix.test(_.prefix)||null!=t.suffix&&!t.suffix.test(_.suffix)||!0===t.handler.call(e,l,_))})&&r.preventDefault()}}}})}}]),t}(h.default);function x(e,t){var r,n=e===b.keys.LEFT?"prefix":"suffix";return y(r={key:e,shiftKey:t,altKey:null},n,/^$/),y(r,"handler",function(r){var n=r.index;e===b.keys.RIGHT&&(n+=r.length+1);var a=this.quill.getLeaf(n);return!(o(a,1)[0]instanceof d.default.Embed&&(e===b.keys.LEFT?t?this.quill.setSelection(r.index-1,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index-1,f.default.sources.USER):t?this.quill.setSelection(r.index,r.length+1,f.default.sources.USER):this.quill.setSelection(r.index+r.length+1,f.default.sources.USER),1))}),r}function w(e,t){if(!(0===e.index||this.quill.getLength()<=1)){var r=this.quill.getLine(e.index),n=o(r,1)[0],a={};if(0===t.offset){var i=this.quill.getLine(e.index-1),s=o(i,1)[0];if(null!=s&&s.length()>1){var l=n.formats(),c=this.quill.getFormat(e.index-1,1);a=u.default.attributes.diff(l,c)||{}}}var d=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;this.quill.deleteText(e.index-d,d,f.default.sources.USER),Object.keys(a).length>0&&this.quill.formatLine(e.index-d,d,a,f.default.sources.USER),this.quill.focus()}}function N(e,t){var r=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(!(e.index>=this.quill.getLength()-r)){var n={},a=0,i=this.quill.getLine(e.index),s=o(i,1)[0];if(t.offset>=s.length()-1){var l=this.quill.getLine(e.index+1),c=o(l,1)[0];if(c){var d=s.formats(),p=this.quill.getFormat(e.index,1);n=u.default.attributes.diff(d,p)||{},a=c.length()}}this.quill.deleteText(e.index,r,f.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(e.index+a-1,r,n,f.default.sources.USER)}}function j(e){var t=this.quill.getLines(e),r={};if(t.length>1){var n=t[0].formats(),o=t[t.length-1].formats();r=u.default.attributes.diff(o,n)||{}}this.quill.deleteText(e,f.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index,1,r,f.default.sources.USER),this.quill.setSelection(e.index,f.default.sources.SILENT),this.quill.focus()}function _(e,t){var r=this;e.length>0&&this.quill.scroll.deleteAt(e.index,e.length);var n=Object.keys(t.format).reduce(function(e,r){return d.default.query(r,d.default.Scope.BLOCK)&&!Array.isArray(t.format[r])&&(e[r]=t.format[r]),e},{});this.quill.insertText(e.index,"\n",n,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(function(e){null==n[e]&&(Array.isArray(t.format[e])||"link"!==e&&r.quill.format(e,t.format[e],f.default.sources.USER))})}function k(e){return{key:b.keys.TAB,shiftKey:!e,format:{"code-block":!0},handler:function(t){var r=d.default.query("code-block"),n=t.index,a=t.length,i=this.quill.scroll.descendant(r,n),s=o(i,2),l=s[0],c=s[1];if(null!=l){var u=this.quill.getIndex(l),p=l.newlineIndex(c,!0)+1,h=l.newlineIndex(u+c+a),m=l.domNode.textContent.slice(p,h).split("\n");c=0,m.forEach(function(t,o){e?(l.insertAt(p+c,r.TAB),c+=r.TAB.length,0===o?n+=r.TAB.length:a+=r.TAB.length):t.startsWith(r.TAB)&&(l.deleteAt(p+c,r.TAB.length),c-=r.TAB.length,0===o?n-=r.TAB.length:a-=r.TAB.length),c+=t.length+1}),this.quill.update(f.default.sources.USER),this.quill.setSelection(n,a,f.default.sources.SILENT)}}}}function O(e){return{key:e[0].toUpperCase(),shortKey:!0,handler:function(t,r){this.quill.format(e,!r.format[e],f.default.sources.USER)}}}function E(e){if("string"==typeof e||"number"==typeof e)return E({key:e});if("object"===(void 0===e?"undefined":n(e))&&(e=(0,i.default)(e,!1)),"string"==typeof e.key)if(null!=b.keys[e.key.toUpperCase()])e.key=b.keys[e.key.toUpperCase()];else{if(1!==e.key.length)return null;e.key=e.key.toUpperCase().charCodeAt(0)}return e.shortKey&&(e[v]=e.shortKey,delete e.shortKey),e}b.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},b.DEFAULTS={bindings:{bold:O("bold"),italic:O("italic"),underline:O("underline"),indent:{key:b.keys.TAB,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","+1",f.default.sources.USER)}},outdent:{key:b.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","-1",f.default.sources.USER)}},"outdent backspace":{key:b.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(e,t){null!=t.format.indent?this.quill.format("indent","-1",f.default.sources.USER):null!=t.format.list&&this.quill.format("list",!1,f.default.sources.USER)}},"indent code-block":k(!0),"outdent code-block":k(!1),"remove tab":{key:b.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(e){this.quill.deleteText(e.index-1,1,f.default.sources.USER)}},tab:{key:b.keys.TAB,handler:function(e){this.quill.history.cutoff();var t=(new c.default).retain(e.index).delete(e.length).insert("\t");this.quill.updateContents(t,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,f.default.sources.SILENT)}},"list empty enter":{key:b.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(e,t){this.quill.format("list",!1,f.default.sources.USER),t.format.indent&&this.quill.format("indent",!1,f.default.sources.USER)}},"checklist enter":{key:b.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(e){var t=this.quill.getLine(e.index),r=o(t,2),n=r[0],a=r[1],i=(0,l.default)({},n.formats(),{list:"checked"}),s=(new c.default).retain(e.index).insert("\n",i).retain(n.length()-a-1).retain(1,{list:"unchecked"});this.quill.updateContents(s,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:b.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(e,t){var r=this.quill.getLine(e.index),n=o(r,2),a=n[0],i=n[1],s=(new c.default).retain(e.index).insert("\n",t.format).retain(a.length()-i-1).retain(1,{header:null});this.quill.updateContents(s,f.default.sources.USER),this.quill.setSelection(e.index+1,f.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(e,t){var r=t.prefix.length,n=this.quill.getLine(e.index),a=o(n,2),i=a[0],s=a[1];if(s>r)return!0;var l=void 0;switch(t.prefix.trim()){case"[]":case"[ ]":l="unchecked";break;case"[x]":l="checked";break;case"-":case"*":l="bullet";break;default:l="ordered"}this.quill.insertText(e.index," ",f.default.sources.USER),this.quill.history.cutoff();var u=(new c.default).retain(e.index-s).delete(r+1).retain(i.length()-2-s).retain(1,{list:l});this.quill.updateContents(u,f.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-r,f.default.sources.SILENT)}},"code exit":{key:b.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(e){var t=this.quill.getLine(e.index),r=o(t,2),n=r[0],a=r[1],i=(new c.default).retain(e.index+n.length()-a-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(i,f.default.sources.USER)}},"embed left":x(b.keys.LEFT,!1),"embed left shift":x(b.keys.LEFT,!0),"embed right":x(b.keys.RIGHT,!1),"embed right shift":x(b.keys.RIGHT,!0)}},t.default=b,t.SHORTKEY=v},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=l(r(0)),s=l(r(7));function l(e){return e&&e.__esModule?e:{default:e}}var c=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.selection=r,n.textNode=document.createTextNode(t.CONTENTS),n.domNode.appendChild(n.textNode),n._length=0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,null,[{key:"value",value:function(){}}]),a(t,[{key:"detach",value:function(){null!=this.parent&&this.parent.removeChild(this)}},{key:"format",value:function(e,r){if(0!==this._length)return o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r);for(var n=this,a=0;null!=n&&n.statics.scope!==i.default.Scope.BLOCK_BLOT;)a+=n.offset(n.parent),n=n.parent;null!=n&&(this._length=t.CONTENTS.length,n.optimize(),n.formatAt(a,t.CONTENTS.length,e,r),this._length=0)}},{key:"index",value:function(e,r){return e===this.textNode?0:o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,r)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!this.selection.composing&&null!=this.parent){var e=this.textNode,r=this.selection.getNativeRange(),o=void 0,a=void 0,l=void 0;if(null!=r&&r.start.node===e&&r.end.node===e){var c=[e,r.start.offset,r.end.offset];o=c[0],a=c[1],l=c[2]}for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==t.CONTENTS){var u=this.textNode.data.split(t.CONTENTS).join("");this.next instanceof s.default?(o=this.next.domNode,this.next.insertAt(0,u),this.textNode.data=t.CONTENTS):(this.textNode.data=u,this.parent.insertBefore(i.default.create(this.textNode),this),this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),null!=a){var d=[a,l].map(function(e){return Math.max(0,Math.min(o.data.length,e-1))}),f=n(d,2);return a=f[0],l=f[1],{startNode:o,startOffset:a,endNode:o,endOffset:l}}}}},{key:"update",value:function(e,t){var r=this;if(e.some(function(e){return"characterData"===e.type&&e.target===r.textNode})){var n=this.restore();n&&(t.range=n)}}},{key:"value",value:function(){return""}}]),t}(i.default.Embed);c.blotName="cursor",c.className="ql-cursor",c.tagName="span",c.CONTENTS="\ufeff",t.default=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=i(r(0)),o=r(4),a=i(o);function i(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(n.default.Container);s.allowedChildren=[a.default,o.BlockEmbed,s],t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorStyle=t.ColorClass=t.ColorAttributor=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"value",value:function(e){var r=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e);return r.startsWith("rgb(")?(r=r.replace(/^[^\d]+/,"").replace(/[^\d]+$/,""),"#"+r.split(",").map(function(e){return("00"+parseInt(e).toString(16)).slice(-2)}).join("")):r}}]),t}(s.default.Attributor.Style),c=new s.default.Attributor.Class("color","ql-color",{scope:s.default.Scope.INLINE}),u=new l("color","color",{scope:s.default.Scope.INLINE});t.ColorAttributor=l,t.ColorClass=c,t.ColorStyle=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.sanitize=t.default=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(6),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"format",value:function(e,r){if(e!==this.statics.blotName||!r)return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r);r=this.constructor.sanitize(r),this.domNode.setAttribute("href",r)}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return e=this.sanitize(e),r.setAttribute("href",e),r.setAttribute("rel","noopener noreferrer"),r.setAttribute("target","_blank"),r}},{key:"formats",value:function(e){return e.getAttribute("href")}},{key:"sanitize",value:function(e){return l(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);function l(e,t){var r=document.createElement("a");r.href=e;var n=r.href.slice(0,r.href.indexOf(":"));return t.indexOf(n)>-1}s.blotName="link",s.tagName="A",s.SANITIZED_URL="about:blank",s.PROTOCOL_WHITELIST=["http","https","mailto","tel"],t.default=s,t.sanitize=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=s(r(23)),i=s(r(107));function s(e){return e&&e.__esModule?e:{default:e}}var l=0;function c(e,t){e.setAttribute(t,!("true"===e.getAttribute(t)))}var u=function(){function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){r.togglePicker()}),this.label.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:r.togglePicker();break;case a.default.keys.ESCAPE:r.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}return o(e,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),c(this.label,"aria-expanded"),c(this.options,"aria-hidden")}},{key:"buildItem",value:function(e){var t=this,r=document.createElement("span");return r.tabIndex="0",r.setAttribute("role","button"),r.classList.add("ql-picker-item"),e.hasAttribute("value")&&r.setAttribute("data-value",e.getAttribute("value")),e.textContent&&r.setAttribute("data-label",e.textContent),r.addEventListener("click",function(){t.selectItem(r,!0)}),r.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:t.selectItem(r,!0),e.preventDefault();break;case a.default.keys.ESCAPE:t.escape(),e.preventDefault()}}),r}},{key:"buildLabel",value:function(){var e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML=i.default,e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}},{key:"buildOptions",value:function(){var e=this,t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id="ql-picker-options-"+l,l+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,[].slice.call(this.select.options).forEach(function(r){var n=e.buildItem(r);t.appendChild(n),!0===r.selected&&e.selectItem(n)}),this.container.appendChild(t)}},{key:"buildPicker",value:function(){var e=this;[].slice.call(this.select.attributes).forEach(function(t){e.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var e=this;this.close(),setTimeout(function(){return e.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.container.querySelector(".ql-selected");if(e!==r&&(null!=r&&r.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(e.parentNode.children,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))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if("object"===("undefined"==typeof Event?"undefined":n(Event))){var o=document.createEvent("Event");o.initEvent("change",!0,!0),this.select.dispatchEvent(o)}this.close()}}},{key:"update",value:function(){var e=void 0;if(this.select.selectedIndex>-1){var 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);var r=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",r)}}]),e}();t.default=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=g(r(0)),o=g(r(5)),a=r(4),i=g(a),s=g(r(16)),l=g(r(25)),c=g(r(24)),u=g(r(35)),d=g(r(6)),f=g(r(22)),p=g(r(7)),h=g(r(55)),m=g(r(42)),y=g(r(23));function g(e){return e&&e.__esModule?e:{default:e}}o.default.register({"blots/block":i.default,"blots/block/embed":a.BlockEmbed,"blots/break":s.default,"blots/container":l.default,"blots/cursor":c.default,"blots/embed":u.default,"blots/inline":d.default,"blots/scroll":f.default,"blots/text":p.default,"modules/clipboard":h.default,"modules/history":m.default,"modules/keyboard":y.default}),n.default.register(i.default,s.default,c.default,d.default,f.default,p.default),t.default=o.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e){this.domNode=e,this.domNode[n.DATA_KEY]={blot:this}}return Object.defineProperty(e.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),e.create=function(e){if(null==this.tagName)throw new n.ParchmentError("Blot definition missing tagName");var t;return Array.isArray(this.tagName)?("string"==typeof e&&(e=e.toUpperCase(),parseInt(e).toString()===e&&(e=parseInt(e))),t="number"==typeof e?document.createElement(this.tagName[e-1]):this.tagName.indexOf(e)>-1?document.createElement(e):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t},e.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},e.prototype.clone=function(){var e=this.domNode.cloneNode(!1);return n.create(e)},e.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[n.DATA_KEY]},e.prototype.deleteAt=function(e,t){this.isolate(e,t).remove()},e.prototype.formatAt=function(e,t,r,o){var a=this.isolate(e,t);if(null!=n.query(r,n.Scope.BLOT)&&o)a.wrap(r,o);else if(null!=n.query(r,n.Scope.ATTRIBUTE)){var i=n.create(this.statics.scope);a.wrap(i),i.format(r,o)}},e.prototype.insertAt=function(e,t,r){var o=null==r?n.create("text",t):n.create(t,r),a=this.split(e);this.parent.insertBefore(o,a)},e.prototype.insertInto=function(e,t){void 0===t&&(t=null),null!=this.parent&&this.parent.children.remove(this);var r=null;e.children.insertBefore(this,t),null!=t&&(r=t.domNode),this.domNode.parentNode==e.domNode&&this.domNode.nextSibling==r||e.domNode.insertBefore(this.domNode,r),this.parent=e,this.attach()},e.prototype.isolate=function(e,t){var r=this.split(e);return r.split(t),r},e.prototype.length=function(){return 1},e.prototype.offset=function(e){return void 0===e&&(e=this.parent),null==this.parent||this==e?0:this.parent.children.offset(this)+this.parent.offset(e)},e.prototype.optimize=function(e){null!=this.domNode[n.DATA_KEY]&&delete this.domNode[n.DATA_KEY].mutations},e.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},e.prototype.replace=function(e){null!=e.parent&&(e.parent.insertBefore(this,e.next),e.remove())},e.prototype.replaceWith=function(e,t){var r="string"==typeof e?n.create(e,t):e;return r.replace(this),r},e.prototype.split=function(e,t){return 0===e?this:this.next},e.prototype.update=function(e,t){},e.prototype.wrap=function(e,t){var r="string"==typeof e?n.create(e,t):e;return null!=this.parent&&this.parent.insertBefore(r,this.next),r.appendChild(this),r},e.blotName="abstract",e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(12),o=r(32),a=r(33),i=r(1),s=function(){function e(e){this.attributes={},this.domNode=e,this.build()}return e.prototype.attribute=function(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])},e.prototype.build=function(){var e=this;this.attributes={};var t=n.default.keys(this.domNode),r=o.default.keys(this.domNode),s=a.default.keys(this.domNode);t.concat(r).concat(s).forEach(function(t){var r=i.query(t,i.Scope.ATTRIBUTE);r instanceof n.default&&(e.attributes[r.attrName]=r)})},e.prototype.copy=function(e){var t=this;Object.keys(this.attributes).forEach(function(r){var n=t.attributes[r].value(t.domNode);e.format(r,n)})},e.prototype.move=function(e){var t=this;this.copy(e),Object.keys(this.attributes).forEach(function(e){t.attributes[e].remove(t.domNode)}),this.attributes={}},e.prototype.values=function(){var e=this;return Object.keys(this.attributes).reduce(function(t,r){return t[r]=e.attributes[r].value(e.domNode),t},{})},e}();t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function a(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return 0===e.indexOf(t+"-")})}Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.keys=function(e){return(e.getAttribute("class")||"").split(/\s+/).map(function(e){return e.split("-").slice(0,-1).join("-")})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(this.keyName+"-"+t),!0)},t.prototype.remove=function(e){a(e,this.keyName).forEach(function(t){e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")},t.prototype.value=function(e){var t=(a(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""},t}(r(12).default);t.default=i},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});function a(e){var t=e.split("-"),r=t.slice(1).map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("");return t[0]+r}Object.defineProperty(t,"__esModule",{value:!0});var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.keys=function(e){return(e.getAttribute("style")||"").split(";").map(function(e){return e.split(":")[0].trim()})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.style[a(this.keyName)]=t,!0)},t.prototype.remove=function(e){e.style[a(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")},t.prototype.value=function(e){var t=e.style[a(this.keyName)];return this.canAdd(e,t)?t:""},t}(r(12).default);t.default=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(){function e(t,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.quill=t,this.options=r,this.modules={}}return n(e,[{key:"init",value:function(){var e=this;Object.keys(this.options.modules).forEach(function(t){null==e.modules[t]&&e.addModule(t)})}},{key:"addModule",value:function(e){var t=this.quill.constructor.import("modules/"+e);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}}]),e}();o.DEFAULTS={modules:{}},o.themes={default:o},t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=s(r(0)),i=s(r(7));function s(e){return e&&e.__esModule?e:{default:e}}var l="\ufeff",c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.contentNode=document.createElement("span"),r.contentNode.setAttribute("contenteditable",!1),[].slice.call(r.domNode.childNodes).forEach(function(e){r.contentNode.appendChild(e)}),r.leftGuard=document.createTextNode(l),r.rightGuard=document.createTextNode(l),r.domNode.appendChild(r.leftGuard),r.domNode.appendChild(r.contentNode),r.domNode.appendChild(r.rightGuard),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"index",value:function(e,r){return e===this.leftGuard?0:e===this.rightGuard?1:o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,r)}},{key:"restore",value:function(e){var t=void 0,r=void 0,n=e.data.split(l).join("");if(e===this.leftGuard)if(this.prev instanceof i.default){var o=this.prev.length();this.prev.insertAt(o,n),t={startNode:this.prev.domNode,startOffset:o+n.length}}else r=document.createTextNode(n),this.parent.insertBefore(a.default.create(r),this),t={startNode:r,startOffset:n.length};else e===this.rightGuard&&(this.next instanceof i.default?(this.next.insertAt(0,n),t={startNode:this.next.domNode,startOffset:n.length}):(r=document.createTextNode(n),this.parent.insertBefore(a.default.create(r),this.next),t={startNode:r,startOffset:n.length}));return e.data=l,t}},{key:"update",value:function(e,t){var r=this;e.forEach(function(e){if("characterData"===e.type&&(e.target===r.leftGuard||e.target===r.rightGuard)){var n=r.restore(e.target);n&&(t.range=n)}})}}]),t}(a.default.Embed);t.default=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.AlignStyle=t.AlignClass=t.AlignAttribute=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i={scope:a.default.Scope.BLOCK,whitelist:["right","center","justify"]},s=new a.default.Attributor.Attribute("align","align",i),l=new a.default.Attributor.Class("align","ql-align",i),c=new a.default.Attributor.Style("align","text-align",i);t.AlignAttribute=s,t.AlignClass=l,t.AlignStyle=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundStyle=t.BackgroundClass=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i=r(26),s=new a.default.Attributor.Class("background","ql-bg",{scope:a.default.Scope.INLINE}),l=new i.ColorAttributor("background","background-color",{scope:a.default.Scope.INLINE});t.BackgroundClass=s,t.BackgroundStyle=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.DirectionStyle=t.DirectionClass=t.DirectionAttribute=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i={scope:a.default.Scope.BLOCK,whitelist:["rtl"]},s=new a.default.Attributor.Attribute("direction","dir",i),l=new a.default.Attributor.Class("direction","ql-direction",i),c=new a.default.Attributor.Style("direction","direction",i);t.DirectionAttribute=s,t.DirectionClass=l,t.DirectionStyle=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.FontClass=t.FontStyle=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l={scope:s.default.Scope.INLINE,whitelist:["serif","monospace"]},c=new s.default.Attributor.Class("font","ql-font",l),u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"value",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e).replace(/["']/g,"")}}]),t}(s.default.Attributor.Style),d=new u("font","font-family",l);t.FontStyle=d,t.FontClass=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.SizeStyle=t.SizeClass=void 0;var n,o=r(0),a=(n=o)&&n.__esModule?n:{default:n},i=new a.default.Attributor.Class("size","ql-size",{scope:a.default.Scope.INLINE,whitelist:["small","large","huge"]}),s=new a.default.Attributor.Style("size","font-size",{scope:a.default.Scope.INLINE,whitelist:["10px","18px","32px"]});t.SizeClass=i,t.SizeStyle=s},function(e,t,r){e.exports={align:{"":r(76),center:r(77),right:r(78),justify:r(79)},background:r(80),blockquote:r(81),bold:r(82),clean:r(83),code:r(58),"code-block":r(58),color:r(84),direction:{"":r(85),rtl:r(86)},float:{center:r(87),full:r(88),left:r(89),right:r(90)},formula:r(91),header:{1:r(92),2:r(93)},italic:r(94),image:r(95),indent:{"+1":r(96),"-1":r(97)},link:r(98),list:{ordered:r(99),bullet:r(100),check:r(101)},script:{sub:r(102),super:r(103)},strike:r(104),underline:r(105),video:r(106)}},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.getLastChangeIndex=t.default=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=i(r(0)),a=i(r(5));function i(e){return e&&e.__esModule?e:{default:e}}var s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.lastRecorded=0,n.ignoreChange=!1,n.clear(),n.quill.on(a.default.events.EDITOR_CHANGE,function(e,t,r,o){e!==a.default.events.TEXT_CHANGE||n.ignoreChange||(n.options.userOnly&&o!==a.default.sources.USER?n.transform(t):n.record(t,r))}),n.quill.keyboard.addBinding({key:"Z",shortKey:!0},n.undo.bind(n)),n.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},n.redo.bind(n)),/Win/i.test(navigator.platform)&&n.quill.keyboard.addBinding({key:"Y",shortKey:!0},n.redo.bind(n)),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"change",value:function(e,t){if(0!==this.stack[e].length){var r=this.stack[e].pop();this.stack[t].push(r),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(r[e],a.default.sources.USER),this.ignoreChange=!1;var n=l(r[e]);this.quill.setSelection(n)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(e,t){if(0!==e.ops.length){this.stack.redo=[];var r=this.quill.getContents().diff(t),n=Date.now();if(this.lastRecorded+this.options.delay>n&&this.stack.undo.length>0){var o=this.stack.undo.pop();r=r.compose(o.undo),e=o.redo.compose(e)}else this.lastRecorded=n;this.stack.undo.push({redo:e,undo:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(e){this.stack.undo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)}),this.stack.redo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),t}(i(r(9)).default);function l(e){var t=e.reduce(function(e,t){return e+=t.delete||0},0),r=e.length()-t;return function(e){var t=e.ops[e.ops.length-1];return null!=t&&(null!=t.insert?"string"==typeof t.insert&&t.insert.endsWith("\n"):null!=t.attributes&&Object.keys(t.attributes).some(function(e){return null!=o.default.query(e,o.default.Scope.BLOCK)}))}(e)&&(r-=1),r}s.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},t.default=s,t.getLastChangeIndex=l},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BaseTooltip=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=h(r(3)),i=h(r(2)),s=h(r(8)),l=h(r(23)),c=h(r(34)),u=h(r(59)),d=h(r(60)),f=h(r(28)),p=h(r(61));function h(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function y(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var v=[!1,"center","right","justify"],b=["#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"],x=[!1,"serif","monospace"],w=["1","2","3",!1],N=["small",!1,"large","huge"],j=function(e){function t(e,r){m(this,t);var n=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return e.emitter.listenDOM("click",document.body,function t(r){if(!document.body.contains(e.root))return document.body.removeEventListener("click",t);null==n.tooltip||n.tooltip.root.contains(r.target)||document.activeElement===n.tooltip.textbox||n.quill.hasFocus()||n.tooltip.hide(),null!=n.pickers&&n.pickers.forEach(function(e){e.container.contains(r.target)||e.close()})}),n}return g(t,e),n(t,[{key:"addModule",value:function(e){var r=o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addModule",this).call(this,e);return"toolbar"===e&&this.extendToolbar(r),r}},{key:"buildButtons",value:function(e,t){e.forEach(function(e){(e.getAttribute("class")||"").split(/\s+/).forEach(function(r){if(r.startsWith("ql-")&&(r=r.slice(3),null!=t[r]))if("direction"===r)e.innerHTML=t[r][""]+t[r].rtl;else if("string"==typeof t[r])e.innerHTML=t[r];else{var n=e.value||"";null!=n&&t[r][n]&&(e.innerHTML=t[r][n])}})})}},{key:"buildPickers",value:function(e,t){var r=this;this.pickers=e.map(function(e){if(e.classList.contains("ql-align"))return null==e.querySelector("option")&&k(e,v),new d.default(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){var r=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&k(e,b,"background"===r?"#ffffff":"#000000"),new u.default(e,t[r])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?k(e,x):e.classList.contains("ql-header")?k(e,w):e.classList.contains("ql-size")&&k(e,N)),new f.default(e)}),this.quill.on(s.default.events.EDITOR_CHANGE,function(){r.pickers.forEach(function(e){e.update()})})}}]),t}(c.default);j.DEFAULTS=(0,a.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var e=this,t=this.container.querySelector("input.ql-image[type=file]");null==t&&((t=document.createElement("input")).setAttribute("type","file"),t.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),t.classList.add("ql-image"),t.addEventListener("change",function(){if(null!=t.files&&null!=t.files[0]){var r=new FileReader;r.onload=function(r){var n=e.quill.getSelection(!0);e.quill.updateContents((new i.default).retain(n.index).delete(n.length).insert({image:r.target.result}),s.default.sources.USER),e.quill.setSelection(n.index+1,s.default.sources.SILENT),t.value=""},r.readAsDataURL(t.files[0])}}),this.container.appendChild(t)),t.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}});var _=function(e){function t(e,r){m(this,t);var n=y(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.textbox=n.root.querySelector('input[type="text"]'),n.listen(),n}return g(t,e),n(t,[{key:"listen",value:function(){var e=this;this.textbox.addEventListener("keydown",function(t){l.default.match(t,"enter")?(e.save(),t.preventDefault()):l.default.match(t,"escape")&&(e.cancel(),t.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+e)||""),this.root.setAttribute("data-mode",e)}},{key:"restoreFocus",value:function(){var e=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=e}},{key:"save",value:function(){var e=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var t=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,s.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,s.default.sources.USER)),this.quill.root.scrollTop=t;break;case"video":e=function(e){var 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_-]+)/);return t?(t[1]||"https")+"://www.youtube.com/embed/"+t[2]+"?showinfo=0":(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(t[1]||"https")+"://player.vimeo.com/video/"+t[2]+"/":e}(e);case"formula":if(!e)break;var r=this.quill.getSelection(!0);if(null!=r){var n=r.index+r.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,s.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",s.default.sources.USER),this.quill.setSelection(n+2,s.default.sources.USER)}}this.textbox.value="",this.hide()}}]),t}(p.default);function k(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(function(t){var n=document.createElement("option");t===r?n.setAttribute("selected","selected"):n.setAttribute("value",t),e.appendChild(n)})}t.BaseTooltip=_,t.default=j},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this.head=this.tail=null,this.length=0}return e.prototype.append=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.insertBefore(e[0],null),e.length>1&&this.append.apply(this,e.slice(1))},e.prototype.contains=function(e){for(var t,r=this.iterator();t=r();)if(t===e)return!0;return!1},e.prototype.insertBefore=function(e,t){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)},e.prototype.offset=function(e){for(var t=0,r=this.head;null!=r;){if(r===e)return t;t+=r.length(),r=r.next}return-1},e.prototype.remove=function(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)},e.prototype.iterator=function(e){return void 0===e&&(e=this.head),function(){var t=e;return null!=e&&(e=e.next),t}},e.prototype.find=function(e,t){void 0===t&&(t=!1);for(var r,n=this.iterator();r=n();){var o=r.length();if(e<o||t&&e===o&&(null==r.next||0!==r.next.length()))return[r,e];e-=o}return[null,0]},e.prototype.forEach=function(e){for(var t,r=this.iterator();t=r();)e(t)},e.prototype.forEachAt=function(e,t,r){if(!(t<=0))for(var n,o=this.find(e),a=o[0],i=e-o[1],s=this.iterator(a);(n=s())&&i<e+t;){var l=n.length();e>i?r(n,e-i,Math.min(t,i+l-e)):r(n,0,Math.min(l,e+t-i)),i+=l}},e.prototype.map=function(e){return this.reduce(function(t,r){return t.push(e(r)),t},[])},e.prototype.reduce=function(e,t){for(var r,n=this.iterator();r=n();)t=e(t,r);return t},e}();t.default=n},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(17),i=r(1),s={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},l=function(e){function t(t){var r=e.call(this,t)||this;return r.scroll=r,r.observer=new MutationObserver(function(e){r.update(e)}),r.observer.observe(r.domNode,s),r.attach(),r}return o(t,e),t.prototype.detach=function(){e.prototype.detach.call(this),this.observer.disconnect()},t.prototype.deleteAt=function(t,r){this.update(),0===t&&r===this.length()?this.children.forEach(function(e){e.remove()}):e.prototype.deleteAt.call(this,t,r)},t.prototype.formatAt=function(t,r,n,o){this.update(),e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.insertAt=function(t,r,n){this.update(),e.prototype.insertAt.call(this,t,r,n)},t.prototype.optimize=function(t,r){var n=this;void 0===t&&(t=[]),void 0===r&&(r={}),e.prototype.optimize.call(this,r);for(var o=[].slice.call(this.observer.takeRecords());o.length>0;)t.push(o.pop());for(var s=function(e,t){void 0===t&&(t=!0),null!=e&&e!==n&&null!=e.domNode.parentNode&&(null==e.domNode[i.DATA_KEY].mutations&&(e.domNode[i.DATA_KEY].mutations=[]),t&&s(e.parent))},l=function(e){null!=e.domNode[i.DATA_KEY]&&null!=e.domNode[i.DATA_KEY].mutations&&(e instanceof a.default&&e.children.forEach(l),e.optimize(r))},c=t,u=0;c.length>0;u+=1){if(u>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(c.forEach(function(e){var t=i.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(s(i.find(e.previousSibling,!1)),[].forEach.call(e.addedNodes,function(e){var t=i.find(e,!1);s(t,!1),t instanceof a.default&&t.children.forEach(function(e){s(e,!1)})})):"attributes"===e.type&&s(t.prev)),s(t))}),this.children.forEach(l),o=(c=[].slice.call(this.observer.takeRecords())).slice();o.length>0;)t.push(o.pop())}},t.prototype.update=function(t,r){var n=this;void 0===r&&(r={}),(t=t||this.observer.takeRecords()).map(function(e){var t=i.find(e.target,!0);return null==t?null:null==t.domNode[i.DATA_KEY].mutations?(t.domNode[i.DATA_KEY].mutations=[e],t):(t.domNode[i.DATA_KEY].mutations.push(e),null)}).forEach(function(e){null!=e&&e!==n&&null!=e.domNode[i.DATA_KEY]&&e.update(e.domNode[i.DATA_KEY].mutations||[],r)}),null!=this.domNode[i.DATA_KEY].mutations&&e.prototype.update.call(this,this.domNode[i.DATA_KEY].mutations,r),this.optimize(t,r)},t.blotName="scroll",t.defaultChild="block",t.scope=i.Scope.BLOCK_BLOT,t.tagName="DIV",t}(a.default);t.default=l},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(18),i=r(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.formats=function(r){if(r.tagName!==t.tagName)return e.formats.call(this,r)},t.prototype.format=function(r,n){var o=this;r!==this.statics.blotName||n?e.prototype.format.call(this,r,n):(this.children.forEach(function(e){e instanceof a.default||(e=e.wrap(t.blotName,!0)),o.attributes.copy(e)}),this.unwrap())},t.prototype.formatAt=function(t,r,n,o){null!=this.formats()[n]||i.query(n,i.Scope.ATTRIBUTE)?this.isolate(t,r).format(n,o):e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.optimize=function(r){e.prototype.optimize.call(this,r);var n=this.formats();if(0===Object.keys(n).length)return this.unwrap();var o=this.next;o instanceof t&&o.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var r in e)if(e[r]!==t[r])return!1;return!0}(n,o.formats())&&(o.moveChildren(this),o.remove())},t.blotName="inline",t.scope=i.Scope.INLINE_BLOT,t.tagName="SPAN",t}(a.default);t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(18),i=r(1),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.formats=function(r){var n=i.query(t.blotName).tagName;if(r.tagName!==n)return e.formats.call(this,r)},t.prototype.format=function(r,n){null!=i.query(r,i.Scope.BLOCK)&&(r!==this.statics.blotName||n?e.prototype.format.call(this,r,n):this.replaceWith(t.blotName))},t.prototype.formatAt=function(t,r,n,o){null!=i.query(n,i.Scope.BLOCK)?this.format(n,o):e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.insertAt=function(t,r,n){if(null==n||null!=i.query(r,i.Scope.INLINE))e.prototype.insertAt.call(this,t,r,n);else{var o=this.split(t),a=i.create(r,n);o.parent.insertBefore(a,o)}},t.prototype.update=function(t,r){navigator.userAgent.match(/Trident/)?this.build():e.prototype.update.call(this,t,r)},t.blotName="block",t.scope=i.Scope.BLOCK_BLOT,t.tagName="P",t}(a.default);t.default=s},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.formats=function(e){},t.prototype.format=function(t,r){e.prototype.formatAt.call(this,0,this.length(),t,r)},t.prototype.formatAt=function(t,r,n,o){0===t&&r===this.length()?this.format(n,o):e.prototype.formatAt.call(this,t,r,n,o)},t.prototype.formats=function(){return this.statics.formats(this.domNode)},t}(r(19).default);t.default=a},function(e,t,r){var n,o=this&&this.__extends||(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(t,"__esModule",{value:!0});var a=r(19),i=r(1),s=function(e){function t(t){var r=e.call(this,t)||this;return r.text=r.statics.value(r.domNode),r}return o(t,e),t.create=function(e){return document.createTextNode(e)},t.value=function(e){var t=e.data;return t.normalize&&(t=t.normalize()),t},t.prototype.deleteAt=function(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)},t.prototype.index=function(e,t){return this.domNode===e?t:-1},t.prototype.insertAt=function(t,r,n){null==n?(this.text=this.text.slice(0,t)+r+this.text.slice(t),this.domNode.data=this.text):e.prototype.insertAt.call(this,t,r,n)},t.prototype.length=function(){return this.text.length},t.prototype.optimize=function(r){e.prototype.optimize.call(this,r),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},t.prototype.position=function(e,t){return[this.domNode,e]},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var r=i.create(this.domNode.splitText(e));return this.parent.insertBefore(r,this.next),this.text=this.statics.value(this.domNode),r},t.prototype.update=function(e,t){var r=this;e.some(function(e){return"characterData"===e.type&&e.target===r.domNode})&&(this.text=this.statics.value(this.domNode))},t.prototype.value=function(){return this.text},t.blotName="text",t.scope=i.Scope.INLINE_BLOT,t}(a.default);t.default=s},function(e,t,r){var n=document.createElement("div");if(n.classList.toggle("test-class",!1),n.classList.contains("test-class")){var o=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return arguments.length>1&&!this.contains(e)==!t?t:o.call(this,e)}}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var r=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>r.length)&&(t=r.length),t-=e.length;var n=r.indexOf(e,t);return-1!==n&&n===t}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,r=Object(this),n=r.length>>>0,o=arguments[1],a=0;a<n;a++)if(t=r[a],e.call(o,t,a,r))return t}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})},function(e,t){var r=-1;function n(e,t,l){if(e==t)return e?[[0,e]]:[];(l<0||e.length<l)&&(l=null);var u=a(e,t),d=e.substring(0,u);u=i(e=e.substring(u),t=t.substring(u));var f=e.substring(e.length-u),p=function(e,t){var s;if(!e)return[[1,t]];if(!t)return[[r,e]];var l=e.length>t.length?e:t,c=e.length>t.length?t:e,u=l.indexOf(c);if(-1!=u)return s=[[1,l.substring(0,u)],[0,c],[1,l.substring(u+c.length)]],e.length>t.length&&(s[0][0]=s[2][0]=r),s;if(1==c.length)return[[r,e],[1,t]];var d=function(e,t){var r=e.length>t.length?e:t,n=e.length>t.length?t:e;if(r.length<4||2*n.length<r.length)return null;function o(e,t,r){for(var n,o,s,l,c=e.substring(r,r+Math.floor(e.length/4)),u=-1,d="";-1!=(u=t.indexOf(c,u+1));){var f=a(e.substring(r),t.substring(u)),p=i(e.substring(0,r),t.substring(0,u));d.length<p+f&&(d=t.substring(u-p,u)+t.substring(u,u+f),n=e.substring(0,r-p),o=e.substring(r+f),s=t.substring(0,u-p),l=t.substring(u+f))}return 2*d.length>=e.length?[n,o,s,l,d]:null}var s,l,c,u,d,f=o(r,n,Math.ceil(r.length/4)),p=o(r,n,Math.ceil(r.length/2));if(!f&&!p)return null;s=p?f&&f[4].length>p[4].length?f:p:f,e.length>t.length?(l=s[0],c=s[1],u=s[2],d=s[3]):(u=s[0],d=s[1],l=s[2],c=s[3]);var h=s[4];return[l,c,u,d,h]}(e,t);if(d){var f=d[0],p=d[1],h=d[2],m=d[3],y=d[4],g=n(f,h),v=n(p,m);return g.concat([[0,y]],v)}return function(e,t){for(var n=e.length,a=t.length,i=Math.ceil((n+a)/2),s=i,l=2*i,c=new Array(l),u=new Array(l),d=0;d<l;d++)c[d]=-1,u[d]=-1;c[s+1]=0,u[s+1]=0;for(var f=n-a,p=f%2!=0,h=0,m=0,y=0,g=0,v=0;v<i;v++){for(var b=-v+h;b<=v-m;b+=2){for(var x=s+b,w=(O=b==-v||b!=v&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-b;O<n&&w<a&&e.charAt(O)==t.charAt(w);)O++,w++;if(c[x]=O,O>n)m+=2;else if(w>a)h+=2;else if(p&&(_=s+f-b)>=0&&_<l&&-1!=u[_]&&O>=(j=n-u[_]))return o(e,t,O,w)}for(var N=-v+y;N<=v-g;N+=2){for(var j,_=s+N,k=(j=N==-v||N!=v&&u[_-1]<u[_+1]?u[_+1]:u[_-1]+1)-N;j<n&&k<a&&e.charAt(n-j-1)==t.charAt(a-k-1);)j++,k++;if(u[_]=j,j>n)g+=2;else if(k>a)y+=2;else if(!p){var O;if((x=s+f-N)>=0&&x<l&&-1!=c[x]&&(w=s+(O=c[x])-x,O>=(j=n-j)))return o(e,t,O,w)}}}return[[r,e],[1,t]]}(e,t)}(e=e.substring(0,e.length-u),t=t.substring(0,t.length-u));return d&&p.unshift([0,d]),f&&p.push([0,f]),s(p),null!=l&&(p=function(e,t){var n=function(e,t){if(0===t)return[0,e];for(var n=0,o=0;o<e.length;o++){var a=e[o];if(a[0]===r||0===a[0]){var i=n+a[1].length;if(t===i)return[o+1,e];if(t<i){e=e.slice();var s=t-n,l=[a[0],a[1].slice(0,s)],c=[a[0],a[1].slice(s)];return e.splice(o,1,l,c),[o+1,e]}n=i}}throw new Error("cursor_pos is out of bounds!")}(e,t),o=n[1],a=n[0],i=o[a],s=o[a+1];if(null==i)return e;if(0!==i[0])return e;if(null!=s&&i[1]+s[1]===s[1]+i[1])return o.splice(a,2,s,i),c(o,a,2);if(null!=s&&0===s[1].indexOf(i[1])){o.splice(a,2,[s[0],i[1]],[0,i[1]]);var l=s[1].slice(i[1].length);return l.length>0&&o.splice(a+2,0,[s[0],l]),c(o,a,3)}return e}(p,l)),p=function(e){for(var t=!1,n=function(e){return e.charCodeAt(0)>=56320&&e.charCodeAt(0)<=57343},o=function(e){return e.charCodeAt(e.length-1)>=55296&&e.charCodeAt(e.length-1)<=56319},a=2;a<e.length;a+=1)0===e[a-2][0]&&o(e[a-2][1])&&e[a-1][0]===r&&n(e[a-1][1])&&1===e[a][0]&&n(e[a][1])&&(t=!0,e[a-1][1]=e[a-2][1].slice(-1)+e[a-1][1],e[a][1]=e[a-2][1].slice(-1)+e[a][1],e[a-2][1]=e[a-2][1].slice(0,-1));if(!t)return e;var i=[];for(a=0;a<e.length;a+=1)e[a][1].length>0&&i.push(e[a]);return i}(p)}function o(e,t,r,o){var a=e.substring(0,r),i=t.substring(0,o),s=e.substring(r),l=t.substring(o),c=n(a,i),u=n(s,l);return c.concat(u)}function a(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var r=0,n=Math.min(e.length,t.length),o=n,a=0;r<o;)e.substring(a,o)==t.substring(a,o)?a=r=o:n=o,o=Math.floor((n-r)/2+r);return o}function i(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var r=0,n=Math.min(e.length,t.length),o=n,a=0;r<o;)e.substring(e.length-o,e.length-a)==t.substring(t.length-o,t.length-a)?a=r=o:n=o,o=Math.floor((n-r)/2+r);return o}function s(e){e.push([0,""]);for(var t,n=0,o=0,l=0,c="",u="";n<e.length;)switch(e[n][0]){case 1:l++,u+=e[n][1],n++;break;case r:o++,c+=e[n][1],n++;break;case 0:o+l>1?(0!==o&&0!==l&&(0!==(t=a(u,c))&&(n-o-l>0&&0==e[n-o-l-1][0]?e[n-o-l-1][1]+=u.substring(0,t):(e.splice(0,0,[0,u.substring(0,t)]),n++),u=u.substring(t),c=c.substring(t)),0!==(t=i(u,c))&&(e[n][1]=u.substring(u.length-t)+e[n][1],u=u.substring(0,u.length-t),c=c.substring(0,c.length-t))),0===o?e.splice(n-l,o+l,[1,u]):0===l?e.splice(n-o,o+l,[r,c]):e.splice(n-o-l,o+l,[r,c],[1,u]),n=n-o-l+(o?1:0)+(l?1:0)+1):0!==n&&0==e[n-1][0]?(e[n-1][1]+=e[n][1],e.splice(n,1)):n++,l=0,o=0,c="",u=""}""===e[e.length-1][1]&&e.pop();var d=!1;for(n=1;n<e.length-1;)0==e[n-1][0]&&0==e[n+1][0]&&(e[n][1].substring(e[n][1].length-e[n-1][1].length)==e[n-1][1]?(e[n][1]=e[n-1][1]+e[n][1].substring(0,e[n][1].length-e[n-1][1].length),e[n+1][1]=e[n-1][1]+e[n+1][1],e.splice(n-1,1),d=!0):e[n][1].substring(0,e[n+1][1].length)==e[n+1][1]&&(e[n-1][1]+=e[n+1][1],e[n][1]=e[n][1].substring(e[n+1][1].length)+e[n+1][1],e.splice(n+1,1),d=!0)),n++;d&&s(e)}var l=n;function c(e,t,r){for(var n=t+r-1;n>=0&&n>=t-1;n--)if(n+1<e.length){var o=e[n],a=e[n+1];o[0]===a[1]&&e.splice(n,2,[o[0],o[1]+a[1]])}return e}l.INSERT=1,l.DELETE=r,l.EQUAL=0,e.exports=l},function(e,t){function r(e){var t=[];for(var r in e)t.push(r);return t}(e.exports="function"==typeof Object.keys?Object.keys:r).shim=r},function(e,t){var r="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function o(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}(t=e.exports=r?n:o).supported=n,t.unsupported=o},function(e,t){var r=Object.prototype.hasOwnProperty,n="~";function o(){}function a(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function i(){this._events=new o,this._eventsCount=0}Object.create&&(o.prototype=Object.create(null),(new o).__proto__||(n=!1)),i.prototype.eventNames=function(){var e,t,o=[];if(0===this._eventsCount)return o;for(t in e=this._events)r.call(e,t)&&o.push(n?t.slice(1):t);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},i.prototype.listeners=function(e,t){var r=n?n+e:e,o=this._events[r];if(t)return!!o;if(!o)return[];if(o.fn)return[o.fn];for(var a=0,i=o.length,s=new Array(i);a<i;a++)s[a]=o[a].fn;return s},i.prototype.emit=function(e,t,r,o,a,i){var s=n?n+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],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,o),!0;case 5:return u.fn.call(u.context,t,r,o,a),!0;case 6:return u.fn.call(u.context,t,r,o,a,i),!0}for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var f,p=u.length;for(c=0;c<p;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,o);break;default:if(!l)for(f=1,l=new Array(d-1);f<d;f++)l[f-1]=arguments[f];u[c].fn.apply(u[c].context,l)}}return!0},i.prototype.on=function(e,t,r){var o=new a(t,r||this),i=n?n+e:e;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):(this._events[i]=o,this._eventsCount++),this},i.prototype.once=function(e,t,r){var o=new a(t,r||this,!0),i=n?n+e:e;return this._events[i]?this._events[i].fn?this._events[i]=[this._events[i],o]:this._events[i].push(o):(this._events[i]=o,this._eventsCount++),this},i.prototype.removeListener=function(e,t,r,a){var i=n?n+e:e;if(!this._events[i])return this;if(!t)return 0===--this._eventsCount?this._events=new o:delete this._events[i],this;var s=this._events[i];if(s.fn)s.fn!==t||a&&!s.once||r&&s.context!==r||(0===--this._eventsCount?this._events=new o:delete this._events[i]);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||a&&!s[l].once||r&&s[l].context!==r)&&c.push(s[l]);c.length?this._events[i]=1===c.length?c[0]:c:0===--this._eventsCount?this._events=new o:delete this._events[i]}return this},i.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&(0===--this._eventsCount?this._events=new o:delete this._events[t])):(this._events=new o,this._eventsCount=0),this},i.prototype.off=i.prototype.removeListener,i.prototype.addListener=i.prototype.on,i.prototype.setMaxListeners=function(){return this},i.prefixed=n,i.EventEmitter=i,void 0!==e&&(e.exports=i)},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.matchText=t.matchSpacing=t.matchNewline=t.matchBlot=t.matchAttributor=t.default=void 0;var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=b(r(3)),s=b(r(2)),l=b(r(0)),c=b(r(5)),u=b(r(10)),d=b(r(9)),f=r(36),p=r(37),h=b(r(13)),m=r(26),y=r(38),g=r(39),v=r(40);function b(e){return e&&e.__esModule?e:{default:e}}function x(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var w=(0,u.default)("quill:clipboard"),N="__ql-matcher",j=[[Node.TEXT_NODE,M],[Node.TEXT_NODE,L],["br",function(e,t){return A(t,"\n")||t.insert("\n"),t}],[Node.ELEMENT_NODE,L],[Node.ELEMENT_NODE,R],[Node.ELEMENT_NODE,I],[Node.ELEMENT_NODE,q],[Node.ELEMENT_NODE,function(e,t){var r={},n=e.style||{};return n.fontStyle&&"italic"===S(e).fontStyle&&(r.italic=!0),n.fontWeight&&(S(e).fontWeight.startsWith("bold")||parseInt(S(e).fontWeight)>=700)&&(r.bold=!0),Object.keys(r).length>0&&(t=E(t,r)),parseFloat(n.textIndent||0)>0&&(t=(new s.default).insert("\t").concat(t)),t}],["li",function(e,t){var r=l.default.query(e);if(null==r||"list-item"!==r.blotName||!A(t,"\n"))return t;for(var n=-1,o=e.parentNode;!o.classList.contains("ql-clipboard");)"list"===(l.default.query(o)||{}).blotName&&(n+=1),o=o.parentNode;return n<=0?t:t.compose((new s.default).retain(t.length()-1).retain(1,{indent:n}))}],["b",P.bind(P,"bold")],["i",P.bind(P,"italic")],["style",function(){return new s.default}]],_=[f.AlignAttribute,y.DirectionAttribute].reduce(function(e,t){return e[t.keyName]=t,e},{}),k=[f.AlignStyle,p.BackgroundStyle,m.ColorStyle,y.DirectionStyle,g.FontStyle,v.SizeStyle].reduce(function(e,t){return e[t.keyName]=t,e},{}),O=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.root.addEventListener("paste",n.onPaste.bind(n)),n.container=n.quill.addContainer("ql-clipboard"),n.container.setAttribute("contenteditable",!0),n.container.setAttribute("tabindex",-1),n.matchers=[],j.concat(n.options.matchers).forEach(function(e){var t=o(e,2),a=t[0],i=t[1];(r.matchVisual||i!==I)&&n.addMatcher(a,i)}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),a(t,[{key:"addMatcher",value:function(e,t){this.matchers.push([e,t])}},{key:"convert",value:function(e){if("string"==typeof e)return this.container.innerHTML=e.replace(/\>\r?\n +\</g,"><"),this.convert();var t=this.quill.getFormat(this.quill.selection.savedRange.index);if(t[h.default.blotName]){var r=this.container.innerText;return this.container.innerHTML="",(new s.default).insert(r,x({},h.default.blotName,t[h.default.blotName]))}var n=this.prepareMatching(),a=o(n,2),i=a[0],l=a[1],c=C(this.container,i,l);return A(c,"\n")&&null==c.ops[c.ops.length-1].attributes&&(c=c.compose((new s.default).retain(c.length()-1).delete(1))),w.log("convert",this.container.innerHTML,c),this.container.innerHTML="",c}},{key:"dangerouslyPasteHTML",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.default.sources.API;if("string"==typeof e)this.quill.setContents(this.convert(e),t),this.quill.setSelection(0,c.default.sources.SILENT);else{var n=this.convert(t);this.quill.updateContents((new s.default).retain(e).concat(n),r),this.quill.setSelection(e+n.length(),c.default.sources.SILENT)}}},{key:"onPaste",value:function(e){var t=this;if(!e.defaultPrevented&&this.quill.isEnabled()){var r=this.quill.getSelection(),n=(new s.default).retain(r.index),o=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(c.default.sources.SILENT),setTimeout(function(){n=n.concat(t.convert()).delete(r.length),t.quill.updateContents(n,c.default.sources.USER),t.quill.setSelection(n.length()-r.length,c.default.sources.SILENT),t.quill.scrollingContainer.scrollTop=o,t.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var e=this,t=[],r=[];return this.matchers.forEach(function(n){var a=o(n,2),i=a[0],s=a[1];switch(i){case Node.TEXT_NODE:r.push(s);break;case Node.ELEMENT_NODE:t.push(s);break;default:[].forEach.call(e.container.querySelectorAll(i),function(e){e[N]=e[N]||[],e[N].push(s)})}}),[t,r]}}]),t}(d.default);function E(e,t,r){return"object"===(void 0===t?"undefined":n(t))?Object.keys(t).reduce(function(e,r){return E(e,r,t[r])},e):e.reduce(function(e,n){return n.attributes&&n.attributes[t]?e.push(n):e.insert(n.insert,(0,i.default)({},x({},t,r),n.attributes))},new s.default)}function S(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};var t="__ql-computed-style";return e[t]||(e[t]=window.getComputedStyle(e))}function A(e,t){for(var r="",n=e.ops.length-1;n>=0&&r.length<t.length;--n){var o=e.ops[n];if("string"!=typeof o.insert)break;r=o.insert+r}return r.slice(-1*t.length)===t}function T(e){if(0===e.childNodes.length)return!1;var t=S(e);return["block","list-item"].indexOf(t.display)>-1}function C(e,t,r){return e.nodeType===e.TEXT_NODE?r.reduce(function(t,r){return r(e,t)},new s.default):e.nodeType===e.ELEMENT_NODE?[].reduce.call(e.childNodes||[],function(n,o){var a=C(o,t,r);return o.nodeType===e.ELEMENT_NODE&&(a=t.reduce(function(e,t){return t(o,e)},a),a=(o[N]||[]).reduce(function(e,t){return t(o,e)},a)),n.concat(a)},new s.default):new s.default}function P(e,t,r){return E(r,e,!0)}function q(e,t){var r=l.default.Attributor.Attribute.keys(e),n=l.default.Attributor.Class.keys(e),o=l.default.Attributor.Style.keys(e),a={};return r.concat(n).concat(o).forEach(function(t){var r=l.default.query(t,l.default.Scope.ATTRIBUTE);null!=r&&(a[r.attrName]=r.value(e),a[r.attrName])||(null==(r=_[t])||r.attrName!==t&&r.keyName!==t||(a[r.attrName]=r.value(e)||void 0),null==(r=k[t])||r.attrName!==t&&r.keyName!==t||(r=k[t],a[r.attrName]=r.value(e)||void 0))}),Object.keys(a).length>0&&(t=E(t,a)),t}function R(e,t){var r=l.default.query(e);if(null==r)return t;if(r.prototype instanceof l.default.Embed){var n={},o=r.value(e);null!=o&&(n[r.blotName]=o,t=(new s.default).insert(n,r.formats(e)))}else"function"==typeof r.formats&&(t=E(t,r.blotName,r.formats(e)));return t}function L(e,t){return A(t,"\n")||(T(e)||t.length()>0&&e.nextSibling&&T(e.nextSibling))&&t.insert("\n"),t}function I(e,t){if(T(e)&&null!=e.nextElementSibling&&!A(t,"\n\n")){var r=e.offsetHeight+parseFloat(S(e).marginTop)+parseFloat(S(e).marginBottom);e.nextElementSibling.offsetTop>e.offsetTop+1.5*r&&t.insert("\n")}return t}function M(e,t){var r=e.data;if("O:P"===e.parentNode.tagName)return t.insert(r.trim());if(0===r.trim().length&&e.parentNode.classList.contains("ql-clipboard"))return t;if(!S(e.parentNode).whiteSpace.startsWith("pre")){var n=function(e,t){return(t=t.replace(/[^\u00a0]/g,"")).length<1&&e?" ":t};r=(r=r.replace(/\r\n/g," ").replace(/\n/g," ")).replace(/\s\s+/g,n.bind(n,!0)),(null==e.previousSibling&&T(e.parentNode)||null!=e.previousSibling&&T(e.previousSibling))&&(r=r.replace(/^\s+/,n.bind(n,!1))),(null==e.nextSibling&&T(e.parentNode)||null!=e.nextSibling&&T(e.nextSibling))&&(r=r.replace(/\s+$/,n.bind(n,!1)))}return t.insert(r)}O.DEFAULTS={matchers:[],matchVisual:!0},t.default=O,t.matchAttributor=q,t.matchBlot=R,t.matchNewline=L,t.matchSpacing=I,t.matchText=M},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(6),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"optimize",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);s.blotName="bold",s.tagName=["STRONG","B"],t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.addControls=t.default=void 0;var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=u(r(2)),i=u(r(0)),s=u(r(5)),l=u(r(10)),c=u(r(9));function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}var f=(0,l.default)("quill:toolbar"),p=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o,a=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));if(Array.isArray(a.options.container)){var i=document.createElement("div");m(i,a.options.container),e.container.parentNode.insertBefore(i,e.container),a.container=i}else"string"==typeof a.options.container?a.container=document.querySelector(a.options.container):a.container=a.options.container;return a.container instanceof HTMLElement?(a.container.classList.add("ql-toolbar"),a.controls=[],a.handlers={},Object.keys(a.options.handlers).forEach(function(e){a.addHandler(e,a.options.handlers[e])}),[].forEach.call(a.container.querySelectorAll("button, select"),function(e){a.attach(e)}),a.quill.on(s.default.events.EDITOR_CHANGE,function(e,t){e===s.default.events.SELECTION_CHANGE&&a.update(t)}),a.quill.on(s.default.events.SCROLL_OPTIMIZE,function(){var e=a.quill.selection.getRange(),t=n(e,1)[0];a.update(t)}),a):(o=f.error("Container required for toolbar",a.options),d(a,o))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"addHandler",value:function(e,t){this.handlers[e]=t}},{key:"attach",value:function(e){var t=this,r=[].find.call(e.classList,function(e){return 0===e.indexOf("ql-")});if(r){if(r=r.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[r]){if(null!=this.quill.scroll.whitelist&&null==this.quill.scroll.whitelist[r])return void f.warn("ignoring attaching to disabled format",r,e);if(null==i.default.query(r))return void f.warn("ignoring attaching to nonexistent format",r,e)}var o="SELECT"===e.tagName?"change":"click";e.addEventListener(o,function(o){var l=void 0;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;var c=e.options[e.selectedIndex];l=!c.hasAttribute("selected")&&(c.value||!1)}else l=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),o.preventDefault();t.quill.focus();var u=t.quill.selection.getRange(),d=n(u,1)[0];if(null!=t.handlers[r])t.handlers[r].call(t,l);else if(i.default.query(r).prototype instanceof i.default.Embed){if(!(l=prompt("Enter "+r)))return;t.quill.updateContents((new a.default).retain(d.index).delete(d.length).insert(function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}({},r,l)),s.default.sources.USER)}else t.quill.format(r,l,s.default.sources.USER);t.update(d)}),this.controls.push([r,e])}}},{key:"update",value:function(e){var t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(function(r){var o=n(r,2),a=o[0],i=o[1];if("SELECT"===i.tagName){var s=void 0;if(null==e)s=null;else if(null==t[a])s=i.querySelector("option[selected]");else if(!Array.isArray(t[a])){var l=t[a];"string"==typeof l&&(l=l.replace(/\"/g,'\\"')),s=i.querySelector('option[value="'+l+'"]')}null==s?(i.value="",i.selectedIndex=-1):s.selected=!0}else if(null==e)i.classList.remove("ql-active");else if(i.hasAttribute("value")){var c=t[a]===i.getAttribute("value")||null!=t[a]&&t[a].toString()===i.getAttribute("value")||null==t[a]&&!i.getAttribute("value");i.classList.toggle("ql-active",c)}else i.classList.toggle("ql-active",null!=t[a])})}}]),t}(c.default);function h(e,t,r){var n=document.createElement("button");n.setAttribute("type","button"),n.classList.add("ql-"+t),null!=r&&(n.value=r),e.appendChild(n)}function m(e,t){Array.isArray(t[0])||(t=[t]),t.forEach(function(t){var r=document.createElement("span");r.classList.add("ql-formats"),t.forEach(function(e){if("string"==typeof e)h(r,e);else{var t=Object.keys(e)[0],n=e[t];Array.isArray(n)?function(e,t,r){var n=document.createElement("select");n.classList.add("ql-"+t),r.forEach(function(e){var t=document.createElement("option");!1!==e?t.setAttribute("value",e):t.setAttribute("selected","selected"),n.appendChild(t)}),e.appendChild(n)}(r,t,n):h(r,t,n)}}),e.appendChild(r)})}p.DEFAULTS={},p.DEFAULTS={container:null,handlers:{clean:function(){var e=this,t=this.quill.getSelection();if(null!=t)if(0==t.length){var r=this.quill.getFormat();Object.keys(r).forEach(function(t){null!=i.default.query(t,i.default.Scope.INLINE)&&e.quill.format(t,!1)})}else this.quill.removeFormat(t,s.default.sources.USER)},direction:function(e){var t=this.quill.getFormat().align;"rtl"===e&&null==t?this.quill.format("align","right",s.default.sources.USER):e||"right"!==t||this.quill.format("align",!1,s.default.sources.USER),this.quill.format("direction",e,s.default.sources.USER)},indent:function(e){var t=this.quill.getSelection(),r=this.quill.getFormat(t),n=parseInt(r.indent||0);if("+1"===e||"-1"===e){var o="+1"===e?1:-1;"rtl"===r.direction&&(o*=-1),this.quill.format("indent",n+o,s.default.sources.USER)}},link:function(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,s.default.sources.USER)},list:function(e){var t=this.quill.getSelection(),r=this.quill.getFormat(t);"check"===e?"checked"===r.list||"unchecked"===r.list?this.quill.format("list",!1,s.default.sources.USER):this.quill.format("list","unchecked",s.default.sources.USER):this.quill.format("list",e,s.default.sources.USER)}}},t.default=p,t.addControls=m},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(28),s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.label.innerHTML=r,n.container.classList.add("ql-color-picker"),[].slice.call(n.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(e){e.classList.add("ql-primary")}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"buildItem",value:function(e){var r=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"buildItem",this).call(this,e);return r.style.backgroundColor=e.getAttribute("value")||"",r}},{key:"selectItem",value:function(e,r){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,r);var n=this.label.querySelector(".ql-color-label"),o=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=o:n.style.fill=o)}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(28),s=function(e){function t(e,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.container.classList.add("ql-icon-picker"),[].forEach.call(n.container.querySelectorAll(".ql-picker-item"),function(e){e.innerHTML=r[e.getAttribute("data-value")||""]}),n.defaultItem=n.container.querySelector(".ql-selected"),n.selectItem(n.defaultItem),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"selectItem",value:function(e,r){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,r),e=e||this.defaultItem,this.label.innerHTML=e.innerHTML}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function(){function e(t,r){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.quill=t,this.boundsContainer=r||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){n.root.style.marginTop=-1*n.quill.root.scrollTop+"px"}),this.hide()}return n(e,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(e){var t=e.left+e.width/2-this.root.offsetWidth/2,r=e.bottom+this.quill.root.scrollTop;this.root.style.left=t+"px",this.root.style.top=r+"px",this.root.classList.remove("ql-flip");var n=this.boundsContainer.getBoundingClientRect(),o=this.root.getBoundingClientRect(),a=0;if(o.right>n.right&&(a=n.right-o.right,this.root.style.left=t+a+"px"),o.left<n.left&&(a=n.left-o.left,this.root.style.left=t+a+"px"),o.bottom>n.bottom){var i=o.bottom-o.top,s=e.bottom-e.top+i;this.root.style.top=r-s+"px",this.root.classList.add("ql-flip")}return a}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),e}();t.default=o},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],n=!0,o=!1,a=void 0;try{for(var i,s=e[Symbol.iterator]();!(n=(i=s.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{!n&&s.return&&s.return()}finally{if(o)throw a}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")},o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),i=p(r(3)),s=p(r(8)),l=r(43),c=p(l),u=p(r(27)),d=r(15),f=p(r(41));function p(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function y(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var g=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],v=function(e){function t(e,r){h(this,t),null!=r.modules.toolbar&&null==r.modules.toolbar.container&&(r.modules.toolbar.container=g);var n=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.container.classList.add("ql-snow"),n}return y(t,e),a(t,[{key:"extendToolbar",value:function(e){e.container.classList.add("ql-snow"),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),f.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),f.default),this.tooltip=new b(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(t,r){e.handlers.link.call(e,!r.format.link)})}}]),t}(c.default);v.DEFAULTS=(0,i.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){if(e){var t=this.quill.getSelection();if(null==t||0==t.length)return;var r=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(r)&&0!==r.indexOf("mailto:")&&(r="mailto:"+r),this.quill.theme.tooltip.edit("link",r)}else this.quill.format("link",!1)}}}}});var b=function(e){function t(e,r){h(this,t);var n=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.preview=n.root.querySelector("a.ql-preview"),n}return y(t,e),a(t,[{key:"listen",value:function(){var e=this;o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(t){e.root.classList.contains("ql-editing")?e.save():e.edit("link",e.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(t){if(null!=e.linkRange){var r=e.linkRange;e.restoreFocus(),e.quill.formatText(r,"link",!1,s.default.sources.USER),delete e.linkRange}t.preventDefault(),e.hide()}),this.quill.on(s.default.events.SELECTION_CHANGE,function(t,r,o){if(null!=t){if(0===t.length&&o===s.default.sources.USER){var a=e.quill.scroll.descendant(u.default,t.index),i=n(a,2),l=i[0],c=i[1];if(null!=l){e.linkRange=new d.Range(t.index-c,l.length());var f=u.default.formats(l.domNode);return e.preview.textContent=f,e.preview.setAttribute("href",f),e.show(),void e.position(e.quill.getBounds(e.linkRange))}}else delete e.linkRange;e.hide()}})}},{key:"show",value:function(){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),t}(l.BaseTooltip);b.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(""),t.default=v},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=L(r(29)),o=r(36),a=r(38),i=r(64),s=L(r(65)),l=L(r(66)),c=r(67),u=L(c),d=r(37),f=r(26),p=r(39),h=r(40),m=L(r(56)),y=L(r(68)),g=L(r(27)),v=L(r(69)),b=L(r(70)),x=L(r(71)),w=L(r(72)),N=L(r(73)),j=r(13),_=L(j),k=L(r(74)),O=L(r(75)),E=L(r(57)),S=L(r(41)),A=L(r(28)),T=L(r(59)),C=L(r(60)),P=L(r(61)),q=L(r(108)),R=L(r(62));function L(e){return e&&e.__esModule?e:{default:e}}n.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":o.AlignClass,"attributors/class/background":d.BackgroundClass,"attributors/class/color":f.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":p.FontClass,"attributors/class/size":h.SizeClass,"attributors/style/align":o.AlignStyle,"attributors/style/background":d.BackgroundStyle,"attributors/style/color":f.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":p.FontStyle,"attributors/style/size":h.SizeStyle},!0),n.default.register({"formats/align":o.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":i.IndentClass,"formats/background":d.BackgroundStyle,"formats/color":f.ColorStyle,"formats/font":p.FontClass,"formats/size":h.SizeClass,"formats/blockquote":s.default,"formats/code-block":_.default,"formats/header":l.default,"formats/list":u.default,"formats/bold":m.default,"formats/code":j.Code,"formats/italic":y.default,"formats/link":g.default,"formats/script":v.default,"formats/strike":b.default,"formats/underline":x.default,"formats/image":w.default,"formats/video":N.default,"formats/list/item":c.ListItem,"modules/formula":k.default,"modules/syntax":O.default,"modules/toolbar":E.default,"themes/bubble":q.default,"themes/snow":R.default,"ui/icons":S.default,"ui/picker":A.default,"ui/icon-picker":C.default,"ui/color-picker":T.default,"ui/tooltip":P.default},!0),t.default=n.default},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.IndentClass=void 0;var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"add",value:function(e,r){if("+1"===r||"-1"===r){var n=this.value(e)||0;r="+1"===r?n+1:n-1}return 0===r?(this.remove(e),!0):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"add",this).call(this,e,r)}},{key:"canAdd",value:function(e,r){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,r)||a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,parseInt(r))}},{key:"value",value:function(e){return parseInt(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e))||void 0}}]),t}(s.default.Attributor.Class),c=new l("indent","ql-indent",{scope:s.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});t.IndentClass=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(4),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="blockquote",a.tagName="blockquote",t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(4),i=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,null,[{key:"formats",value:function(e){return this.tagName.indexOf(e.tagName)+1}}]),t}(((n=a)&&n.__esModule?n:{default:n}).default);i.blotName="header",i.tagName=["H1","H2","H3","H4","H5","H6"],t.default=i},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ListItem=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=l(r(0)),i=l(r(4)),s=l(r(25));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),n(t,[{key:"format",value:function(e,r){e!==p.blotName||r?o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r):this.replaceWith(a.default.create(this.statics.scope))}},{key:"remove",value:function(){null==this.prev&&null==this.next?this.parent.remove():o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(e,r){return this.parent.isolate(this.offset(this.parent),this.length()),e===this.parent.statics.blotName?(this.parent.replaceWith(e,r),this):(this.parent.unwrap(),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e,r))}}],[{key:"formats",value:function(e){return e.tagName===this.tagName?void 0:o(t.__proto__||Object.getPrototypeOf(t),"formats",this).call(this,e)}}]),t}(i.default);f.blotName="list-item",f.tagName="LI";var p=function(e){function t(e){c(this,t);var r=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),n=function(t){if(t.target.parentNode===e){var n=r.statics.formats(e),o=a.default.find(t.target);"checked"===n?o.format("list","unchecked"):"unchecked"===n&&o.format("list","checked")}};return e.addEventListener("touchstart",n),e.addEventListener("mousedown",n),r}return d(t,e),n(t,null,[{key:"create",value:function(e){var r="ordered"===e?"OL":"UL",n=o(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,r);return"checked"!==e&&"unchecked"!==e||n.setAttribute("data-checked","checked"===e),n}},{key:"formats",value:function(e){return"OL"===e.tagName?"ordered":"UL"===e.tagName?e.hasAttribute("data-checked")?"true"===e.getAttribute("data-checked")?"checked":"unchecked":"bullet":void 0}}]),n(t,[{key:"format",value:function(e,t){this.children.length>0&&this.children.tail.format(e,t)}},{key:"formats",value:function(){return e={},t=this.statics.blotName,r=this.statics.formats(this.domNode),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e;var e,t,r}},{key:"insertBefore",value:function(e,r){if(e instanceof f)o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,r);else{var n=null==r?this.length():r.offset(this),a=this.split(n);a.parent.insertBefore(e,a)}}},{key:"optimize",value:function(e){o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var r=this.next;null!=r&&r.prev===this&&r.statics.blotName===this.statics.blotName&&r.domNode.tagName===this.domNode.tagName&&r.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(r.moveChildren(this),r.remove())}},{key:"replace",value:function(e){if(e.statics.blotName!==this.statics.blotName){var r=a.default.create(this.statics.defaultChild);e.moveChildren(r),this.appendChild(r)}o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e)}}]),t}(s.default);p.blotName="list",p.scope=a.default.Scope.BLOCK_BLOT,p.tagName=["OL","UL"],p.defaultChild="list-item",p.allowedChildren=[f],t.ListItem=f,t.default=p},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(56),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="italic",a.tagName=["EM","I"],t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(6),s=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,null,[{key:"create",value:function(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e)}},{key:"formats",value:function(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}]),t}(((n=i)&&n.__esModule?n:{default:n}).default);s.blotName="script",s.tagName=["SUB","SUP"],t.default=s},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(6),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="strike",a.tagName="S",t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(6),a=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),t}(((n=o)&&n.__esModule?n:{default:n}).default);a.blotName="underline",a.tagName="U",t.default=a},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(0),s=(n=i)&&n.__esModule?n:{default:n},l=r(27),c=["alt","height","width"],u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"format",value:function(e,r){c.indexOf(e)>-1?r?this.domNode.setAttribute(e,r):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r)}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&r.setAttribute("src",this.sanitize(e)),r}},{key:"formats",value:function(e){return c.reduce(function(t,r){return e.hasAttribute(r)&&(t[r]=e.getAttribute(r)),t},{})}},{key:"match",value:function(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}},{key:"sanitize",value:function(e){return(0,l.sanitize)(e,["http","https","data"])?e:"//:0"}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(s.default.Embed);u.blotName="image",u.tagName="IMG",t.default=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n,o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},i=r(4),s=r(27),l=(n=s)&&n.__esModule?n:{default:n},c=["height","width"],u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),o(t,[{key:"format",value:function(e,r){c.indexOf(e)>-1?r?this.domNode.setAttribute(e,r):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,r)}}],[{key:"create",value:function(e){var r=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return r.setAttribute("frameborder","0"),r.setAttribute("allowfullscreen",!0),r.setAttribute("src",this.sanitize(e)),r}},{key:"formats",value:function(e){return c.reduce(function(t,r){return e.hasAttribute(r)&&(t[r]=e.getAttribute(r)),t},{})}},{key:"sanitize",value:function(e){return l.default.sanitize(e)}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(i.BlockEmbed);u.blotName="video",u.className="ql-video",u.tagName="IFRAME",t.default=u},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FormulaBlot=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=l(r(35)),i=l(r(5)),s=l(r(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),n(t,null,[{key:"create",value:function(e){var r=o(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&(window.katex.render(e,r,{throwOnError:!1,errorColor:"#f00"}),r.setAttribute("data-value",e)),r}},{key:"value",value:function(e){return e.getAttribute("data-value")}}]),t}(a.default);f.blotName="formula",f.className="ql-formula",f.tagName="SPAN";var p=function(e){function t(){c(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(null==window.katex)throw new Error("Formula module requires KaTeX.");return e}return d(t,e),n(t,null,[{key:"register",value:function(){i.default.register(f,!0)}}]),t}(s.default);t.FormulaBlot=f,t.default=p},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.CodeToken=t.CodeBlock=void 0;var n=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},a=l(r(0)),i=l(r(5)),s=l(r(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function d(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var f=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),n(t,[{key:"replaceWith",value:function(e){this.domNode.textContent=this.domNode.textContent,this.attach(),o(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e)}},{key:"highlight",value:function(e){var t=this.domNode.textContent;this.cachedText!==t&&((t.trim().length>0||null==this.cachedText)&&(this.domNode.innerHTML=e(t),this.domNode.normalize(),this.attach()),this.cachedText=t)}}]),t}(l(r(13)).default);f.className="ql-syntax";var p=new a.default.Attributor.Class("token","hljs",{scope:a.default.Scope.INLINE}),h=function(e){function t(e,r){c(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));if("function"!=typeof n.options.highlight)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var o=null;return n.quill.on(i.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(o),o=setTimeout(function(){n.highlight(),o=null},n.options.interval)}),n.highlight(),n}return d(t,e),n(t,null,[{key:"register",value:function(){i.default.register(p,!0),i.default.register(f,!0)}}]),n(t,[{key:"highlight",value:function(){var e=this;if(!this.quill.selection.composing){this.quill.update(i.default.sources.USER);var t=this.quill.getSelection();this.quill.scroll.descendants(f).forEach(function(t){t.highlight(e.options.highlight)}),this.quill.update(i.default.sources.SILENT),null!=t&&this.quill.setSelection(t,i.default.sources.SILENT)}}}]),t}(s.default);h.DEFAULTS={highlight:null==window.hljs?null:function(e){return window.hljs.highlightAuto(e).value},interval:1e3},t.CodeBlock=f,t.CodeToken=p,t.default=h},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<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"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <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"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'},function(e,t){e.exports='<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> <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></path> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'},function(e,t){e.exports='<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></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <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></path> </svg>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <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> <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></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <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> <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> <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></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<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>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <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> <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></path> </svg>'},function(e,t){e.exports='<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></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BubbleTooltip=void 0;var n=function e(t,r,n){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,r);if(void 0===o){var a=Object.getPrototypeOf(t);return null===a?void 0:e(a,r,n)}if("value"in o)return o.value;var i=o.get;return void 0!==i?i.call(n):void 0},o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=d(r(3)),i=d(r(8)),s=r(43),l=d(s),c=r(15),u=d(r(41));function d(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],y=function(e){function t(e,r){f(this,t),null!=r.modules.toolbar&&null==r.modules.toolbar.container&&(r.modules.toolbar.container=m);var n=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.container.classList.add("ql-bubble"),n}return h(t,e),o(t,[{key:"extendToolbar",value:function(e){this.tooltip=new g(this.quill,this.options.bounds),this.tooltip.root.appendChild(e.container),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),u.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),u.default)}}]),t}(l.default);y.DEFAULTS=(0,a.default)(!0,{},l.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var g=function(e){function t(e,r){f(this,t);var n=p(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return n.quill.on(i.default.events.EDITOR_CHANGE,function(e,t,r,o){if(e===i.default.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&o===i.default.sources.USER){n.show(),n.root.style.left="0px",n.root.style.width="",n.root.style.width=n.root.offsetWidth+"px";var a=n.quill.getLines(t.index,t.length);if(1===a.length)n.position(n.quill.getBounds(t));else{var s=a[a.length-1],l=n.quill.getIndex(s),u=Math.min(s.length()-1,t.index+t.length-l),d=n.quill.getBounds(new c.Range(l,u));n.position(d)}}else document.activeElement!==n.textbox&&n.quill.hasFocus()&&n.hide()}),n}return h(t,e),o(t,[{key:"listen",value:function(){var e=this;n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){e.root.classList.remove("ql-editing")}),this.quill.on(i.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!e.root.classList.contains("ql-hidden")){var t=e.quill.getSelection();null!=t&&e.position(e.quill.getBounds(t))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(e){var r=n(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"position",this).call(this,e),o=this.root.querySelector(".ql-tooltip-arrow");if(o.style.marginLeft="",0===r)return r;o.style.marginLeft=-1*r-o.offsetWidth/2+"px"}}]),t}(s.BaseTooltip);g.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(""),t.BubbleTooltip=g,t.default=y},function(e,t,r){e.exports=r(63)}]).default},Ru.exports=e());var e}var Iu=function(){if(qu)return Pu;qu=1;var e,r=Pu&&Pu.__extends||(e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},e(t,r)},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),n=Pu&&Pu.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},n.apply(this,arguments)},o=Pu&&Pu.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var a=arguments[t],i=0,s=a.length;i<s;i++,o++)n[o]=a[i];return n},a=Pu&&Pu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},i=a(t),s=a(xt),l=a(Tu()),c=a(Lu()),u=function(e){function t(t){var r=e.call(this,t)||this;r.dirtyProps=["modules","formats","bounds","theme","children"],r.cleanProps=["id","className","style","placeholder","tabIndex","onChange","onChangeSelection","onFocus","onBlur","onKeyPress","onKeyDown","onKeyUp"],r.state={generation:0},r.selection=null,r.onEditorChange=function(e,t,n,o){var a,i,s,l;"text-change"===e?null===(i=(a=r).onEditorChangeText)||void 0===i||i.call(a,r.editor.root.innerHTML,t,o,r.unprivilegedEditor):"selection-change"===e&&(null===(l=(s=r).onEditorChangeSelection)||void 0===l||l.call(s,t,o,r.unprivilegedEditor))};var n=r.isControlled()?t.value:t.defaultValue;return r.value=null!=n?n:"",r}return r(t,e),t.prototype.validateProps=function(e){var t;if(i.default.Children.count(e.children)>1)throw new Error("The Quill editing area can only be composed of a single React element.");if(i.default.Children.count(e.children)&&"textarea"===(null===(t=i.default.Children.only(e.children))||void 0===t?void 0:t.type))throw new Error("Quill does not support editing on a <textarea>. Use a <div> instead.");if(this.lastDeltaChangeSet&&e.value===this.lastDeltaChangeSet)throw new Error("You are passing the `delta` object from the `onChange` event back as `value`. You most probably want `editor.getContents()` instead. See: https://github.com/zenoamaro/react-quill#using-deltas")},t.prototype.shouldComponentUpdate=function(e,t){var r,n=this;if(this.validateProps(e),!this.editor||this.state.generation!==t.generation)return!0;if("value"in e){var a=this.getEditorContents(),i=null!=(r=e.value)?r:"";this.isEqualValue(i,a)||this.setEditorContents(this.editor,i)}return e.readOnly!==this.props.readOnly&&this.setEditorReadOnly(this.editor,e.readOnly),o(this.cleanProps,this.dirtyProps).some(function(t){return!l.default(e[t],n.props[t])})},t.prototype.shouldComponentRegenerate=function(e){var t=this;return this.dirtyProps.some(function(r){return!l.default(e[r],t.props[r])})},t.prototype.componentDidMount=function(){this.instantiateEditor(),this.setEditorContents(this.editor,this.getEditorContents())},t.prototype.componentWillUnmount=function(){this.destroyEditor()},t.prototype.componentDidUpdate=function(e,t){var r=this;if(this.editor&&this.shouldComponentRegenerate(e)){var n=this.editor.getContents(),o=this.editor.getSelection();this.regenerationSnapshot={delta:n,selection:o},this.setState({generation:this.state.generation+1}),this.destroyEditor()}if(this.state.generation!==t.generation){var a=this.regenerationSnapshot,i=(n=a.delta,a.selection);delete this.regenerationSnapshot,this.instantiateEditor();var s=this.editor;s.setContents(n),d(function(){return r.setEditorSelection(s,i)})}},t.prototype.instantiateEditor=function(){this.editor?this.hookEditor(this.editor):this.editor=this.createEditor(this.getEditingArea(),this.getEditorConfig())},t.prototype.destroyEditor=function(){this.editor&&this.unhookEditor(this.editor)},t.prototype.isControlled=function(){return"value"in this.props},t.prototype.getEditorConfig=function(){return{bounds:this.props.bounds,formats:this.props.formats,modules:this.props.modules,placeholder:this.props.placeholder,readOnly:this.props.readOnly,scrollingContainer:this.props.scrollingContainer,tabIndex:this.props.tabIndex,theme:this.props.theme}},t.prototype.getEditor=function(){if(!this.editor)throw new Error("Accessing non-instantiated editor");return this.editor},t.prototype.createEditor=function(e,t){var r=new c.default(e,t);return null!=t.tabIndex&&this.setEditorTabIndex(r,t.tabIndex),this.hookEditor(r),r},t.prototype.hookEditor=function(e){this.unprivilegedEditor=this.makeUnprivilegedEditor(e),e.on("editor-change",this.onEditorChange)},t.prototype.unhookEditor=function(e){e.off("editor-change",this.onEditorChange)},t.prototype.getEditorContents=function(){return this.value},t.prototype.getEditorSelection=function(){return this.selection},t.prototype.isDelta=function(e){return e&&e.ops},t.prototype.isEqualValue=function(e,t){return this.isDelta(e)&&this.isDelta(t)?l.default(e.ops,t.ops):l.default(e,t)},t.prototype.setEditorContents=function(e,t){var r=this;this.value=t;var n=this.getEditorSelection();"string"==typeof t?e.setContents(e.clipboard.convert(t)):e.setContents(t),d(function(){return r.setEditorSelection(e,n)})},t.prototype.setEditorSelection=function(e,t){if(this.selection=t,t){var r=e.getLength();t.index=Math.max(0,Math.min(t.index,r-1)),t.length=Math.max(0,Math.min(t.length,r-1-t.index)),e.setSelection(t)}},t.prototype.setEditorTabIndex=function(e,t){var r,n;(null===(n=null===(r=e)||void 0===r?void 0:r.scroll)||void 0===n?void 0:n.domNode)&&(e.scroll.domNode.tabIndex=t)},t.prototype.setEditorReadOnly=function(e,t){t?e.disable():e.enable()},t.prototype.makeUnprivilegedEditor=function(e){var t=e;return{getHTML:function(){return t.root.innerHTML},getLength:t.getLength.bind(t),getText:t.getText.bind(t),getContents:t.getContents.bind(t),getSelection:t.getSelection.bind(t),getBounds:t.getBounds.bind(t)}},t.prototype.getEditingArea=function(){if(!this.editingArea)throw new Error("Instantiating on missing editing area");var e=s.default.findDOMNode(this.editingArea);if(!e)throw new Error("Cannot find element for editing area");if(3===e.nodeType)throw new Error("Editing area cannot be a text node");return e},t.prototype.renderEditingArea=function(){var e=this,t=this.props,r=t.children,o=t.preserveWhitespace,a={key:this.state.generation,ref:function(t){e.editingArea=t}};return i.default.Children.count(r)?i.default.cloneElement(i.default.Children.only(r),a):o?i.default.createElement("pre",n({},a)):i.default.createElement("div",n({},a))},t.prototype.render=function(){var e;return i.default.createElement("div",{id:this.props.id,style:this.props.style,key:this.state.generation,className:"quill "+(e=this.props.className,null!=e?e:""),onKeyPress:this.props.onKeyPress,onKeyDown:this.props.onKeyDown,onKeyUp:this.props.onKeyUp},this.renderEditingArea())},t.prototype.onEditorChangeText=function(e,t,r,n){var o,a;if(this.editor){var i=this.isDelta(this.value)?n.getContents():n.getHTML();i!==this.getEditorContents()&&(this.lastDeltaChangeSet=t,this.value=i,null===(a=(o=this.props).onChange)||void 0===a||a.call(o,e,t,r,n))}},t.prototype.onEditorChangeSelection=function(e,t,r){var n,o,a,i,s,c;if(this.editor){var u=this.getEditorSelection(),d=!u&&e,f=u&&!e;l.default(e,u)||(this.selection=e,null===(o=(n=this.props).onChangeSelection)||void 0===o||o.call(n,e,t,r),d?null===(i=(a=this.props).onFocus)||void 0===i||i.call(a,e,t,r):f&&(null===(c=(s=this.props).onBlur)||void 0===c||c.call(s,u,t,r)))}},t.prototype.focus=function(){this.editor&&this.editor.focus()},t.prototype.blur=function(){this.editor&&(this.selection=null,this.editor.blur())},t.displayName="React Quill",t.Quill=c.default,t.defaultProps={theme:"snow",modules:{},readOnly:!1},t}(i.default.Component);function d(e){Promise.resolve().then(e)}return Pu=u}(),Mu=At(Iu);const Du=async(e,t)=>new Promise(t=>{const r=new FileReader;r.onload=()=>t(r.result),r.readAsDataURL(e)}),Fu=async(e,t)=>{const r=Array.from(e.files).find(e=>e.type.startsWith("image/"));return r?Du(r):null},Bu=(e,t)=>{const r=Wu(e),n=Wu(t);return r.filter(e=>!n.includes(e))},zu=(e,t)=>{console.log("Images marked for deletion:",e,"for article:",t)},Uu=(e,t)=>{const r=Wu(e);return Wu(t).filter(e=>!r.includes(e))},$u=async(e,t)=>(console.log("Image restored from deleted:",e,"for article:",t),!0),Hu=e=>{const t=/<img[^>]+src="([^"]+)"/g,r=[];let n;for(;null!==(n=t.exec(e));)n[1].startsWith("http")&&r.push(n[1]);return r},Vu=e=>{const t=/<img[^>]+src="([^"]+)"/g,r=[];let n;for(;null!==(n=t.exec(e));)n[1].startsWith("data:")&&r.push(n[1]);return r},Ku=async(e,t)=>e,Wu=e=>{const t=/<img[^>]+src="([^"]+)"/g,r=[];let n;for(;null!==(n=t.exec(e));)r.push(n[1]);return r},Zu=l(({value:e="",onChange:t,placeholder:r="Digite o conteúdo...",className:o,sessionId:i,articleId:s},l)=>{const u=c(e),d=c(),f=n(()=>{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("accept","image/*"),e.click(),e.onchange=async()=>{const t=e.files?.[0];if(t)try{nt.loading("Fazendo upload da imagem...");i||Date.now();const e=await Du(t);if(e){const t=l&&"object"==typeof l&&"current"in l?l.current:null;if(t){const r=t.getEditor(),n=r.getSelection(),o=n?n.index:0;r.insertEmbed(o,"image",e),r.setSelection({index:o+1,length:0})}nt.success("Imagem inserida com sucesso!")}}catch(e){console.error("Error uploading image:",e),nt.error("Erro ao fazer upload da imagem")}finally{nt.dismiss()}}},[l,i]),p=n(async e=>{const r=u.current;d.current&&clearTimeout(d.current);const n=Uu(r,e);if(n.length>0)for(const e of n){await $u(e,s)&&nt.success("Imagem restaurada automaticamente")}const o=Bu(r,e);o.length>0&&i&&(d.current=setTimeout(()=>{zu(o,s),nt.info("Imagens marcadas para exclusão")},2e3));const a=Vu(e),l=Hu(e),c=a.length+l.length;c>0&&i&&h(e,i,c),u.current=e,t?.(e)},[t,i,s]),h=n(async(e,r,n)=>{try{nt.loading(`Processando ${n} imagem(ns) em segundo plano...`);const r=await Ku(e);if(r!==e){const e=l&&"object"==typeof l&&"current"in l?l.current:null;if(e){const o=e.getEditor(),a=o.root.innerHTML;(a.includes("data:image/")||a.includes("http"))&&(o.root.innerHTML=r,t?.(r),nt.success(`${n} imagem(ns) processada(s) com sucesso!`))}}}catch(e){console.error("Error processing images in background:",e),nt.error("Erro ao processar imagens em segundo plano")}finally{nt.dismiss()}},[l,t]),m=n(async e=>{const t=e.clipboardData;if(!t)return;if(Array.from(t.items).some(e=>e.type.startsWith("image/")&&"file"===e.kind)){e.preventDefault(),e.stopPropagation();const r=await Fu(t);if(r){const e=l&&"object"==typeof l&&"current"in l?l.current:null;if(e){const t=e.getEditor(),n=t.getSelection(),o=n?n.index:0;t.insertEmbed(o,"image",r),t.setSelection({index:o+1,length:0}),nt.success("Imagem colada com sucesso!")}}}},[l,i]);a(()=>{u.current=e},[e]),a(()=>()=>{d.current&&clearTimeout(d.current)},[]),a(()=>{const e=l&&"object"==typeof l&&"current"in l?l.current:null;if(e){const t=e.getEditor().root;return t.addEventListener("paste",m,!0),()=>{t.removeEventListener("paste",m,!0)}}},[m,l,i]);const y={toolbar:{container:[[{header:[1,2,3,!1]}],["bold","italic","underline","strike"],[{list:"ordered"},{list:"bullet"}],["blockquote","code-block"],["link","image"],["clean"]],handlers:{image:f}}};return Mt.jsx("div",{className:Dt("rich-text-editor",o),children:Mt.jsx(Mu,{ref:l,theme:"snow",value:e,onChange:p,modules:y,formats:["header","bold","italic","underline","strike","list","bullet","blockquote","code-block","link","image"],placeholder:r,style:{backgroundColor:"hsl(var(--background))",color:"hsl(var(--foreground))",border:"1px solid hsl(var(--border))",borderRadius:"calc(var(--radius) - 2px)"}})})});Zu.displayName="RichTextEditor";const Gu=e.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},o)=>Mt.jsx(wt.Root,{ref:o,decorative:r,orientation:t,className:Dt("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Gu.displayName=wt.Root.displayName;const Yu=x.Root,Qu=x.Trigger,Xu=x.Close,Ju=x.Portal,ed=e.forwardRef(({className:e,...t},r)=>Mt.jsx(x.Overlay,{className:Dt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:r}));ed.displayName=x.Overlay.displayName;const td=p("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),rd=e.forwardRef(({side:e="right",className:t,children:r,...n},o)=>Mt.jsxs(Ju,{children:[Mt.jsx(ed,{}),Mt.jsxs(x.Content,{ref:o,className:Dt(td({side:e}),t),...n,children:[r,Mt.jsxs(x.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[Mt.jsx(w,{className:"h-4 w-4"}),Mt.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));rd.displayName=x.Content.displayName;const nd=({className:e,...t})=>Mt.jsx("div",{className:Dt("flex flex-col space-y-2 text-center sm:text-left",e),...t});nd.displayName="SheetHeader";const od=({className:e,...t})=>Mt.jsx("div",{className:Dt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});od.displayName="SheetFooter";const ad=e.forwardRef(({className:e,...t},r)=>Mt.jsx(x.Title,{ref:r,className:Dt("text-lg font-semibold text-foreground",e),...t}));ad.displayName=x.Title.displayName;const id=e.forwardRef(({className:e,...t},r)=>Mt.jsx(x.Description,{ref:r,className:Dt("text-sm text-muted-foreground",e),...t}));id.displayName=x.Description.displayName;const sd=Nt.Provider,ld=Nt.Root,cd=Nt.Trigger,ud=e.forwardRef(({className:e,sideOffset:t=4,...r},n)=>Mt.jsx(Nt.Content,{ref:n,sideOffset:t,className:Dt("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));ud.displayName=Nt.Content.displayName;const dd="sidebar:state",fd=e.createContext(null);function pd(){const t=e.useContext(fd);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}const hd=e.forwardRef(({defaultOpen:t=!0,open:r,onOpenChange:n,className:o,style:a,children:i,...s},l)=>{const[c,u]=e.useState(!1);e.useEffect(()=>{const e=()=>u(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const[d,f]=e.useState(!1),[p,h]=e.useState(()=>{if("undefined"!=typeof window){const e=localStorage.getItem(dd);return null!==e?"true"===e:t}return t}),m=r??p,y=e.useCallback(e=>{const t="function"==typeof e?e(m):e;n?n(t):h(t),"undefined"!=typeof window&&localStorage.setItem(dd,String(t))},[n,m]),g=e.useCallback(()=>c?f(e=>!e):y(e=>!e),[c,y,f]);e.useEffect(()=>{const e=e=>{"b"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),g())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g]);const v=m?"expanded":"collapsed",b=e.useMemo(()=>({state:v,open:m,setOpen:y,isMobile:c,openMobile:d,setOpenMobile:f,toggleSidebar:g}),[v,m,y,c,d,f,g]);return Mt.jsx(fd.Provider,{value:b,children:Mt.jsx(sd,{delayDuration:0,children:Mt.jsx("div",{className:Dt("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",o),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4.5rem",...a},ref:l,...s,children:i})})})});hd.displayName="SidebarProvider";const md=e.forwardRef(({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:o,...a},i)=>{const{isMobile:s,state:l,openMobile:c,setOpenMobile:u}=pd();return"none"===r?Mt.jsx("div",{className:Dt("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",n),ref:i,...a,children:o}):s?Mt.jsx(Yu,{open:c,onOpenChange:u,...a,children:Mt.jsxs(rd,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden sidebar-mobile",style:{"--sidebar-width":"18rem"},side:e,children:[Mt.jsx(ad,{className:"sr-only",children:"Menu de Navegação"}),Mt.jsx("div",{className:"flex h-full w-full flex-col",children:o})]})}):Mt.jsxs("div",{ref:i,className:"group peer hidden md:block text-sidebar-foreground","data-state":l,"data-collapsible":"collapsed"===l?r:"","data-variant":t,"data-side":e,children:[Mt.jsx("div",{className:Dt("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180","floating"===t||"inset"===t?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),Mt.jsx("div",{className:Dt("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex","left"===e?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]","floating"===t||"inset"===t?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",n),...a,children:Mt.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow bg-white",children:o})})]})});md.displayName="Sidebar";const yd=e.forwardRef(({className:e,onClick:t,...r},n)=>{const{toggleSidebar:o}=pd();return Mt.jsxs(Ht,{ref:n,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:Dt("h-7 w-7",e),onClick:e=>{t?.(e),o()},...r,children:[Mt.jsx(Me,{}),Mt.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});yd.displayName="SidebarTrigger";const gd=e.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:n}=pd();return Mt.jsx("button",{ref:r,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:n,title:"Toggle Sidebar",className:Dt("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});gd.displayName="SidebarRail";const vd=e.forwardRef(({className:e,...t},r)=>Mt.jsx("main",{ref:r,className:Dt("relative flex min-h-svh flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));vd.displayName="SidebarInset";const bd=e.forwardRef(({className:e,...t},r)=>Mt.jsx(Vt,{ref:r,"data-sidebar":"input",className:Dt("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));bd.displayName="SidebarInput";const xd=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,"data-sidebar":"header",className:Dt("flex flex-col gap-2 p-2",e),...t}));xd.displayName="SidebarHeader";const wd=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,"data-sidebar":"footer",className:Dt("flex flex-col gap-2 p-2",e),...t}));wd.displayName="SidebarFooter";const Nd=e.forwardRef(({className:e,...t},r)=>Mt.jsx(Gu,{ref:r,"data-sidebar":"separator",className:Dt("mx-2 w-auto bg-sidebar-border",e),...t}));Nd.displayName="SidebarSeparator";const jd=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,"data-sidebar":"content",className:Dt("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));jd.displayName="SidebarContent";const _d=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,"data-sidebar":"group",className:Dt("relative flex w-full min-w-0 flex-col p-2",e),...t}));_d.displayName="SidebarGroup";const kd=e.forwardRef(({className:e,asChild:t=!1,...r},n)=>{const o=t?d:"div";return Mt.jsx(o,{ref:n,"data-sidebar":"group-label",className:Dt("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})});kd.displayName="SidebarGroupLabel";const Od=e.forwardRef(({className:e,asChild:t=!1,...r},n)=>{const o=t?d:"button";return Mt.jsx(o,{ref:n,"data-sidebar":"group-action",className:Dt("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...r})});Od.displayName="SidebarGroupAction";const Ed=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,"data-sidebar":"group-content",className:Dt("w-full text-sm",e),...t}));Ed.displayName="SidebarGroupContent";const Sd=e.forwardRef(({className:e,...t},r)=>Mt.jsx("ul",{ref:r,"data-sidebar":"menu",className:Dt("flex w-full min-w-0 flex-col gap-1",e),...t}));Sd.displayName="SidebarMenu";const Ad=e.forwardRef(({className:e,...t},r)=>Mt.jsx("li",{ref:r,"data-sidebar":"menu-item",className:Dt("group/menu-item relative",e),...t}));Ad.displayName="SidebarMenuItem";const Td=p("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-primary data-[active=true]:font-medium data-[active=true]:text-sidebar-primary-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:justify-center group-data-[collapsible=icon]:gap-0 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[collapsible=icon]:[&>*]:!mr-0 group-data-[collapsible=icon]:[&>*]:!ml-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-10 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Cd=e.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="default",size:n="default",tooltip:o,className:a,...i},s)=>{const l=e?d:"button",{isMobile:c,state:u}=pd(),f=Mt.jsx(l,{ref:s,"data-sidebar":"menu-button","data-size":n,"data-active":t,className:Dt(Td({variant:r,size:n}),a),...i});return o?("string"==typeof o&&(o={children:o}),Mt.jsxs(ld,{children:[Mt.jsx(cd,{asChild:!0,children:f}),Mt.jsx(ud,{side:"right",align:"center",hidden:"collapsed"!==u||c,...o})]})):f});Cd.displayName="SidebarMenuButton";const Pd=e.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...n},o)=>{const a=t?d:"button";return Mt.jsx(a,{ref:o,"data-sidebar":"menu-action",className:Dt("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",r&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...n})});Pd.displayName="SidebarMenuAction";const qd=e.forwardRef(({className:e,...t},r)=>Mt.jsx("div",{ref:r,"data-sidebar":"menu-badge",className:Dt("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));qd.displayName="SidebarMenuBadge";const Rd=e.forwardRef(({className:t,showIcon:r=!1,...n},o)=>{const a=e.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return Mt.jsxs("div",{ref:o,"data-sidebar":"menu-skeleton",className:Dt("rounded-md h-8 flex gap-2 px-2 items-center",t),...n,children:[r&&Mt.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),Mt.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":a}})]})});Rd.displayName="SidebarMenuSkeleton";const Ld=e.forwardRef(({className:e,...t},r)=>Mt.jsx("ul",{ref:r,"data-sidebar":"menu-sub",className:Dt("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));Ld.displayName="SidebarMenuSub";const Id=e.forwardRef(({...e},t)=>Mt.jsx("li",{ref:t,...e}));Id.displayName="SidebarMenuSubItem";const Md=e.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:n,...o},a)=>{const i=e?d:"a";return Mt.jsx(i,{ref:a,"data-sidebar":"menu-sub-button","data-size":t,"data-active":r,className:Dt("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground","sm"===t&&"text-xs","md"===t&&"text-sm","group-data-[collapsible=icon]:hidden",n),...o})});Md.displayName="SidebarMenuSubButton";const Dd=e.forwardRef(({className:e,...t},r)=>Mt.jsxs(jt.Root,{ref:r,className:Dt("relative flex w-full touch-none select-none items-center",e),...t,children:[Mt.jsx(jt.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:Mt.jsx(jt.Range,{className:"absolute h-full bg-primary"})}),Mt.jsx(jt.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Dd.displayName=jt.Root.displayName;const Fd=({...e})=>{const{theme:t="system"}=_t();return Mt.jsx(ot,{theme:t,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})};function Bd(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e?.(n),!1===r||!n.defaultPrevented)return t?.(n)}}function zd(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Ud(...t){return e.useCallback(function(...e){return t=>{let r=!1;const n=e.map(e=>{const n=zd(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){const r=n[t];"function"==typeof r?r():zd(e[t],null)}}}}(...t),t)}function $d(...t){const r=t[0];if(1===t.length)return r;const n=()=>{const n=t.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(t){const o=n.reduce((e,{useScope:r,scopeName:n})=>({...e,...r(t)[`__scope${n}`]}),{});return e.useMemo(()=>({[`__scope${r.scopeName}`]:o}),[o])}};return n.scopeName=r.scopeName,n}var Hd=globalThis?.document?e.useLayoutEffect:()=>{},Vd=e[" useInsertionEffect ".trim().toString()]||Hd;function Kd({prop:t,defaultProp:r,onChange:n=()=>{},caller:o}){const[a,i,s]=function({defaultProp:t,onChange:r}){const[n,o]=e.useState(t),a=e.useRef(n),i=e.useRef(r);return Vd(()=>{i.current=r},[r]),e.useEffect(()=>{a.current!==n&&(i.current?.(n),a.current=n)},[n,a]),[n,o,i]}({defaultProp:r,onChange:n}),l=void 0!==t,c=l?t:a;{const r=e.useRef(void 0!==t);e.useEffect(()=>{const e=r.current;if(e!==l){const t=e?"controlled":"uncontrolled",r=l?"controlled":"uncontrolled";console.warn(`${o} is changing from ${t} to ${r}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}r.current=l},[l,o])}const u=e.useCallback(e=>{if(l){const r=function(e){return"function"==typeof e}(e)?e(t):e;r!==t&&s.current?.(r)}else i(e)},[l,t,i,s]);return[c,u]}var Wd=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((t,r)=>{const n=f(`Primitive.${r}`),o=e.forwardRef((e,t)=>{const{asChild:o,...a}=e,i=o?n:r;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),Mt.jsx(i,{...a,ref:t})});return o.displayName=`Primitive.${r}`,{...t,[r]:o}},{}),Zd="Switch",[Gd]=function(t,r=[]){let n=[];const o=()=>{const r=n.map(t=>e.createContext(t));return function(n){const o=n?.[t]||r;return e.useMemo(()=>({[`__scope${t}`]:{...n,[t]:o}}),[n,o])}};return o.scopeName=t,[function(r,o){const a=e.createContext(o),i=n.length;n=[...n,o];const s=r=>{const{scope:n,children:o,...s}=r,l=n?.[t]?.[i]||a,c=e.useMemo(()=>s,Object.values(s));return Mt.jsx(l.Provider,{value:c,children:o})};return s.displayName=r+"Provider",[s,function(n,s){const l=s?.[t]?.[i]||a,c=e.useContext(l);if(c)return c;if(void 0!==o)return o;throw new Error(`\`${n}\` must be used within \`${r}\``)}]},$d(o,...r)]}(Zd),[Yd,Qd]=Gd(Zd),Xd=e.forwardRef((t,r)=>{const{__scopeSwitch:n,name:o,checked:a,defaultChecked:i,required:s,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=t,[p,h]=e.useState(null),m=Ud(r,e=>h(e)),y=e.useRef(!1),g=!p||(d||!!p.closest("form")),[v,b]=Kd({prop:a,defaultProp:i??!1,onChange:u,caller:Zd});return Mt.jsxs(Yd,{scope:n,checked:v,disabled:l,children:[Mt.jsx(Wd.button,{type:"button",role:"switch","aria-checked":v,"aria-required":s,"data-state":rf(v),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:m,onClick:Bd(t.onClick,e=>{b(e=>!e),g&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),g&&Mt.jsx(tf,{control:p,bubbles:!y.current,name:o,value:c,checked:v,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Xd.displayName=Zd;var Jd="SwitchThumb",ef=e.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,o=Qd(Jd,r);return Mt.jsx(Wd.span,{"data-state":rf(o.checked),"data-disabled":o.disabled?"":void 0,...n,ref:t})});ef.displayName=Jd;var tf=e.forwardRef(({__scopeSwitch:t,control:r,checked:n,bubbles:o=!0,...a},i)=>{const s=e.useRef(null),l=Ud(s,i),c=function(t){const r=e.useRef({value:t,previous:t});return e.useMemo(()=>(r.current.value!==t&&(r.current.previous=r.current.value,r.current.value=t),r.current.previous),[t])}(n),u=function(t){const[r,n]=e.useState(void 0);return Hd(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const e=new ResizeObserver(e=>{if(!Array.isArray(e))return;if(!e.length)return;const r=e[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;o=t.inlineSize,a=t.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return e.observe(t,{box:"border-box"}),()=>e.unobserve(t)}n(void 0)},[t]),r}(r);return e.useEffect(()=>{const e=s.current;if(!e)return;const t=window.HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(t,"checked").set;if(c!==n&&r){const t=new Event("click",{bubbles:o});r.call(e,n),e.dispatchEvent(t)}},[c,n,o]),Mt.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:l,style:{...a.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function rf(e){return e?"checked":"unchecked"}tf.displayName="SwitchBubbleInput";var nf=Xd,of=ef;const af=e.forwardRef(({className:e,...t},r)=>Mt.jsx(nf,{className:Dt("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:Mt.jsx(of,{className:Dt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));af.displayName=nf.displayName;const sf={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},lf={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},cf={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function uf({children:e,direction:t="column",gap:r="md",align:n="stretch",justify:o="start",wrap:a=!1,className:i}){return Mt.jsx("div",{className:Dt("flex","column"===t?"flex-col":"flex-row",sf[r],lf[n],cf[o],a&&"flex-wrap",i),children:e})}const df=kt.Root,ff=e.forwardRef(({className:e,...t},r)=>Mt.jsx(kt.List,{ref:r,className:Dt("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));ff.displayName=kt.List.displayName;const pf=e.forwardRef(({className:e,...t},r)=>Mt.jsx(kt.Trigger,{ref:r,className:Dt("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));pf.displayName=kt.Trigger.displayName;const hf=e.forwardRef(({className:e,...t},r)=>Mt.jsx(kt.Content,{ref:r,className:Dt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));function mf({children:e,className:t}){return Mt.jsx("div",{className:Dt("flex flex-col h-full",t),children:Mt.jsx(Po,{className:"flex-1",children:Mt.jsx("div",{className:"space-y-6 p-6",children:e})})})}function yf({title:e,description:t,actions:r,className:n}){return Mt.jsxs("div",{className:Dt("space-y-4",n),children:[Mt.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[Mt.jsxs("div",{className:"space-y-1",children:[Mt.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),t&&Mt.jsx("p",{className:"text-muted-foreground text-sm",children:t})]}),r&&Mt.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:r})]}),Mt.jsx(Gu,{})]})}function gf({children:e,className:t}){return Mt.jsx("div",{className:Dt("space-y-6",t),children:e})}hf.displayName=kt.Content.displayName;const vf=p("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),bf=e.forwardRef(({className:e,variant:t,size:r,...n},o)=>Mt.jsx(Ot.Root,{ref:o,className:Dt(vf({variant:t,size:r,className:e})),...n}));bf.displayName=Ot.Root.displayName;const xf=e.createContext({size:"default",variant:"default"}),wf=e.forwardRef(({className:e,variant:t,size:r,children:n,...o},a)=>Mt.jsx(Et.Root,{ref:a,className:Dt("flex items-center justify-center gap-1",e),...o,children:Mt.jsx(xf.Provider,{value:{variant:t,size:r},children:n})}));wf.displayName=Et.Root.displayName;const Nf=e.forwardRef(({className:t,children:r,variant:n,size:o,...a},i)=>{const s=e.useContext(xf);return Mt.jsx(Et.Item,{ref:i,className:Dt(vf({variant:s.variant||n,size:s.size||o}),t),...a,children:r})});Nf.displayName=Et.Item.displayName;const jf=t.forwardRef(({variant:e="default",className:t,children:r,...n},o)=>Mt.jsx(Ht,{ref:o,variant:"outline",size:"sm",className:Dt("h-7 px-2 text-xs","border-primary/20 text-primary hover:bg-primary/5",t),...n,children:r||Mt.jsx(L,{size:12})}));function _f({manager:e,config:t,onEdit:r,onDelete:n}){return e.isLoading?Mt.jsx(mi,{children:Array.from({length:3}).map((e,t)=>Mt.jsxs(Zt,{children:[Mt.jsxs(Gt,{children:[Mt.jsx(Jn,{className:"h-4 w-3/4"}),Mt.jsx(Jn,{className:"h-3 w-1/2"})]}),Mt.jsx(Xt,{children:Mt.jsxs("div",{className:"space-y-2",children:[Mt.jsx(Jn,{className:"h-3 w-full"}),Mt.jsx(Jn,{className:"h-3 w-2/3"})]})})]},t))}):Mt.jsx(di.Root,{children:e.entities.map(e=>Mt.jsxs(di.Item,{onClick:()=>r(e),children:[Mt.jsx(Gt,{className:"pb-3",children:Mt.jsxs("div",{className:"flex items-start justify-between",children:[Mt.jsxs("div",{className:"flex-1 min-w-0",children:[Mt.jsx(Yt,{className:"text-base leading-6 truncate",children:e.title||e.name||"Sem título"}),Mt.jsx(Qt,{className:"text-sm",children:v(new Date(e.created_at),"dd/MM/yyyy HH:mm",{locale:Ra})})]}),Mt.jsxs("div",{className:"flex items-center gap-2 ml-2",children:[e.link&&Mt.jsx(Ht,{variant:"external-link",size:"icon-xs",onClick:t=>{t.stopPropagation(),(e=>{try{const t=window.open(e,"_blank");t&&!t.closed&&void 0!==t.closed||(navigator.clipboard.writeText(e),nt.info("Link copiado para a área de transferência"))}catch(t){window.location.href=e}})(e.link)},title:"Abrir link externo",children:Mt.jsx(De,{className:"h-4 w-4"})}),Mt.jsx("div",{onClick:e=>e.stopPropagation(),children:Mt.jsx(_o,{onEdit:()=>r(e),onDelete:n?()=>n(e):void 0,canDelete:!!n})})]})]})}),Mt.jsx(Xt,{className:"pt-0",children:Mt.jsx("div",{className:"space-y-2",children:t.cardFields?.map(t=>{const r=e[t.key];return r?Mt.jsx(di.Field,{label:t.label,value:t.render?t.render(r,e):String(r)},String(t.key)):null})})})]},e.id))})}function kf({manager:e,filters:t}){const{isSearchVisible:r}=Uo(),n=e.searchTerm;return Mt.jsx(uf,{direction:"column",gap:"md",className:"mb-6",children:Mt.jsxs(uf,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:[t.some(e=>"search"===e.type)&&!r&&Mt.jsxs("div",{className:"relative flex-1",children:[Mt.jsx(E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),Mt.jsx(Vt,{placeholder:"Buscar...",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),t.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return Mt.jsx("div",{className:"w-full sm:w-auto",children:Mt.jsx(r,{...e.props})},t)}),n&&Mt.jsxs(Ht,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[Mt.jsx(w,{className:"h-4 w-4 mr-2"}),"Limpar Filtros"]})]})})}function Of(e){const t=tt();return{onNew:()=>{const r=e.newPath||`${e.basePath}/new`;t(r)},onEdit:r=>{const n=e.editPath?e.editPath.replace(":id",r.id):`${e.basePath}/${r.id}/edit`;t(n)}}}function Ef(e){return Of({basePath:e})}function Sf({open:e,onCancel:t,onSubmit:r,editingEntity:n,isLoading:o=!1,title:a,editTitle:i,sections:s,transformData:l}){const{alias:c}=Uo();return Mt.jsx(Wo,{open:e,title:n?i:a,sections:s,initialData:n,onSubmit:e=>{if(l){const t=l(e,c||"");r(t)}else{const t={...e,alias:c||""};n?.id&&(t.id=n.id),r(t)}},onCancel:t,isLoading:o,submitButtonText:n?"Atualizar":"Salvar"})}jf.displayName="ActionButton";const Af=t.memo(({variant:e="card",className:r="",selectedUnit:n,onUnitChange:o})=>{const{user:a,companies:i,alias:s,isAuthenticated:l,logout:c,switchUnit:u}=Uo(),d=i?.[0]||null,f=s?i?.find(e=>e.alias===s):d,p=i||[],h=n||f||d||d,m=t.useCallback(e=>{o?o(e):u(e)},[o,u]),y=t.useMemo(()=>{if(!p?.length)return[];const e=new Map;p.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),r=t.find(e=>e.alias===h?.alias),n=t.filter(e=>e.alias!==h?.alias);return n.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),r?[r,...n]:n},[p,h?.alias]);if(!l||!a)return null;const g=()=>Mt.jsxs(Mt.Fragment,{children:[Mt.jsxs("div",{className:"flex items-center space-x-3",children:[Mt.jsx("div",{className:"flex-shrink-0",children:Mt.jsx("div",{className:"w-10 h-10 bg-primary rounded-full flex items-center justify-center",children:Mt.jsx(Ee,{className:"h-5 w-5 text-primary-foreground"})})}),Mt.jsxs("div",{className:"flex-1 min-w-0",children:[Mt.jsx("p",{className:"text-sm font-medium truncate",children:a.name}),Mt.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",h?.name||"N/A"]})]})]}),h&&Mt.jsx("div",{className:"mt-3",children:Mt.jsxs("div",{className:"flex items-center space-x-2",children:[Mt.jsx(Fe,{className:"h-4 w-4 text-muted-foreground"}),Mt.jsx("span",{className:"text-sm font-medium",children:h.name})]})}),y.length>1&&Mt.jsxs("div",{className:"mt-2",children:[Mt.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",y.length]}),Mt.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.slice(0,3).map(e=>Mt.jsx(Ar,{variant:e.alias===h?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>m(e),children:e.name},e.alias)),y.length>3&&Mt.jsxs(Ar,{variant:"outline",className:"text-xs",children:["+",y.length-3]})]})]})]});return"dropdown"===e?Mt.jsxs(so,{children:[Mt.jsx(lo,{asChild:!0,children:Mt.jsx(Ht,{variant:"ghost",className:`h-auto p-2 ${r}`,children:Mt.jsxs("div",{className:"flex items-center space-x-2",children:[Mt.jsxs("div",{className:"hidden md:block text-left",children:[Mt.jsx("p",{className:"text-sm font-medium",children:a.name}),Mt.jsx("p",{className:"text-xs text-muted-foreground",children:h?.name||"N/A"})]}),Mt.jsx("div",{className:"w-8 h-8 bg-primary rounded-full flex items-center justify-center",children:Mt.jsx(Ee,{className:"h-4 w-4 text-primary-foreground"})}),Mt.jsx(N,{className:"h-4 w-4"})]})})}),Mt.jsxs(yo,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[Mt.jsxs(fo,{children:[Mt.jsxs(ho,{children:[Mt.jsx(qe,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),Mt.jsx(mo,{children:y.map(e=>Mt.jsxs(go,{onClick:()=>m(e),className:e.alias===h?.alias?"bg-muted":"",children:[Mt.jsx(Fe,{className:"mr-2 h-4 w-4"}),e.name,e.alias===h?.alias&&Mt.jsx(Ar,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),Mt.jsx(wo,{}),Mt.jsx(fi,{variant:"menuItem"}),Mt.jsxs(go,{onClick:c,children:[Mt.jsx(Be,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}):Mt.jsxs(Zt,{className:r,children:[Mt.jsx(Gt,{children:Mt.jsx(Yt,{className:"text-lg",children:"Informações do Usuário"})}),Mt.jsxs(Xt,{className:"space-y-4",children:[Mt.jsx(g,{}),Mt.jsx(Gu,{}),Mt.jsxs("div",{className:"flex space-x-2",children:[Mt.jsx(fi,{className:"flex-1"}),Mt.jsxs(Ht,{variant:"outline",onClick:c,size:"sm",className:"flex-1",children:[Mt.jsx(Be,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})]})}),Tf=i({});function Cf({children:e,config:t}){return Mt.jsx(Tf.Provider,{value:{navigation:t?.navigation,appName:t?.appName},children:e})}function Pf(){return s(Tf)}function qf(){const e=et(),{navigation:t}=Pf(),r=t?.find(t=>t.path===e.pathname);return r?.label||"Página"}function Rf(e,t){const[r,i]=o(e),s=c(),l=n(()=>{s.current&&(clearTimeout(s.current),s.current=void 0)},[]);return a(()=>(l(),s.current=setTimeout(()=>{i(e)},t),l),[e,t,l]),[r,l]}const Lf=({actions:e})=>{const t=et(),r=qf(),{navigation:n,appName:i}=Pf(),{companies:s,alias:l,isSearchVisible:c,clearSearch:u,refreshData:d,switchUnit:f}=Uo(),p=l?s?.find(e=>e.alias===l)||s?.[0]||null:s?.[0]||null,[h,m]=Je(),[y,g]=o(()=>h.get("search")||""),[v,b]=Rf(y,Nn.debounceDelay);a(()=>{if(!c)return;const e=new URLSearchParams(h);v?(e.set("search",v),e.set("page","1")):e.delete("search"),m(e)},[v,m,c]);const x=n?.find(e=>e.path===t.pathname);return Mt.jsx("header",{className:"bg-white border-b border-gray-200 px-2 md:px-4 py-2",children:Mt.jsxs("div",{className:"flex items-center justify-between gap-4",children:[Mt.jsx("div",{className:"flex items-center space-x-1 md:space-x-2 min-w-0",children:Mt.jsxs("div",{className:"min-w-0 flex flex-col md:flex-row md:items-center md:space-x-3 space-y-2 md:space-y-0",children:[Mt.jsxs("div",{className:"min-w-0",children:[Mt.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[Mt.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:r}),Mt.jsx(Ar,{variant:"default",className:"bg-primary hover:bg-primary/90 text-primary-foreground text-xs px-2 py-1",children:i||"Módulo"})]}),Mt.jsx("p",{className:"text-sm text-muted-foreground truncate",children:x?.complementaryText||"Detalhes do item"})]}),c&&Mt.jsxs("div",{className:"flex items-center space-x-1 w-full md:w-auto",children:[Mt.jsxs("div",{className:"relative w-full md:w-48",children:[Mt.jsx(E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),Mt.jsx(Vt,{placeholder:"/wiki"===t.pathname?"Buscar artigos...":"Buscar...",value:y,onChange:e=>{return t=e.target.value,void g(t);var t},className:"w-full pl-10 pr-8"}),y&&Mt.jsx(Ht,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 transform -translate-y-1/2 h-6 w-6 p-0 hover:bg-gray-100",onClick:()=>{b(),g("");const e=new URLSearchParams(h);e.delete("search"),e.delete("page"),m(e)},title:"Limpar busca",children:Mt.jsx(w,{size:14})})]}),Mt.jsx(Ht,{variant:"outline",size:"sm",onClick:d,className:"flex-shrink-0 h-10 w-10 p-0",title:"Atualizar dados",children:Mt.jsx(qe,{size:14})})]})]})}),Mt.jsxs("div",{className:"flex-shrink-0 flex items-center gap-3",children:[e&&Mt.jsx("div",{className:"flex items-center gap-2",children:e}),Mt.jsx("div",{className:"text-sm",children:Mt.jsx(Af,{variant:"dropdown",selectedUnit:p,onUnitChange:f})})]})]})})},If=(e={})=>{const{enabled:t=!0}=e,{alias:r}=Uo();return Ye({queryKey:["active-modules",r],queryFn:async()=>{if(!r)return[];const e=mn(),{data:t,error:n}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",r).eq("status","active").order("name");if(n){if(!Fo.handleError(n))throw n;return[]}return t||[]},enabled:t&&!!r})},Mf=import.meta.env.VITE_SUPABASE_PROJECT_ID,Df={logo:`https://${Mf}.supabase.co/storage/v1/object/public/library-assets/logo.svg`,smallLogo:`https://${Mf}.supabase.co/storage/v1/object/public/library-assets/small.svg`},Ff=Df.logo,Bf=Df.smallLogo,zf="forlogic-sidebar-pinned",Uf=()=>{try{const e=localStorage.getItem(zf);return!!e&&JSON.parse(e)}catch{return!1}};function $f({config:e}={}){const{state:t,open:r,setOpen:n}=pd(),i=et(),[s,l]=o(!1),[c,u]=o(Uf),[d,f]=o(!1);a(()=>{n(!!c||!(!d&&!s))},[c,d,s,n]);const{data:p,isLoading:h,error:m}=If({enabled:s}),y=e=>{const t=["border-l-yellow-400","border-l-green-400","border-l-blue-400","border-l-red-400","border-l-purple-400","border-l-pink-400"];return t[e%t.length]};return Mt.jsxs(md,{collapsible:"icon",onMouseEnter:()=>{c||f(!0)},onMouseLeave:()=>{c||f(!1)},className:"app-sidebar transition-all duration-300 ease-in-out bg-white border-r border-gray-200 py-6 px-3",children:[Mt.jsxs(xd,{className:"p-0 gap-0",children:[Mt.jsx("div",{className:"flex items-center justify-between h-[34px]",children:r?Mt.jsxs(Mt.Fragment,{children:[Mt.jsx("div",{className:"flex items-center pl-[12px]",children:Mt.jsx("img",{src:Df.logo,alt:"Logo",className:"h-6 max-w-full object-contain"})}),Mt.jsx("button",{onClick:()=>{const e=!c;u(e),(e=>{try{localStorage.setItem(zf,JSON.stringify(e))}catch{}})(e)},className:"h-8 w-8 flex items-center justify-center rounded-md transition-colors duration-200 "+(c?"bg-primary text-primary-foreground":"hover:bg-muted text-muted-foreground"),children:Mt.jsx(Me,{className:"h-4 w-4"})})]}):Mt.jsx("div",{className:"flex items-center justify-center w-full h-[34px]",children:Mt.jsx("img",{src:Df.smallLogo,alt:"Logo",className:"h-[34px] w-[34px] object-contain"})})}),Mt.jsx("div",{className:"mt-2 pt-0",children:Mt.jsxs(so,{onOpenChange:l,children:[Mt.jsx(lo,{asChild:!0,children:r?Mt.jsxs("div",{className:"bg-muted hover:bg-muted/80 text-foreground font-medium text-sm flex items-center justify-between cursor-pointer transition-all duration-200 h-8 px-3 gap-3 rounded-md w-full",children:[Mt.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[Mt.jsx("img",{src:"https://ccjfvpnndclajkleyqkc.supabase.co/storage/v1/object/public/library-assets/composit.svg",alt:"Menu",className:"h-6 w-6 text-muted-foreground flex-shrink-0"}),Mt.jsx("span",{className:"truncate group-data-[collapsible=icon]:hidden",children:e?.appName||"Título do módulo"})]}),Mt.jsx(N,{className:"h-6 w-6 flex-shrink-0 text-muted-foreground"})]}):Mt.jsx("div",{className:"flex items-center justify-center w-full h-8 bg-muted hover:bg-muted/80 rounded-md cursor-pointer transition-all duration-200 p-[5px]",children:Mt.jsx(N,{className:"h-6 w-6 text-muted-foreground"})})}),Mt.jsx(yo,{className:r?"w-80 bg-white rounded-lg shadow-lg border border-gray-200 p-4 z-50":"w-[58px] bg-white rounded-lg shadow-lg border border-gray-200 p-2 z-50",align:r?"start":"center",children:h?Mt.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-muted-foreground",children:[Mt.jsx(k,{className:"h-4 w-4 animate-spin"}),Mt.jsx("span",{className:"text-sm",children:"Carregando módulos..."})]}):m?Mt.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-destructive",children:[Mt.jsx(O,{className:"h-4 w-4"}),Mt.jsx("span",{className:"text-sm",children:"Erro ao carregar módulos"})]}):p&&0!==p.length?Mt.jsx("div",{className:"space-y-2",children:p.map((e,t)=>Mt.jsx("div",{onClick:()=>(e=>{const t=p?.find(t=>t.url===e);t?.url&&window.open(t.url,"_blank")})(e.url||""),className:`\n bg-muted/50 hover:bg-muted rounded-md p-3 cursor-pointer \n border-l-4 ${y(t)} transition-colors duration-200\n `,children:Mt.jsxs("div",{className:"flex items-center justify-between",children:[Mt.jsx("span",{className:"font-medium text-foreground text-sm",children:e.name}),e.url&&Mt.jsx(De,{className:"h-4 w-4 text-muted-foreground"})]})},e.id))}):Mt.jsx("div",{className:"py-3 px-3 text-muted-foreground text-sm",children:"Nenhum módulo disponível"})})]})})]}),Mt.jsx(jd,{children:Mt.jsx(_d,{className:"p-0 mt-6",children:Mt.jsx(Ed,{children:Mt.jsx(Sd,{className:"space-y-2",children:e?.navigation?.map(e=>{return Mt.jsx(Ad,{children:Mt.jsx(Cd,{asChild:!0,isActive:(t=e.path,i.pathname===t),size:"lg",className:"h-10",children:Mt.jsxs(rt,{to:e.path,className:"flex w-full items-center gap-3",children:[Mt.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:Mt.jsx(e.icon,{className:"h-5 w-4"})}),Mt.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label})]})})},e.path);var t})})})})})]})}function Hf({children:e,sidebar:t,sidebarConfig:r,showHeader:n=!0}){const o=t||Mt.jsx($f,{config:r});return Mt.jsx(Cf,{config:r,children:Mt.jsx(hd,{defaultOpen:!1,style:{"--sidebar-width":"240px","--sidebar-width-icon":"58px"},children:Mt.jsxs("div",{className:"min-h-screen flex w-full",children:[o,Mt.jsxs("main",{className:"flex-1 flex flex-col min-h-screen",children:[n&&Mt.jsx("div",{className:"flex-shrink-0",children:Mt.jsx(Lf,{})}),Mt.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50",children:e})]})]})})})}class Vf extends u{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){ln.handleError(e,!1),console.error("ErrorBoundary caught an error:",e,t)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:Mt.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:Mt.jsxs(Zt,{className:"w-full max-w-md",children:[Mt.jsxs(Gt,{className:"text-center",children:[Mt.jsx("div",{className:"flex justify-center mb-4",children:Mt.jsx(ze,{className:"h-12 w-12 text-destructive"})}),Mt.jsx(Yt,{children:"Algo deu errado"})]}),Mt.jsxs(Xt,{className:"text-center space-y-4",children:[Mt.jsx("p",{className:"text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),Mt.jsx(Ht,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})}):this.props.children}}export{xn as AUTH_CONFIG,fa as Accordion,ma as AccordionContent,pa as AccordionItem,ha as AccordionTrigger,jf as ActionButton,jo as ActionMenuItems,ia as Alert,la as AlertDescription,qn as AlertDialog,Un as AlertDialogAction,$n as AlertDialogCancel,Mn as AlertDialogContent,zn as AlertDialogDescription,Fn as AlertDialogFooter,Dn as AlertDialogHeader,In as AlertDialogOverlay,Ln as AlertDialogPortal,Bn as AlertDialogTitle,Rn as AlertDialogTrigger,sa as AlertTitle,Lf as AppHeader,Hf as AppLayout,$f as AppSidebar,ya as AspectRatio,Fo as AuthErrorInterceptor,zo as AuthProvider,Mo as AuthService,ga as Avatar,ba as AvatarFallback,va as AvatarImage,Ar as Badge,Yo as BaseCrudPage,Ko as BaseForm,xa as Breadcrumb,Oa as BreadcrumbEllipsis,Na as BreadcrumbItem,ja as BreadcrumbLink,wa as BreadcrumbList,_a as BreadcrumbPage,ka as BreadcrumbSeparator,Ht as Button,wn as CRUD_CONFIG,La as Calendar,ca as CallbackPage,Zt as Card,Xt as CardContent,Qt as CardDescription,Jt as CardFooter,Gt as CardHeader,to as CardSkeleton,Yt as CardTitle,Da as Carousel,Fa as CarouselContent,Ba as CarouselItem,Ua as CarouselNext,za as CarouselPrevious,Ka as ChartContainer,Ya as ChartLegend,Qa as ChartLegendContent,Wa as ChartStyle,Za as ChartTooltip,Ga as ChartTooltipContent,Or as Checkbox,Ja as Collapsible,ti as CollapsibleContent,ei as CollapsibleTrigger,Co as ColorPicker,ri as Command,ni as CommandDialog,ii as CommandEmpty,si as CommandGroup,oi as CommandInput,ci as CommandItem,ai as CommandList,li as CommandSeparator,ui as CommandShortcut,_f as CrudCards,Wo as CrudForm,ko as CrudTable,di as DataList,Hn as DeleteConfirmationDialog,er as Dialog,nr as DialogClose,ar as DialogContent,cr as DialogDescription,sr as DialogFooter,ir as DialogHeader,or as DialogOverlay,rr as DialogPortal,lr as DialogTitle,tr as DialogTrigger,so as DropdownMenu,vo as DropdownMenuCheckboxItem,yo as DropdownMenuContent,co as DropdownMenuGroup,go as DropdownMenuItem,xo as DropdownMenuLabel,uo as DropdownMenuPortal,po as DropdownMenuRadioGroup,bo as DropdownMenuRadioItem,wo as DropdownMenuSeparator,No as DropdownMenuShortcut,fo as DropdownMenuSub,mo as DropdownMenuSubContent,ho as DropdownMenuSubTrigger,lo as DropdownMenuTrigger,io as EmptyState,Vf as ErrorBoundary,fi as FeedbackDialog,kf as FilterBar,ur as Form,gr as FormControl,fr as FormField,mr as FormItem,yr as FormLabel,vr as FormMessage,ro as FormSkeleton,Sf as GenericEntityForm,mi as Grid,no as HeaderSkeleton,Lo as IconPicker,Vt as Input,yi as InputOTP,gi as InputOTPGroup,bi as InputOTPSeparator,vi as InputOTPSlot,Wt as Label,Pr as LoadingState,ua as LoginPage,Sn as MESSAGES,Cf as NavigationProvider,xi as PageBreadcrumb,Ni as Pagination,ji as PaginationContent,Si as PaginationEllipsis,_i as PaginationItem,ki as PaginationLink,Ei as PaginationNext,Oi as PaginationPrevious,Eo as Popover,Ao as PopoverContent,So as PopoverTrigger,Ai as Progress,oa as ProtectedRoute,_n as QUERY_KEYS,bn as QualiexEnrichmentService,Vo as QualiexResponsibleSelectField,Ho as QualiexUserField,Ti as RadioGroup,Ci as RadioGroupItem,Zu as RichTextEditor,Nn as SEARCH_CONFIG,Po as ScrollArea,qo as ScrollBar,br as Select,_r as SelectContent,kr as SelectItem,wr as SelectTrigger,xr as SelectValue,Gu as Separator,Yu as Sheet,Xu as SheetClose,rd as SheetContent,id as SheetDescription,od as SheetFooter,nd as SheetHeader,ed as SheetOverlay,Ju as SheetPortal,ad as SheetTitle,Qu as SheetTrigger,md as Sidebar,jd as SidebarContent,wd as SidebarFooter,_d as SidebarGroup,Od as SidebarGroupAction,Ed as SidebarGroupContent,kd as SidebarGroupLabel,xd as SidebarHeader,bd as SidebarInput,vd as SidebarInset,Sd as SidebarMenu,Pd as SidebarMenuAction,qd as SidebarMenuBadge,Cd as SidebarMenuButton,Ad as SidebarMenuItem,Rd as SidebarMenuSkeleton,Ld as SidebarMenuSub,Md as SidebarMenuSubButton,Id as SidebarMenuSubItem,hd as SidebarProvider,gd as SidebarRail,Nd as SidebarSeparator,oo as SidebarSkeleton,yd as SidebarTrigger,Jn as Skeleton,Dd as Slider,Fd as SonnerToaster,Cr as Spinner,uf as Stack,af as Switch,gf as TabPageContent,yf as TabPageHeader,mf as TabPageLayout,Vn as Table,Wn as TableBody,Xn as TableCaption,Qn as TableCell,Zn as TableFooter,Yn as TableHead,Kn as TableHeader,Gn as TableRow,_o as TableRowActions,eo as TableSkeleton,df as Tabs,hf as TabsContent,ff as TabsList,pf as TabsTrigger,Er as Textarea,Vr as Toast,Kr as ToastAction,Wr as ToastClose,Gr as ToastDescription,Ur as ToastProvider,Zr as ToastTitle,$r as ToastViewport,Yr as Toaster,bf as Toggle,wf as ToggleGroup,Nf as ToggleGroupItem,on as TokenManager,ld as Tooltip,ud as TooltipContent,sd as TooltipProvider,cd as TooltipTrigger,Df as assets,Sr as badgeVariants,$t as buttonVariants,Dt as cn,Qo as createCrudPage,Of as createRoutingHandlers,Tn as createService,Xo as createSimpleSaveHandler,Pn as createSimpleService,ra as crudPresets,Ut as debounce,Bu as detectRemovedImages,Uu as detectRestoredImages,ln as errorService,Vu as extractDataUrls,Hu as extractExternalImageUrls,zt as formatCurrency,Bt as formatDatetime,Jo as generateCrudConfig,On as getQualiexConfig,mn as getSupabaseClient,Fu as handleClipboardImageWithSession,jn as isDevEnvironment,Ff as logoSrc,zu as markImageForDeletion,Ku as processHtmlWithAllImages,vn as qualiexApi,$u as restoreImageFromDeleted,En as setQualiexConfig,da as setupQualiexCore,Bf as smallLogoSrc,Br as toast,vf as toggleVariants,Ft as trimTextFields,Du as uploadImageToSession,If as useActiveModules,Uo as useAuth,Oo as useBaseForm,Cn as useCrud,Ef as useCrudRouting,Rf as useDebounce,Pf as useNavigation,qf as usePageTitle,$o as useQualiexUsers,wi as useRouteBreadcrumbs,pd as useSidebar,zr as useToast,na as withPreset};
|
|
17
17
|
//# sourceMappingURL=index.esm.js.map
|