forlogic-core 1.8.6 → 1.8.7

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.js CHANGED
@@ -7,4 +7,4 @@
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 de(){return le||(le=1,"production"!==process.env.NODE_ENV&&function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=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"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator;var g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=g.ReactDebugCurrentFrame,a=r.getStackAddendum();""!==a&&(t+="%s",n=n.concat([a]));var s=n.map(function(e){return String(e)});s.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,s)}("error",e,n)}var b;function y(e){return e.displayName||"Context"}function v(e){if(null==e)return null;if("number"==typeof e.tag&&x("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 a:return"Fragment";case r:return"Portal";case o:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return y(e)+".Consumer";case i:return y(e._context)+".Provider";case c:return function(e,t,n){var r=e.displayName;if(r)return r;var a=t.displayName||t.name||"";return""!==a?n+"("+a+")":n}(e,e.render,"ForwardRef");case f:var t=e.displayName||null;return null!==t?t:v(e.type)||"Memo";case m:var n=e,p=n._payload,h=n._init;try{return v(h(p))}catch(g){return null}}return null}b=Symbol.for("react.module.reference");var w,k,N,j,C,S,T,I=Object.assign,P=0;function E(){}E.__reactDisabledLog=!0;var A,D=g.ReactCurrentDispatcher;function R(e,t,n){if(void 0===A)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);A=r&&r[1]||""}return"\n"+A+e}var F,_=!1,L="function"==typeof WeakMap?WeakMap:Map;function M(e,t){if(!e||_)return"";var n,r=F.get(e);if(void 0!==r)return r;_=!0;var a,s=Error.prepareStackTrace;Error.prepareStackTrace=void 0,a=D.current,D.current=null,function(){if(0===P){w=console.log,k=console.info,N=console.warn,j=console.error,C=console.group,S=console.groupCollapsed,T=console.groupEnd;var e={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}P++}();try{if(t){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(o,[])}catch(p){n=p}Reflect.construct(e,[],o)}else{try{o.call()}catch(p){n=p}e.call(o.prototype)}}else{try{throw Error()}catch(p){n=p}e()}}catch(h){if(h&&n&&"string"==typeof h.stack){for(var i=h.stack.split("\n"),l=n.stack.split("\n"),c=i.length-1,u=l.length-1;c>=1&&u>=0&&i[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(i[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||i[c]!==l[u]){var d="\n"+i[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&F.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{_=!1,D.current=a,function(){if(0===--P){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:w}),info:I({},e,{value:k}),warn:I({},e,{value:N}),error:I({},e,{value:j}),group:I({},e,{value:C}),groupCollapsed:I({},e,{value:S}),groupEnd:I({},e,{value:T})})}P<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=s}var f=e?e.displayName||e.name:"",m=f?R(f):"";return"function"==typeof e&&F.set(e,m),m}function O(e,t,n){if(null==e)return"";if("function"==typeof e)return M(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return R(e);switch(e){case u:return R("Suspense");case d:return R("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return M(e.render,!1);case f:return O(e.type,t,n);case m:var a=e,s=a._payload,o=a._init;try{return O(o(s),t,n)}catch(i){}}return""}F=new L;var z=Object.prototype.hasOwnProperty,B={},U=g.ReactDebugCurrentFrame;function $(e){if(e){var t=e._owner,n=O(e.type,e._source,t?t.type:null);U.setExtraStackFrame(n)}else U.setExtraStackFrame(null)}var V=Array.isArray;function q(e){return V(e)}function H(e){return""+e}function W(e){if(function(e){try{return H(e),!1}catch(t){return!0}}(e))return x("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)),H(e)}var Q,K,X=g.ReactCurrentOwner,G={key:!0,ref:!0,__self:!0,__source:!0};function Y(e,t,r,a,s){var o,i={},l=null,c=null;for(o in void 0!==r&&(W(r),l=""+r),function(e){if(z.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(W(t.key),l=""+t.key),function(e){if(z.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&&X.current}(t)),t)z.call(t,o)&&!G.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps){var u=e.defaultProps;for(o in u)void 0===i[o]&&(i[o]=u[o])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var n=function(){Q||(Q=!0,x("%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))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(i,d),c&&function(e,t){var n=function(){K||(K=!0,x("%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))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(i,d)}return function(e,t,r,a,s,o,i){var l={$$typeof:n,type:e,key:t,ref:r,props:i,_owner:o,_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:a}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,s,a,X.current,i)}var J,Z=g.ReactCurrentOwner,ee=g.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,n=O(e.type,e._source,t?t.type:null);ee.setExtraStackFrame(n)}else ee.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function re(){if(Z.current){var e=v(Z.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}J=!1;var ae={};function se(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=re();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!ae[n]){ae[n]=!0;var r="";e&&e._owner&&e._owner!==Z.current&&(r=" It was passed a child from "+v(e._owner.type)+"."),te(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),te(null)}}}function oe(e,t){if("object"==typeof e)if(q(e))for(var n=0;n<e.length;n++){var r=e[n];ne(r)&&se(r,t)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var a=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof a&&a!==e.entries)for(var s,o=a.call(e);!(s=o.next()).done;)ne(s.value)&&se(s.value,t)}}function ie(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==c&&n.$$typeof!==f)return;t=n.propTypes}if(t){var r=v(n);!function(e,t,n,r,a){var s=Function.call.bind(z);for(var o in e)if(s(e,o)){var i=void 0;try{if("function"!=typeof e[o]){var l=Error((r||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}i=e[o](t,o,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){i=c}!i||i instanceof Error||($(a),x("%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).",r||"React class",n,o,typeof i),$(null)),i instanceof Error&&!(i.message in B)&&(B[i.message]=!0,$(a),x("Failed %s type: %s",n,i.message),$(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!J){J=!0,x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",v(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ce(e,t,r,h,g,y){var w=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===o||e===s||e===u||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===i||e.$$typeof===l||e.$$typeof===c||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!w){var k="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(k+=" 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 N;k+=re(),null===e?N="null":q(e)?N="array":void 0!==e&&e.$$typeof===n?(N="<"+(v(e.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):N=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",N,k)}var j=Y(e,t,r,g,y);if(null==j)return j;if(w){var C=t.children;if(void 0!==C)if(h)if(q(C)){for(var S=0;S<C.length;S++)oe(C[S],e);Object.freeze&&Object.freeze(C)}else x("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 oe(C,e)}if(z.call(t,"key")){var T=v(e),I=Object.keys(t).filter(function(e){return"key"!==e}),P=I.length>0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";if(!le[T+P])x('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} />',P,T,I.length>0?"{"+I.join(": ..., ")+": ...}":"{}",T),le[T+P]=!0}return e===a?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){te(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),te(null);break}}null!==e.ref&&(te(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(j):ie(j),j}var de=function(e,t,n){return ce(e,t,n,!1)},fe=function(e,t,n){return ce(e,t,n,!0)};ue.Fragment=a,ue.jsx=de,ue.jsxs=fe}()),ue}var fe=(ce||(ce=1,"production"===process.env.NODE_ENV?oe.exports=function(){if(se)return ie;se=1;var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,r){var i,l={},c=null,u=null;for(i in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,i)&&!o.hasOwnProperty(i)&&(l[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===l[i]&&(l[i]=t[i]);return{$$typeof:n,type:e,key:c,ref:u,props:l,_owner:s.current}}return ie.Fragment=r,ie.jsx=i,ie.jsxs=i,ie}():oe.exports=de()),oe.exports);function me(e,t){t?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{o.toast.info("Link copiado para a área de transferência")})}function pe(...e){return a.twMerge(r.clsx(e))}const he=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(he);if("object"==typeof e&&e.constructor===Object){const t={};for(const[n,r]of Object.entries(e))t[n]=he(r);return t}return e},ge=n.cva("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",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","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"}}),xe=L.forwardRef(({className:e,variant:n,size:r,asChild:a=!1,...s},o)=>{const i=a?t.Slot:"button";return fe.jsx(i,{className:pe(ge({variant:n,size:r,className:e})),ref:o,...s})});xe.displayName="Button";const be=e.forwardRef(({variant:e="default",className:t,children:n,...r},a)=>fe.jsx(xe,{ref:a,variant:"action",size:"sm",className:pe("h-7 px-2 text-xs",t),...r,children:n||fe.jsx(i.EllipsisVertical,{size:12})}));be.displayName="ActionButton";const ye=L.forwardRef(({className:e,type:t,...n},r)=>fe.jsx("input",{type:t,className:pe("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:r,...n}));ye.displayName="Input";const ve=n.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),we=L.forwardRef(({className:e,...t},n)=>fe.jsx(M.Root,{ref:n,className:pe(ve(),e),...t}));we.displayName=M.Root.displayName;const ke=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ke.displayName="Card";const Ne=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-6",e),...t}));Ne.displayName="CardHeader";const je=L.forwardRef(({className:e,...t},n)=>fe.jsx("h3",{ref:n,className:pe("text-2xl font-semibold leading-none tracking-tight",e),...t}));je.displayName="CardTitle";const Ce=L.forwardRef(({className:e,...t},n)=>fe.jsx("p",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));Ce.displayName="CardDescription";const Se=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));Se.displayName="CardContent";const Te=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));Te.displayName="CardFooter";const Ie=O.Root,Pe=O.Trigger,Ee=O.Portal,Ae=O.Close,De=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Overlay,{ref:n,className:pe("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}));De.displayName=O.Overlay.displayName;const Re=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(Ee,{children:[fe.jsx(De,{}),fe.jsxs(O.Content,{ref:r,className:pe("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),...n,children:[t,fe.jsxs(O.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:[fe.jsx(i.X,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Re.displayName=O.Content.displayName;const Fe=({className:e,...t})=>fe.jsx("div",{className:pe("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});Fe.displayName="DialogHeader";const _e=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});_e.displayName="DialogFooter";const Le=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Title,{ref:n,className:pe("text-lg font-semibold leading-none tracking-tight",e),...t}));Le.displayName=O.Title.displayName;const Me=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Description,{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));Me.displayName=O.Description.displayName;const Oe=u.FormProvider,ze=L.createContext({}),Be=()=>{const e=L.useContext(ze),t=L.useContext(Ue),{getFieldState:n,formState:r}=u.useFormContext(),a=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},Ue=L.createContext({}),$e=L.forwardRef(({className:e,...t},n)=>{const r=L.useId();return fe.jsx(Ue.Provider,{value:{id:r},children:fe.jsx("div",{ref:n,className:pe("space-y-2",e),...t})})});$e.displayName="FormItem";const Ve=L.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:a}=Be();return fe.jsx(we,{ref:n,className:pe(r&&"text-destructive",e),htmlFor:a,...t})});Ve.displayName="FormLabel";const qe=L.forwardRef(({...e},n)=>{const{error:r,formItemId:a,formDescriptionId:s,formMessageId:o}=Be();return fe.jsx(t.Slot,{ref:n,id:a,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});qe.displayName="FormControl";const He=L.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Be();return fe.jsx("p",{ref:n,id:r,className:pe("text-sm text-muted-foreground",e),...t})});He.displayName="FormDescription";const We=L.forwardRef(({className:e,children:t,...n},r)=>{const{error:a,formMessageId:s}=Be(),o=a?String(a?.message):t;return o?fe.jsx("p",{ref:r,id:s,className:pe("text-sm font-medium text-destructive",e),...n,children:o}):null});We.displayName="FormMessage";const Qe=z.Root,Ke=z.Group,Xe=z.Value,Ge=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(z.Trigger,{ref:r,className:pe("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),...n,children:[t,fe.jsx(z.Icon,{asChild:!0,children:fe.jsx(i.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Ge.displayName=z.Trigger.displayName;const Ye=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.ScrollUpButton,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:fe.jsx(i.ChevronUp,{className:"h-4 w-4"})}));Ye.displayName=z.ScrollUpButton.displayName;const Je=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.ScrollDownButton,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:fe.jsx(i.ChevronDown,{className:"h-4 w-4"})}));Je.displayName=z.ScrollDownButton.displayName;const Ze=L.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>fe.jsx(z.Portal,{children:fe.jsxs(z.Content,{ref:a,className:pe("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"===n&&"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:n,...r,children:[fe.jsx(Ye,{}),fe.jsx(z.Viewport,{className:pe("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),fe.jsx(Je,{})]})}));Ze.displayName=z.Content.displayName;const et=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.Label,{ref:n,className:pe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));et.displayName=z.Label.displayName;const tt=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(z.Item,{ref:r,className:pe("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),...n,children:[fe.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:fe.jsx(z.ItemIndicator,{children:fe.jsx(i.Check,{className:"h-4 w-4"})})}),fe.jsx(z.ItemText,{children:t})]}));tt.displayName=z.Item.displayName;const nt=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.Separator,{ref:n,className:pe("-mx-1 my-1 h-px bg-muted",e),...t}));nt.displayName=z.Separator.displayName;const rt=L.forwardRef(({className:e,...t},n)=>fe.jsx(B.Root,{ref:n,className:pe("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:fe.jsx(B.Indicator,{className:pe("flex items-center justify-center text-current"),children:fe.jsx(i.Check,{className:"h-4 w-4"})})}));rt.displayName=B.Root.displayName;const at=L.forwardRef(({className:e,...t},n)=>fe.jsx("textarea",{className:pe("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:n,...t}));at.displayName="Textarea";const st=n.cva("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"}}),ot=L.forwardRef(({className:e,variant:t,...n},r)=>fe.jsx("div",{ref:r,className:pe(st({variant:t}),e),...n}));ot.displayName="Badge";const it={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function lt({size:e="md",className:t}){return fe.jsx(i.Loader2,{className:pe("animate-spin text-muted-foreground",it[e],t)})}let ct=0;const ut=new Map,dt=e=>{if(ut.has(e))return;const t=setTimeout(()=>{ut.delete(e),ht({type:"REMOVE_TOAST",toastId:e})},1e6);ut.set(e,t)},ft=(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:n}=t;return n?dt(n):e.toasts.forEach(e=>{dt(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||void 0===n?{...e,open:!1}:e)}}case"REMOVE_TOAST":return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},mt=[];let pt={toasts:[]};function ht(e){pt=ft(pt,e),mt.forEach(e=>{e(pt)})}function gt({...e}){const t=(ct=(ct+1)%Number.MAX_SAFE_INTEGER,ct.toString()),n=()=>ht({type:"DISMISS_TOAST",toastId:t});return ht({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||n()}}}),{id:t,dismiss:n,update:e=>ht({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function xt(){const[e,t]=L.useState(pt);return L.useEffect(()=>(mt.push(t),()=>{const e=mt.indexOf(t);e>-1&&mt.splice(e,1)}),[e]),{...e,toast:gt,dismiss:e=>ht({type:"DISMISS_TOAST",toastId:e})}}const bt=U.Provider,yt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Viewport,{ref:n,className:pe("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}));yt.displayName=U.Viewport.displayName;const vt=n.cva("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"}}),wt=L.forwardRef(({className:e,variant:t,...n},r)=>fe.jsx(U.Root,{ref:r,className:pe(vt({variant:t}),e),...n}));wt.displayName=U.Root.displayName;const kt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Action,{ref:n,className:pe("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}));kt.displayName=U.Action.displayName;const Nt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Close,{ref:n,className:pe("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:fe.jsx(i.X,{className:"h-4 w-4"})}));Nt.displayName=U.Close.displayName;const jt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Title,{ref:n,className:pe("text-sm font-semibold",e),...t}));jt.displayName=U.Title.displayName;const Ct=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Description,{ref:n,className:pe("text-sm opacity-90",e),...t}));Ct.displayName=U.Description.displayName;const St=$.Root,Tt=$.Trigger,It=L.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>fe.jsx($.Portal,{children:fe.jsx($.Content,{ref:a,align:t,sideOffset:n,className:pe("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),...r})}));It.displayName=$.Content.displayName;const Pt=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Pt.displayName="Command";const Et=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:fe.jsx("input",{ref:n,className:pe("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})}));Et.displayName="CommandInput";const At=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));At.displayName="CommandList";const Dt=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("py-6 text-center text-sm text-muted-foreground",e),...t}));Dt.displayName="CommandEmpty";const Rt=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("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}));Rt.displayName="CommandGroup";const Ft=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("-mx-1 h-px bg-border",e),...t}));Ft.displayName="CommandSeparator";const _t=L.forwardRef(({className:e,disabled:t,onSelect:n,value:r,...a},s)=>fe.jsx("div",{ref:s,className:pe("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&&n?.(r||""),...a}));_t.displayName="CommandItem";const Lt=({className:e,...t})=>fe.jsx("span",{className:pe("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function Mt({className:e,...t}){return fe.jsx("div",{className:pe("animate-pulse rounded-md bg-muted",e),...t})}Lt.displayName="CommandShortcut";const Ot=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();var zt=Object.defineProperty;class Bt{static normalizeBase64Url(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=(4-t.length%4)%4;return t+="=".repeat(n),t}static parseJwtPayload(e){try{const a=e.split(".");if(3!==a.length)return null;const s=a[1];s.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(s),t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);const r=new TextDecoder("utf-8").decode(n);return JSON.parse(r)}catch(t){try{const e=this.normalizeBase64Url(s),t=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(t)}catch(n){try{const e=this.normalizeBase64Url(s),t=atob(e);return JSON.parse(t)}catch(r){throw r}}}}catch(a){return null}}static validateTokens(e,t){const n=[],r=[];try{t.split(".")[1],e.split(".")[1];const a=this.parseJwtPayload(t),s=this.parseJwtPayload(e);if(!a){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:n,errors:r}}let o=!0;if(!s){const e="Access token decode falhou - será tentado novamente nas chamadas de API";n.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(s?.exp&&s.exp<i){const e="Access token expirado - pode precisar de refresh";n.push(e),o=!1}if(a.exp&&a.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:n,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:n,errors:r}}catch(a){const e=`Erro na validação de tokens: ${a}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:n,errors:r}}}static isTokenExpired(e){const t=this.parseJwtPayload(e);return!t||!t.exp||1e3*t.exp<Date.now()}static extractTokenData(e){return this.parseJwtPayload(e)}}((e,t,n)=>{t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(Bt,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);const Ut="qualiex_access_token",$t="qualiex_id_token",Vt="supabase_token",qt="oauth_state",Ht="oauth_nonce",Wt="selected_alias",Qt="manual_logout",Kt={setAccessToken:e=>localStorage.setItem(Ut,e),getAccessToken:()=>localStorage.getItem(Ut),setIdToken:e=>localStorage.setItem($t,e),getIdToken:()=>localStorage.getItem($t),getSupabaseToken:()=>localStorage.getItem(Vt),setOAuthState:e=>sessionStorage.setItem(qt,e),getOAuthState:()=>sessionStorage.getItem(qt),clearOAuthState:()=>sessionStorage.removeItem(qt),setOAuthNonce:e=>sessionStorage.setItem(Ht,e),getOAuthNonce:()=>sessionStorage.getItem(Ht),clearOAuthNonce:()=>sessionStorage.removeItem(Ht),setSelectedAlias:e=>localStorage.setItem(Wt,e),getSelectedAlias:()=>localStorage.getItem(Wt),clearSelectedAlias:()=>localStorage.removeItem(Wt),generateOAuthState:()=>"Lw==",generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Kt.getAccessToken()||!Kt.getIdToken()),setSupabaseToken:e=>{localStorage.setItem(Vt,e),Kt._clearValidationCache()},areAllTokensValid:()=>{const e=Kt.getAccessToken(),t=Kt.getIdToken();if(!e||!t)return!1;try{const n=Bt.validateTokens(e,t);return!!n.idTokenValid&&n.idTokenValid}catch(n){return!1}},clearExpiredTokens:()=>{let e=!1;const t=Kt.getAccessToken(),n=Kt.getIdToken(),r=Kt.getSupabaseToken();return t&&Kt.isTokenExpired(t)&&(localStorage.removeItem(Ut),e=!0),n&&Kt.isTokenExpired(n)&&(localStorage.removeItem($t),e=!0),r&&Kt.isTokenExpired(r)&&(localStorage.removeItem(Vt),e=!0),e},clearAll:()=>{localStorage.removeItem(Ut),localStorage.removeItem($t),localStorage.removeItem(Vt),localStorage.removeItem(Wt),localStorage.removeItem(Qt),sessionStorage.removeItem(qt),sessionStorage.removeItem(Ht)},setManualLogout:()=>localStorage.setItem(Qt,"true"),isManualLogout:()=>"true"===localStorage.getItem(Qt),clearManualLogout:()=>localStorage.removeItem(Qt),isTokenExpired:e=>{try{return Bt.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Kt._validationCache.isValid=!1,Kt._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Kt.getSupabaseToken();if(!e)return!1;if(Kt.isTokenExpired(e))return Kt._clearValidationCache(),Kt._handleExpiredToken(),!1;const t=Date.now();return t-Kt._validationCache.timestamp<Kt._validationCache.cacheValidityMs?Kt._validationCache.isValid:(Kt._validationCache.isValid=!0,Kt._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>Kt.isSupabaseTokenValid()?Kt.getSupabaseToken():null,_handleExpiredToken:()=>{Kt.clearAll(),"undefined"!=typeof window&&(window.location.href="/")},extractTokenData:()=>{if(!Kt.isSupabaseTokenValid())return null;const e=Kt.getSupabaseToken();if(!e)return null;try{const t=Bt.parseJwtPayload(e);if(!t)return null;const n=t.alias||t.default||t.user_alias,r=t.place_id||null,a=t.place_name||null;let s=t.company_id;if(!s&&n)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===n){s=e[7];break}}}return{alias:n,companyId:s,placeId:r,placeName:a,payload:t}}catch(t){return Kt._handleExpiredToken(),null}},getCompanyId:e=>{const t=Kt.getAccessToken();if(t)try{const n=Bt.parseJwtPayload(t);if(n)for(const t in n)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=n[t];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(a){}const n=Kt.extractTokenData();if(n?.companyId)return n.companyId;const r=Kt.getIdToken();if(r)try{const t=Bt.parseJwtPayload(r);if(t)for(const n in t)if(n.startsWith("co")&&/^co\d+$/.test(n)){const r=t[n];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(a){}return null},getCurrentCompanyId:()=>{const e=Kt.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=Kt.getIdToken();if(!e)return[];try{const t=Bt.parseJwtPayload(e);if(!t)return[];const n=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&n.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return n}catch{return[]}}};var Xt=Object.defineProperty,Gt=(e,t,n)=>((e,t,n)=>t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const Yt=new class{constructor(){Gt(this,"errors",[]),Gt(this,"toastCount",0),Gt(this,"lastToastTime",0)}handleError(e,t=!0){const n="string"==typeof e?e:e.message;if(this.errors.push({id:Date.now().toString(),message:n,timestamp:Date.now(),count:1}),t&&this.shouldShowToast()){gt({title:this.getErrorTitle(n),description:n,variant:"destructive"})}}getErrorTitle(e){const t=e.toLowerCase();return t.includes("401")||t.includes("unauthorized")||t.includes("expirou")?"Sessão Expirada":t.includes("token")||t.includes("autenticação")?"Erro de Autenticação":t.includes("api")||t.includes("network")?"Erro de Conexão":"Erro"}success(e,t){gt({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 Jt=Object.defineProperty,Zt=(e,t,n)=>((e,t,n)=>t in e?Jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const en=(void 0).VITE_SUPABASE_URL,tn=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY,nn=class e{constructor(){Zt(this,"client"),Zt(this,"currentToken",null),Zt(this,"instanceCount",0),this.instanceCount++,this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:tn};e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`);return h.createClient(en,tn,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:t,fetch:async(e,t)=>("string"==typeof e?e:e.url).includes("/auth/v1/user")?new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}}):fetch(e,t)}})}static getInstance(){return e.instance||(e.instance=new e),e.instance}getClient(){const e=Kt.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{const t=JSON.parse(atob(e.split(".")[1])),n=Math.floor(Date.now()/1e3);return t.exp>n}catch(t){return Yt.handleError(t instanceof Error?t:"❌ Supabase - Error validating token",!1),!1}}};Zt(nn,"instance");let rn=nn;function an(){return rn.getInstance().getClient()}class sn{static async generateToken(e,t,n,r=!1){try{if(!r){const e=Kt.getSupabaseToken();if(e&&Kt.isSupabaseTokenValid())return e}const a=an(),{data:s,error:o}=await a.functions.invoke("validate-token",{body:{access_token:e,alias:t}});return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(n?.(),null):s?.access_token&&s.access_token?(Kt.setSupabaseToken(s.access_token),s.access_token):null}catch(a){return a instanceof Error&&(a.message.includes("401")||a.message.includes("Unauthorized"))&&n?.(),null}}}var on=Object.defineProperty,ln=(e,t,n)=>((e,t,n)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class cn{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(){if(this.isRegenerating)return null;this.isRegenerating=!0;try{const e=Kt.getAccessToken(),t=Kt.getSelectedAlias();if(!e||!t)return null;const n=await sn.generateToken(e,t,this.onLogoutCallback||void 0,!1);return n?(Kt.setSupabaseToken(n),n):null}catch(e){return null}finally{this.isRegenerating=!1}}}ln(cn,"isRegenerating",!1),ln(cn,"onLogoutCallback",null);class un{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(Kt.clearAll(),window.location.href="/",!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const n=t.toLowerCase();return["401","unauthorized","token","expired","invalid","authentication","login","session"].some(e=>n.includes(e))}static async wrapAsync(e){try{return await e}catch(t){if(!this.handleError(t))throw t;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}var dn=Object.defineProperty;class fn{static async handleApiError(e){if(!e||this.isRetrying)return!1;const t=e.status||e.statusCode,n=e.message||e.toString();if(401===t||n.includes("401")||n.includes("Unauthorized")){this.isRetrying=!0;try{return await cn.attemptRegeneration()?(this.isRetrying=!1,!0):(un.handleError(e),this.isRetrying=!1,!1)}catch(r){return un.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Kt.getAccessToken();return e?Kt.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}((e,t,n)=>{((e,t,n)=>{t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,t+"",n)})(fn,"isRetrying",!1);var mn=Object.defineProperty,pn=(e,t,n)=>((e,t,n)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n);const hn=new class{constructor(){pn(this,"baseUrl",(void 0).VITE_QUALIEX_API_URL)}async makeApiCall(e,t,n){const r=fn.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const a=Kt.getAccessToken();if(!a)throw new Error("Token Qualiex não encontrado");if(!n||""===n.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const s=new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{s.searchParams.append(e,t)});const o=await fetch(s.toString(),{method:"GET",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json","un-alias":n}});if(!o.ok){const e=new Error(`API call failed: ${o.status} ${o.statusText}`);throw e.status=o.status,e.statusCode=o.status,e}return await o.json()}mapToQualiexUser(e){return{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0}}async fetchUsers(e,t){try{const n=await this.makeApiCall("/api/common/v1/companiesusers",{companyId:t,search:"",filterStatus:"active"},e);let r=n;if(n.data)r=n.data;else{if(!Array.isArray(n))return Yt.handleError("[QualiexApi] Formato de resposta inesperado",!1),[];r=n}if(!Array.isArray(r))return Yt.handleError("[QualiexApi] Resposta não é um array",!1),[];return r.map(this.mapToQualiexUser)}catch(n){if(await fn.handleApiError(n))try{const n=await this.makeApiCall("/api/common/v1/companiesusers",{companyId:t,search:"",filterStatus:"active"},e);let r=n;if(n.data)r=n.data;else{if(!Array.isArray(n))return Yt.handleError("[QualiexApi] Formato de resposta inesperado após retry",!1),[];r=n}return Array.isArray(r)?r.map(this.mapToQualiexUser):(Yt.handleError("[QualiexApi] Resposta não é um array após retry",!1),[])}catch(r){return Yt.handleError(r instanceof Error?r:"Erro ao buscar usuários após renovação de token",!0),[]}const a=n instanceof Error?n.message:"Erro ao buscar usuários da API Qualiex";return Yt.handleError(a,!0),[]}}async fetchUserById(e,t,n){try{return(await this.fetchUsers(t,n)).find(t=>t.userId===e)||null}catch(r){return Yt.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,t){const n=await this.fetchUsers(e,t),r=new Map;return n.forEach(e=>{r.set(e.userId,e)}),r}async getUsers(e){const t=Kt.extractTokenData();return t&&t.companyId?this.fetchUsers(e,t.companyId):[]}},gn={oauth:{authUrl:(void 0).VITE_OAUTH_AUTH_URL,clientId:(void 0).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"}},bn={debounceDelay:500},yn=()=>{const e=window.location.origin;return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("id-preview")||e.includes("lovable.dev")||(void 0).DEV};let vn={enableUserEnrichment:!1,enableUsersApi:!1,userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"};const wn=()=>vn,kn={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}`}};function Nn(e,t){const n=wn(),r=t||n.userNameFieldSuffix||"_name";return e.endsWith("_id")?e.replace(/_id$/,r):`${e}${r}`}function jn(e,t){const n=wn(),r=t||n.userEmailFieldSuffix||"_email";return e.endsWith("_id")?e.replace(/_id$/,r):`${e}${r}`}function Cn(e,t){const n=wn(),r=t||n.userUsernameFieldSuffix||"_username";return e.endsWith("_id")?e.replace(/_id$/,r):`${e}${r}`}function Sn(e,t){return t&&t.length>0?t.map(e=>({idField:e.idField,nameField:e.nameField||Nn(e.idField),emailField:e.emailField||jn(e.idField),usernameField:e.usernameField||Cn(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:Nn(e),emailField:jn(e),usernameField:Cn(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const Tn=new Map;class In{static async fetchQualiexUsers(e,t){const n=wn(),r=`${t}_${e}`,a=Tn.get(r);if(a&&Date.now()-a.timestamp<3e5)return a.users;let s;return s=n.fetchUsers?await n.fetchUsers(t,e):await hn.fetchUsers(e,t),Tn.set(r,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,t){const n=new Set;for(const r of e)for(const e of t){const t=r[e.idField];t&&"string"==typeof t&&""!==t.trim()&&n.add(t)}return n}static indexUsers(e){const t=new Map;for(const n of e)n.id&&t.set(n.id,n),n.userId&&t.set(n.userId,n);return t}static enrichEntity(e,t,n){const r={...e};for(const a of t){const t=e[a.idField];if(!t)continue;const s=n.get(t);if(s){if(a.nameField){r[a.nameField]||(r[a.nameField]=s.userName||s.displayName||null)}if(a.emailField){r[a.emailField]||(r[a.emailField]=s.userEmail||null)}if(a.usernameField){r[a.usernameField]||(r[a.usernameField]=s.userName||null)}}}return r}static async enrichWithUserData(e,t){if(!Array.isArray(e)||0===e.length)return e;try{const n=wn();let r=null,a=null;if(n.getCompanyId){const e=n.getCompanyId();a=e instanceof Promise?await e:e}if(n.getAccessToken){const t=n.getAccessToken();if(!(t instanceof Promise?await t:t))return e}if(!r||!a){const t=Kt.extractTokenData();if(!t)return e;r=r||t.alias,a=a||t.companyId}if(!r||!a)return e;const s=Sn(t.userIdFields,t.userFieldsMapping);if(0===this.extractUserIds(e,s).size)return e;const o=await this.fetchQualiexUsers(r,a),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,s,i))}catch(n){return Yt.handleError(n instanceof Error?n:new Error(`[QualiexEnrichment.${t.entityName}] Erro crítico`),!1),e}}static async enrichWithResponsibleNames(e,t){return this.enrichWithUserData(e,{entityName:t.entityName,userIdFields:["id_user"],userFieldsMapping:[{idField:"id_user",nameField:"responsible_name"}]})}}const Pn=["responsible_name"],En=e=>Pn.includes(e);function An(e,t,n){const r="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:n||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:a,searchFields:s,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:c=!1}=r,u=()=>{if(!Kt.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return an().schema(i).from(a)};return{async getAll(e={}){const{search:t="",sortField:n="updated_at",sortDirection:i="desc",page:d=1,limit:f=25,...m}=e;let p=u().select(o||"*",{count:"exact"});p=p.eq("is_removed",!1),Object.entries(m).forEach(([e,t])=>{void 0!==t&&""!==t&&(Array.isArray(t)?p=p.in(e,t):"object"==typeof t&&t&&"operator"in t?"not_null"===t.operator?p=p.not(e,"is",null):"is_null"===t.operator&&(p=p.is(e,null)):null!==t&&(p=p.eq(e,t)))}),p=((e,t)=>{if(t&&s.length>0){const n=s.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(n)}return e})(p,t);n.includes(".")||En(n)||(p=p.order(n,{ascending:"asc"===i})),p=((e,t,n)=>{const r=(t-1)*n,a=r+n-1;return e.range(r,a)})(p,d,f);const{data:h,error:g,count:x}=await p;if(g)throw new Error(`Error fetching ${a}: ${g.message}`);let b=((e,t,n,r)=>{const a=Math.ceil((t||0)/r);return{data:e,currentPage:n,totalPages:a,totalItems:t||0,itemsPerPage:r,hasNextPage:n<a,hasPreviousPage:n>1}})(h||[],x,d,f);const y=wn();if(c&&y.enableUserEnrichment&&l&&b.data.length>0){const t=Sn(r.userIdFields,r.userFieldsMapping);if(b.data.some(e=>t.some(t=>e[t.idField]))){const a=n&&n.includes("."),s=n&&En(n),o=n&&t.some(e=>e.nameField===n||e.emailField===n||e.usernameField===n);if(n&&(s||a||o)){const t={...e,page:1,limit:500,sortField:void 0,sortDirection:void 0},s=await this.getAll(t);if(!s?.data?.length)return s;const o=await In.enrichWithUserData(s.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let c;c=a?o.sort((e,t)=>{const r=n.split(".").reduce((e,t)=>e?.[t],e)||"",a=n.split(".").reduce((e,t)=>e?.[t],t)||"",s=String(r).localeCompare(String(a),"pt-BR");return"asc"===i?s:-s}):((e,t,n)=>[...e].sort((e,r)=>{const a=e[t]||"",s=r[t]||"",o=a.localeCompare(s,"pt-BR",{sensitivity:"base"});return"asc"===n?o:-o}))(o,n,i);const u=((e,t=1,n=25)=>{const r=(t-1)*n,a=r+n,s=e.slice(r,a);return{data:s,pagination:{currentPage:t,totalPages:Math.ceil(e.length/n),totalItems:s.length,totalCount:e.length,itemsPerPage:n,hasNextPage:a<e.length,hasPreviousPage:t>1}}})(c,d,f);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalCount,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}const c=await In.enrichWithUserData(b.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});b={...b,data:c}}}return b},async getById(e){const{data:t,error:n}=await u().select(o||"*").eq("id",e).maybeSingle();if(n)throw new Error(`Error fetching ${a}: ${n.message}`);return t},async create(e){const t=he(e),n=Object.entries(t).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),{data:r,error:s}=await u().insert(n).select().single();if(s)throw new Error(`Error creating ${a}: ${s.message}`);if(!r)throw new Error(`No data returned from create ${a} operation`);return r},async update(e,t){const n={...he(t),updated_at:(new Date).toISOString()},{data:r,error:s}=await u().update(n).eq("id",e).select().single();if(s)throw new Error(`Error updating ${a}: ${s.message}`);if(!r)throw new Error(`No data returned from update ${a} operation`);return r},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:n}=await u().update(t).eq("id",e);if(n)throw new Error(`Error soft deleting ${a}: ${n.message}`)}}}const Dn=()=>{Kt.clearManualLogout()},Rn=e=>e?.placeId||null,Fn=e=>e?.placeName||null,_n=e=>({placeId:Rn(e),placeName:Fn(e)}),Ln=class{static async initialize(){try{if(!Kt.hasAllTokens()||!Kt.areAllTokensValid())return Kt.clearExpiredTokens(),{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null};const t=Kt.getAccessToken(),n=Kt.getIdToken();Dn();const r=this.extractUserFromIdToken(n),a=this.extractCompaniesFromIdToken(n),s=this.extractAliasFromAccessToken(t),o=Kt.extractTokenData(),i=o?.alias;let l=null;if(i&&a.some(e=>e.alias===i))l=i;else{const e=Kt.getSelectedAlias(),t=e&&a.some(t=>t.alias===e);l=t?e:s||a[0]?.alias||null}!Kt.isSupabaseTokenValid()&&l&&await cn.attemptRegeneration();let c=null;if(l){const e=Kt.getCompanyId(l),t=a.find(e=>e.alias===l);t&&(c={id:e||t.id,name:t.name,alias:t.alias})}let u=null,d=null;if(r?.id&&l){const t=Kt.getCompanyId(l);if(t)try{const e=(await hn.fetchActiveUsersMap(l,t)).get(r.id);if(e){const t=_n(e);u=t.placeId,d=t.placeName}}catch(e){}}return{isAuthenticated:!0,isLoading:!1,user:r,alias:l,companies:a,selectedUnit:c,userId:r?.id||null,userAlias:r?.id||null,placeId:u,placeName:d,activePlaceId:u,activePlaceName:d}}catch(e){return{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null}}}static async loginDev(){try{const e=an(),{data:t,error:n}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(n)return!1;if(!t?.access_token||!t?.id_token)return!1;const r=new URL("/callback",window.location.origin);return r.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e=Kt.generateOAuthState();Kt.setOAuthState(e);const t=Kt.generateOAuthNonce();Kt.setOAuthNonce(t);const n=`${window.location.origin}/callback`,r=new URL(gn.oauth.authUrl);r.searchParams.set("client_id",gn.oauth.clientId),r.searchParams.set("response_type",gn.oauth.responseType),r.searchParams.set("scope",gn.oauth.scope),r.searchParams.set("redirect_uri",n),r.searchParams.set("state",e),r.searchParams.set("nonce",t),r.searchParams.set("response_mode","fragment"),yn(),window.location.href=r.toString()}static async processCallback(){try{if(Kt.hasAllTokens()){if(!Kt.getValidSupabaseToken()){Kt.getAccessToken();await cn.attemptRegeneration()}return!0}const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),n=n=>e.get(n)||t.get(n),r=n("access_token"),a=n("id_token"),s=n("error");if(s)throw new Error(`Erro OAuth: ${s}`);if(!r||!a)throw new Error("Tokens não encontrados na URL de callback");Kt.setAccessToken(r),Kt.setIdToken(a),Dn();const o=this.extractAliasFromAccessToken(r);if(o)Kt.setSelectedAlias(o);else{const e=this.extractCompaniesFromIdToken(a);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");Kt.setSelectedAlias(e[0].alias)}if(!await cn.attemptRegeneration())throw new Error("Falha ao gerar token Supabase");return Kt.clearOAuthState(),Kt.clearOAuthNonce(),!0}catch(e){throw e}}static logout(){Kt.setManualLogout(),Kt.clearAll(),window.location.href="/login"}static decodeToken(e){return Bt.parseJwtPayload(e)}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 n=[];return Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const r=t[e].split(";");if(r.length>=4)n.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,a]=t[e].split("|");r&&a&&n.push({id:"",alias:r.trim(),name:a.trim()})}}}),n}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}};cn.setLogoutCallback(()=>{Ln.logout()});let Mn=Ln;const On=e.createContext(void 0),zn=()=>{const t=e.useContext(On);if(void 0===t)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return t};function Bn({queryKey:t,service:n,entityName:r,searchFields:a,additionalFilters:s={},onSuccess:i}){const[l,c]=x.useSearchParams(),u=g.useQueryClient(),{alias:d,userId:f}=zn(),m=e.useCallback(e=>{const n=`${t}_${e}`,r=l.get(n);return r||(l.get(e)||"")},[l,t]),p=m("search"),h=m("sortField")||xn.sorting.defaultField,b=m("sortDirection")||xn.sorting.defaultDirection,y=parseInt(m("page")||"1"),v=parseInt(m("limit")||String(xn.pagination.defaultPageSize)),w=p,k=e.useMemo(()=>({search:w,sortField:h,sortDirection:b,page:y,limit:v,...s}),[w,h,b,y,v,s]),N=e.useCallback(()=>n.getAll(k),[n,k]),j=g.useQuery({queryKey:[t,d,f,k],queryFn:N});if(!j)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const C=g.useMutation({mutationFn:n.create,onSuccess:()=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(kn.success.created(r)),i?.()},onError:e=>{o.toast.error(`${kn.error.create(r)}: ${e.message}`)}}),S=g.useMutation({mutationFn:({id:e,data:t})=>n.update(e,t),onSuccess:()=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(kn.success.updated(r)),i?.()},onError:e=>{o.toast.error(`${kn.error.update(r)}: ${e.message}`)}}),T=g.useMutation({mutationFn:n.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(kn.success.deleted(r))},onError:e=>{o.toast.error(`${kn.error.delete(r)}: ${e.message}`)}}),I=e.useCallback(e=>{const n={...Object.fromEntries(l)};Object.entries(e).forEach(([e,r])=>{const a=`${t}_${e}`;""===r||0===r?delete n[a]:n[a]=String(r)}),delete n.sortField,delete n.sortDirection,c(n)},[l,c,t]),P=e.useCallback(e=>{I({search:e,page:1})},[I]),E=e.useCallback(e=>{I({sortField:e,sortDirection:h===e&&"asc"===b?"desc":"asc",page:1})},[h,b,I]),A=e.useCallback(e=>{I({page:e})},[I]),D=e.useCallback(e=>{I({limit:e,page:1})},[I]),R=e.useCallback(()=>{const e=Object.fromEntries(l),n=`${t}_`,r=Object.fromEntries(Object.entries(e).filter(([e])=>!e.startsWith(n)));c(r)},[c,l,t]),[F,_]=e.useState([]),L=e.useCallback(e=>{_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),M=e.useCallback(()=>{const e=j?.data?.data.map(e=>e.id)||[];_(t=>t.length===e.length?[]:e)},[j?.data?.data]),O=e.useCallback(()=>{_([])},[]),z=e.useMemo(()=>{const e=j?.data?.data.map(e=>e.id)||[];return e.length>0&&F.length===e.length},[F,j?.data?.data]),B=g.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>n.delete(e)))},onSuccess:(e,n)=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(`${n.length} ${r}(s) deletado(s) com sucesso`),O()},onError:e=>{o.toast.error(`Erro ao deletar itens: ${e.message}`)}}),U=e.useCallback((e,t)=>{const n=t?t(e):e;e.id?S.mutate({id:e.id,data:n}):C.mutate({...n,alias:d})},[d,C,S]);return{entities:j?.data?.data||[],pagination:{currentPage:j?.data?.currentPage||1,totalPages:j?.data?.totalPages||1,totalItems:j?.data?.totalItems||0,itemsPerPage:j?.data?.itemsPerPage||xn.pagination.defaultPageSize,hasNextPage:j?.data?.hasNextPage||!1,hasPreviousPage:j?.data?.hasPreviousPage||!1},isLoading:j?.isLoading??!0,isCreating:C?.isPending??!1,isUpdating:S?.isPending??!1,isDeleting:T?.isPending??!1,error:j?.error||null,searchTerm:p,sortField:h,sortDirection:b,currentPage:y,itemsPerPage:v,queryKey:t,createEntity:C.mutate,updateEntity:(e,t)=>S.mutate({id:e,data:t}),deleteEntity:T.mutate,save:U,handleSearch:P,handleSort:E,handlePageChange:A,handleItemsPerPageChange:D,clearFilters:R,refetch:j.refetch,selectedIds:F,selectItem:L,selectAll:M,clearSelection:O,isAllSelected:z,bulkDelete:B.mutate,isBulkDeleting:B.isPending}}const Un=V.Root,$n=V.Trigger,Vn=V.Portal,qn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Overlay,{className:pe("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:n}));qn.displayName=V.Overlay.displayName;const Hn=L.forwardRef(({className:e,...t},n)=>fe.jsxs(Vn,{children:[fe.jsx(qn,{}),fe.jsx(V.Content,{ref:n,className:pe("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})]}));Hn.displayName=V.Content.displayName;const Wn=({className:e,...t})=>fe.jsx("div",{className:pe("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});Wn.displayName="AlertDialogHeader";const Qn=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qn.displayName="AlertDialogFooter";const Kn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Title,{ref:n,className:pe("text-lg font-semibold",e),...t}));Kn.displayName=V.Title.displayName;const Xn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Description,{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));Xn.displayName=V.Description.displayName;const Gn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Action,{ref:n,className:pe(ge(),e),...t}));Gn.displayName=V.Action.displayName;const Yn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Cancel,{ref:n,className:pe(ge({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Yn.displayName=V.Cancel.displayName;const Jn=({open:t,onOpenChange:n,item:r,onConfirm:a,entityName:s="item",isDeleting:o=!1,isBulk:i=!1,bulkCount:l})=>{const[c,u]=e.useState("");e.useEffect(()=>{t||u("")},[t]);const d=()=>{u(""),n(!1)},f=i?c===l?.toString():c===r?.title;return r?fe.jsx(Un,{open:t,onOpenChange:d,children:fe.jsxs(Hn,{className:"sm:max-w-[500px]",children:[fe.jsx(Wn,{children:fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-destructive/10 flex items-center justify-center",children:fe.jsx("span",{className:"text-destructive font-semibold text-sm",children:"!"})}),fe.jsx("div",{className:"flex-1",children:fe.jsx(Kn,{className:"text-lg font-semibold",children:"Confirmar Exclusão"})})]})}),fe.jsx(Xn,{asChild:!0,children:fe.jsxs("div",{className:"space-y-4",children:[fe.jsxs("div",{className:"text-sm text-muted-foreground",children:[fe.jsx("p",{className:"mb-2",children:i?fe.jsx(fe.Fragment,{children:"Você está prestes a excluir permanentemente:"}):fe.jsxs(fe.Fragment,{children:["Você está prestes a excluir permanentemente o ",s,":"]})}),fe.jsx("div",{className:"p-3 bg-muted rounded-md border-l-4 border-l-destructive",children:fe.jsx("p",{className:"font-medium text-foreground",children:i?`${r.title}`:r.title})})]}),fe.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-md p-3",children:fe.jsxs("div",{className:"flex items-start space-x-2",children:[fe.jsx("div",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-orange-500 flex items-center justify-center mt-0.5",children:fe.jsx("span",{className:"text-white font-bold text-xs",children:"!"})}),fe.jsxs("div",{className:"text-sm text-orange-800",children:[fe.jsx("p",{className:"font-medium mb-1",children:"Atenção!"}),fe.jsx("p",{children:i?fe.jsx(fe.Fragment,{children:"Esta ação não pode ser desfeita. Os itens serão removidos permanentemente do sistema."}):fe.jsxs(fe.Fragment,{children:["Esta ação não pode ser desfeita. O ",s," será removido permanentemente do sistema."]})})]})]})}),fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(we,{htmlFor:"confirmation",className:"text-sm font-medium",children:i?fe.jsxs(fe.Fragment,{children:["Para confirmar, digite o número de itens que serão removidos: ",fe.jsx("strong",{children:l})]}):fe.jsxs(fe.Fragment,{children:["Para confirmar, digite ",fe.jsxs("strong",{children:['"',r.title,'"']})," abaixo:"]})}),fe.jsx(ye,{id:"confirmation",type:i?"number":"text",value:c,onChange:e=>u(e.target.value),placeholder:i?`Digite: ${l}`:`Digite: ${r.title}`,className:"w-full"})]})]})}),fe.jsxs(Qn,{children:[fe.jsx(Yn,{onClick:d,children:"Cancelar"}),fe.jsx(Gn,{onClick:()=>{if(!r)return;(i?c===l?.toString():c===r.title)&&(a(r),u(""),n(!1))},disabled:!f||o,className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:o?"Removendo...":`Excluir ${s}`})]})]})}):null},Zn=L.forwardRef(({className:e,...t},n)=>fe.jsx("table",{ref:n,className:pe("w-full caption-bottom text-sm",e),...t}));Zn.displayName="Table";const er=L.forwardRef(({className:e,...t},n)=>fe.jsx("thead",{ref:n,className:pe("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));er.displayName="TableHeader";const tr=L.forwardRef(({className:e,...t},n)=>fe.jsx("tbody",{ref:n,className:pe("[&_tr:last-child]:border-0",e),...t}));tr.displayName="TableBody";const nr=L.forwardRef(({className:e,...t},n)=>fe.jsx("tfoot",{ref:n,className:pe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));nr.displayName="TableFooter";const rr=L.forwardRef(({className:e,...t},n)=>fe.jsx("tr",{ref:n,className:pe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted odd:bg-muted/50",e),...t}));rr.displayName="TableRow";const ar=L.forwardRef(({className:e,...t},n)=>fe.jsx("th",{ref:n,className:pe("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}));ar.displayName="TableHead";const sr=L.forwardRef(({className:e,...t},n)=>fe.jsx("td",{ref:n,className:pe("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));sr.displayName="TableCell";const or=L.forwardRef(({className:e,...t},n)=>fe.jsx("caption",{ref:n,className:pe("mt-4 text-sm text-muted-foreground",e),...t}));function ir({rows:e=5,columns:t=4}){return fe.jsx("div",{className:"w-full",children:fe.jsxs("div",{className:"rounded-md border",children:[fe.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:fe.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>fe.jsx(Mt,{className:"h-4 w-24"},t))})}),fe.jsx("div",{children:Array.from({length:e}).map((e,n)=>fe.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:fe.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>fe.jsx(Mt,{className:"h-4 w-20"},t))})},n))})]})})}function lr({count:e=3}){return fe.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>fe.jsxs(ke,{children:[fe.jsxs(Ne,{children:[fe.jsx(Mt,{className:"h-4 w-3/4"}),fe.jsx(Mt,{className:"h-3 w-1/2"})]}),fe.jsx(Se,{children:fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(Mt,{className:"h-3 w-full"}),fe.jsx(Mt,{className:"h-3 w-2/3"})]})})]},t))})}or.displayName="TableCaption";const cr={default:i.FileX,search:i.Search,error:i.AlertCircle};function ur({icon:e,title:t,description:n,action:r,className:a,variant:s="default"}){const o=e?()=>e:cr[s];return fe.jsxs("div",{className:pe("flex flex-col items-center justify-center py-12 px-4 text-center",a),children:[fe.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:fe.jsx(o,{className:"h-8 w-8 text-muted-foreground"})}),fe.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),n&&fe.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:n}),r&&fe.jsx(xe,{onClick:r.onClick,variant:"outline",children:r.label})]})}const dr=q.Root,fr=q.Trigger,mr=q.Group,pr=q.Portal,hr=q.Sub,gr=q.RadioGroup,xr=L.forwardRef(({className:e,inset:t,children:n,...r},a)=>fe.jsxs(q.SubTrigger,{ref:a,className:pe("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),...r,children:[n,fe.jsx(i.ChevronRight,{className:"ml-auto h-4 w-4"})]}));xr.displayName=q.SubTrigger.displayName;const br=L.forwardRef(({className:e,...t},n)=>fe.jsx(q.SubContent,{ref:n,className:pe("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}));br.displayName=q.SubContent.displayName;const yr=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>fe.jsx(q.Portal,{children:fe.jsx(q.Content,{ref:r,sideOffset:t,className:pe("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),...n})}));yr.displayName=q.Content.displayName;const vr=L.forwardRef(({className:e,inset:t,...n},r)=>fe.jsx(q.Item,{ref:r,className:pe("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),...n}));vr.displayName=q.Item.displayName;const wr=L.forwardRef(({className:e,children:t,checked:n,...r},a)=>fe.jsxs(q.CheckboxItem,{ref:a,className:pe("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:n,...r,children:[fe.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:fe.jsx(q.ItemIndicator,{children:fe.jsx(i.Check,{className:"h-4 w-4"})})}),t]}));wr.displayName=q.CheckboxItem.displayName;const kr=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(q.RadioItem,{ref:r,className:pe("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),...n,children:[fe.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:fe.jsx(q.ItemIndicator,{children:fe.jsx(i.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));kr.displayName=q.RadioItem.displayName;const Nr=L.forwardRef(({className:e,inset:t,...n},r)=>fe.jsx(q.Label,{ref:r,className:pe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Nr.displayName=q.Label.displayName;const jr=L.forwardRef(({className:e,...t},n)=>fe.jsx(q.Separator,{ref:n,className:pe("-mx-1 my-1 h-px bg-muted",e),...t}));jr.displayName=q.Separator.displayName;const Cr=({className:e,...t})=>fe.jsx("span",{className:pe("ml-auto text-xs tracking-widest opacity-60",e),...t});Cr.displayName="DropdownMenuShortcut";const Sr=({onEdit:e,onDelete:t,onToggleStatus:n,isActive:r=!0,canDelete:a=!0,customActions:s=[],renderAs:o})=>{const l=[];if(e){const t={icon:i.Edit,label:"Editar",onClick:e};l.push(t)}if(s.forEach(e=>{l.push(e)}),n){const e={icon:r?i.PowerOff:i.Power,label:r?"Inativar":"Ativar",onClick:n};l.push(e)}if(a&&t){const e={icon:i.Trash2,label:"Remover",onClick:t,destructive:!0};l.push(e)}return"dropdown"===o?fe.jsx(fe.Fragment,{children:l.map((e,t)=>fe.jsxs(vr,{onClick:e.onClick,className:e.destructive?"text-destructive":"",children:[fe.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},t))}):fe.jsx(fe.Fragment,{children:l.map((e,t)=>fe.jsxs(xe,{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:[fe.jsx(e.icon,{className:"h-4 w-4 mr-2"}),e.label]},t))})},Tr=({onEdit:e,onDelete:t,canDelete:n=!0,onToggleStatus:r,isActive:a=!0,customActions:s=[]})=>fe.jsxs(dr,{children:[fe.jsx(fr,{asChild:!0,children:fe.jsx(xe,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:fe.jsx(i.EllipsisVertical,{size:12})})}),fe.jsx(yr,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:fe.jsx(Sr,{onEdit:t=>{t?.stopPropagation(),e?.()},onDelete:e=>{e?.stopPropagation(),t?.()},onToggleStatus:e=>{e?.stopPropagation(),r?.()},isActive:a,canDelete:n,customActions:s,renderAs:"dropdown"})})]}),Ir=e.memo(({checked:e,onCheckedChange:t})=>fe.jsx(rt,{checked:e,onCheckedChange:t}),(e,t)=>e.checked===t.checked),Pr=({manager:t,columns:n,onEdit:r,onView:a,onToggleStatus:s,onDelete:o,renderActions:l,customRowActions:c,enableBulkActions:u=!1})=>{const[d,f]=e.useState(!1),[m,p]=e.useState(null);e.useEffect(()=>{const e=()=>f(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.useEffect(()=>{const e=()=>p(null);if(m)return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[m]);const h=(()=>{n.length;let e=0;const t=n.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const n=t.minWidth||120,r=t.weight||1;return e+=n,{...t,calculatedWidth:n,weight:r,isFixed:!1}}});return e+=50,t.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})();return d?t.isLoading?fe.jsx(lr,{count:3}):0===t.entities.length?fe.jsx(ur,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"}):fe.jsxs("div",{className:"space-y-4",children:[t.entities.map(e=>fe.jsx(ke,{className:pe("overflow-hidden cursor-pointer hover:bg-muted/50",u&&t.selectedIds.includes(e.id)&&"bg-muted"),onClick:n=>{n.stopPropagation(),u?t.selectItem(e.id):r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),p({x:t.clientX,y:t.clientY,item:e})},children:fe.jsx(Se,{className:"p-4",children:fe.jsxs("div",{className:"flex items-start gap-3",children:[u&&fe.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:fe.jsx(Ir,{checked:t.selectedIds.includes(e.id),onCheckedChange:()=>t.selectItem(e.id)})}),fe.jsxs("div",{className:"flex-1",children:[n.map(t=>fe.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[fe.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[t.header,":"]}),fe.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||a||l)&&fe.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:l?l(e):fe.jsx(Tr,{onEdit:r?()=>{r(e)}:void 0,onDelete:o?()=>o(e):void 0,onToggleStatus:s?()=>s(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]})]})})},e.id)),m&&fe.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:m.x,top:m.y},onClick:e=>e.stopPropagation(),children:fe.jsx(Sr,{onEdit:r?()=>{r(m.item),p(null)}:void 0,onDelete:o?()=>{o(m.item),p(null)}:void 0,onToggleStatus:s?()=>{s(m.item),p(null)}:void 0,isActive:m.item.is_actived,canDelete:!!o,customActions:c?c(m.item):[],renderAs:"context"})})]}):fe.jsxs("div",{className:"flex flex-col h-full",children:[t.isLoading?fe.jsx(ir,{rows:5,columns:n.length}):fe.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:fe.jsx("div",{className:"flex-1 overflow-auto",children:fe.jsxs(Zn,{className:"table-auto",children:[fe.jsxs("colgroup",{children:[u&&fe.jsx("col",{style:{width:"50px"}}),h.map((e,t)=>fe.jsx("col",{style:e.style},t)),fe.jsx("col",{style:{width:"50px"}})]}),fe.jsx(er,{children:fe.jsxs(rr,{children:[u&&fe.jsx(ar,{className:"w-[50px]",children:fe.jsx(Ir,{checked:t.isAllSelected,onCheckedChange:t.selectAll})}),n.map(e=>{return fe.jsx(ar,{className:`${e.className||""} ${e.sortable?"cursor-pointer hover:bg-muted/50":""}`,onClick:e.sortable?()=>t.handleSort(String(e.key)):void 0,children:fe.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,e.sortable&&(n=String(e.key),t.sortField!==n?fe.jsx(i.ArrowUpDown,{size:14,className:"ml-1 opacity-50"}):"asc"===t.sortDirection?fe.jsx(i.ArrowUp,{size:14,className:"ml-1"}):fe.jsx(i.ArrowDown,{size:14,className:"ml-1"}))]})},String(e.key));var n}),fe.jsx(ar,{className:"w-[50px] text-center",children:"Ações"})]})}),fe.jsx(tr,{children:0===t.entities.length?fe.jsx(rr,{children:fe.jsx(sr,{colSpan:u?n.length+2:n.length+1,className:"h-32",children:fe.jsx(ur,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"})})}):t.entities.map(e=>fe.jsxs(rr,{className:pe("cursor-pointer hover:bg-muted/50",u&&t.selectedIds.includes(e.id)&&"bg-muted"),onClick:n=>{n.stopPropagation(),u?t.selectItem(e.id):r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),p({x:t.clientX,y:t.clientY,item:e})},children:[u&&fe.jsx(sr,{onClick:e=>e.stopPropagation(),children:fe.jsx(Ir,{checked:t.selectedIds.includes(e.id),onCheckedChange:()=>t.selectItem(e.id)})}),n.map(t=>fe.jsx(sr,{className:t.className,children:t.render?t.render(e):e[t.key]},String(t.key))),fe.jsx(sr,{className:"text-center",children:l?l(e):fe.jsx(Tr,{onEdit:r?()=>r(e):void 0,onDelete:o?()=>o(e):void 0,onToggleStatus:s?()=>s(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]},e.id))})]})})}),m&&fe.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:m.x,top:m.y},onClick:e=>e.stopPropagation(),children:fe.jsx(Sr,{onEdit:r?()=>{r(m.item),p(null)}:void 0,onDelete:o?()=>{o(m.item),p(null)}:void 0,onToggleStatus:s?()=>{s(m.item),p(null)}:void 0,isActive:m.item.is_actived,canDelete:!!o,customActions:c?c(m.item):[],renderAs:"context"})})]})};function Er(t,n,r,a){const[s,o]=e.useState({}),[i,l]=e.useState({}),c=e.useMemo(()=>t,[t]),u=e=>e instanceof Date&&!isNaN(e.getTime()),d=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{}}},f=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(n){return d(e)}},m=(e,t,n)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let a;if("function"==typeof e.validation?a=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(a=e.validation.custom),a)try{const e=a(t,n);if(e)return e}catch(r){}}};e.useEffect(()=>{if(!a)return;const e=t=>{const n=[];return t.forEach(t=>{n.push(t),t.fields&&n.push(...e(t.fields))}),n},t=e(c),s={};t.forEach(e=>{let t;if(n&&void 0!==n[e.name]){if(t=n[e.name],null==t&&(t=""),"date"===e.type&&t)if("string"==typeof t){const e=new Date(t);u(e)&&(t=e.toISOString().split("T")[0])}else u(t)&&(t=t.toISOString().split("T")[0])}else t=d(e);s[e.name]=t}),t.forEach(e=>{const t=f(e,s);void 0!==t&&(s[e.name]=t)}),n&&Object.keys(n).forEach(e=>{t.find(t=>t.name===e)||void 0===n[e]||(s[e]=n[e])}),o(s),l({}),r&&r(s)},[c,n,r,a]);const p=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...p(e.fields))}),t},h=()=>{const e=p(c),t={};return e.forEach(e=>{const n=m(e,s[e.name],s);n&&(t[e.name]=n)}),l(t),0===Object.keys(t).length};return{formData:s,errors:i,updateField:(e,t)=>{o(n=>{const a={...n,[e]:t},s=((e,t)=>{let n={...t};const r=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...r(e.fields))}),t};return r(c).filter(t=>t.dependsOn===e).forEach(e=>{const t=f(e,n);void 0!==t&&(n={...n,[e.name]:t})}),n})(e,a);return r&&r(s),s}),i[e]&&l(t=>{const n={...t};return delete n[e],n});const n=p(c).find(t=>t.name===e);if(n){const r=m(n,t,s);r&&l(t=>({...t,[e]:r}))}},validateForm:h,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),h()&&e(s)}}}const Ar=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#84cc16","#f97316","#ec4899","#6b7280"],Dr=({value:e="#3b82f6",onChange:t,label:n})=>fe.jsxs("div",{className:"space-y-2",children:[n&&fe.jsx(we,{children:n}),fe.jsxs(St,{children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[fe.jsx("div",{className:"h-4 w-4 rounded border mr-2",style:{backgroundColor:e}}),e]})}),fe.jsx(It,{className:"w-64",children:fe.jsxs("div",{className:"space-y-3",children:[fe.jsxs("div",{children:[fe.jsx(we,{htmlFor:"color-input",children:"Cor personalizada"}),fe.jsx(ye,{id:"color-input",type:"color",value:e,onChange:e=>t?.(e.target.value),className:"h-10 w-full"})]}),fe.jsxs("div",{children:[fe.jsx(we,{children:"Cores predefinidas"}),fe.jsx("div",{className:"grid grid-cols-5 gap-2 mt-2",children:Ar.map(e=>fe.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))})]})]})})]})]}),Rr=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(H.Root,{ref:r,className:pe("relative overflow-hidden",e),...n,children:[fe.jsx(H.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),fe.jsx(Fr,{}),fe.jsx(H.Corner,{})]}));Rr.displayName=H.Root.displayName;const Fr=L.forwardRef(({className:e,orientation:t="vertical",...n},r)=>fe.jsx(H.ScrollAreaScrollbar,{ref:r,orientation:t,className:pe("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),...n,children:fe.jsx(H.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Fr.displayName=H.ScrollAreaScrollbar.displayName;const _r={Star:i.Star,Heart:i.Heart,Home:i.Home,User:i.User,Settings:i.Settings,Mail:i.Mail,Phone:i.Phone,Calendar:i.Calendar,MapPin:i.MapPin,Camera:i.Camera,Image:i.Image,Music:i.Music,Video:i.Video,Book:i.Book,Bookmark:i.Bookmark,Search:i.Search,Filter:i.Filter,Edit:i.Edit,Trash2:i.Trash2,Plus:i.Plus,Minus:i.Minus,Check:i.Check,X:i.X,ChevronDown:i.ChevronDown,ChevronUp:i.ChevronUp,ChevronLeft:i.ChevronLeft,ChevronRight:i.ChevronRight,ArrowUp:i.ArrowUp,ArrowDown:i.ArrowDown,ArrowLeft:i.ArrowLeft,ArrowRight:i.ArrowRight,Clock:i.Clock,Bell:i.Bell,AlertCircle:i.AlertCircle,Info:i.Info,HelpCircle:i.HelpCircle,Download:i.Download,Upload:i.Upload,Share:i.Share,Copy:i.Copy,Save:i.Save,FileText:i.FileText,Folder:i.Folder,FolderOpen:i.FolderOpen,Archive:i.Archive,Lock:i.Lock,Unlock:i.Unlock,Eye:i.Eye,EyeOff:i.EyeOff,Shield:i.Shield,Key:i.Key,Zap:i.Zap,Flame:i.Flame,Sparkles:i.Sparkles,Award:i.Award,Trophy:i.Trophy,Target:i.Target},Lr=({value:t="Star",onChange:n,label:r})=>{const[a,s]=e.useState(""),o=Object.entries(_r).filter(([e])=>e.toLowerCase().includes(a.toLowerCase())),l=_r[t]||i.Star;return fe.jsxs("div",{className:"space-y-2",children:[r&&fe.jsx(we,{children:r}),fe.jsxs(St,{children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[fe.jsx(l,{className:"h-4 w-4 mr-2"}),t]})}),fe.jsx(It,{className:"w-80",children:fe.jsxs("div",{className:"space-y-3",children:[fe.jsxs("div",{children:[fe.jsx(we,{htmlFor:"icon-search",children:"Buscar ícone"}),fe.jsx(ye,{id:"icon-search",placeholder:"Digite o nome do ícone...",value:a,onChange:e=>s(e.target.value)})]}),fe.jsx(Rr,{className:"h-48",children:fe.jsx("div",{className:"grid grid-cols-6 gap-2",children:o.map(([e,r])=>fe.jsx("button",{className:"p-2 rounded border-2 hover:border-primary "+(t===e?"border-primary bg-primary/10":"border-border"),onClick:()=>n?.(e),title:e,children:fe.jsx(r,{className:"h-4 w-4"})},e))})})]})})]})]})};function Mr({options:e,value:t,onChange:n,onCreate:r,placeholder:a="Selecionar...",searchPlaceholder:s="Buscar...",createLabel:o=e=>`Criar "${e}"`,emptyMessage:l="Nenhum item encontrado.",disabled:c=!1,error:u,isLoading:d=!1,className:f,mode:m="single"}){const[p,h]=L.useState(!1),[g,x]=L.useState(""),[b,y]=L.useState(!1),v=L.useMemo(()=>t?Array.isArray(t)?t:[t]:[],[t]),w=L.useMemo(()=>v.map(t=>e.find(e=>e.value===t)?.label).filter(Boolean),[v,e]),k=L.useMemo(()=>g?e.filter(e=>e.label.toLowerCase().includes(g.toLowerCase())):e,[e,g]),N=L.useMemo(()=>!(!g||!r)&&!e.some(e=>e.label.toLowerCase()===g.toLowerCase()),[g,e,r]),j=L.useMemo(()=>0===w.length?a:"single"===m?w[0]:null,[w,a,m]);return fe.jsxs(St,{open:p,onOpenChange:h,children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",role:"combobox","aria-expanded":p,disabled:c||d,className:pe("w-full justify-between",!t&&"text-muted-foreground",u&&"border-destructive",f),children:[fe.jsx("div",{className:"flex flex-wrap gap-1 flex-1 overflow-hidden",children:"multiple"===m&&w.length>0?w.map((e,t)=>fe.jsxs(ot,{variant:"secondary",className:"mr-1",children:[e,fe.jsx("button",{className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onMouseDown:e=>((e,t)=>{t.stopPropagation();const r=v.filter(t=>t!==e);n("single"===m?"":r)})(v[t],e),children:"✕"})]},v[t])):fe.jsx("span",{className:"truncate",children:j})}),fe.jsx(i.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),fe.jsx(It,{className:"w-full p-0",align:"start",children:fe.jsxs(Pt,{children:[fe.jsx("div",{className:"flex items-center border-b px-3",children:fe.jsx("input",{placeholder:s,value:g,onChange:e=>x(e.target.value),className:"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"})}),fe.jsxs(At,{children:[0===k.length&&!N&&fe.jsx(Dt,{children:l}),N&&fe.jsx(Rt,{children:fe.jsxs(_t,{onSelect:async()=>{if(r&&g){y(!0);try{const e=await r(g);e&&("single"===m?(n(e),h(!1)):n([...v,e])),x("")}catch(e){}finally{y(!1)}}},className:"cursor-pointer",disabled:b,children:[fe.jsx(i.Plus,{className:"mr-2 h-4 w-4 text-primary"}),fe.jsx("span",{className:"text-primary font-medium",children:o(g)})]})}),k.length>0&&fe.jsx(Rt,{children:k.map(e=>fe.jsxs(_t,{value:e.value,onSelect:()=>(e=>{if("single"===m)n(e),h(!1),x("");else{const t=v.includes(e)?v.filter(t=>t!==e):[...v,e];n(t)}})(e.value),className:"cursor-pointer",children:[fe.jsx(i.Check,{className:pe("mr-2 h-4 w-4",v.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},e.value))})]})]})})]})}function Or({value:t,onChange:n,items:r,isLoading:a=!1,error:s=null,getItemValue:o,getItemLabel:l,searchPlaceholder:c="Buscar...",emptyMessage:u="Nenhum item disponível",noResultsMessage:d="Nenhum resultado encontrado",sortItems:f,placeholder:m="Selecionar...",disabled:p=!1,className:h}){const[g,x]=e.useState(""),b=e.useMemo(()=>{const e=f?[...r].sort(f):[...r].sort((e,t)=>l(e).localeCompare(l(t),"pt-BR"));if(!g.trim())return e;const t=g.toLowerCase();return e.filter(e=>l(e).toLowerCase().includes(t))},[r,g,f,l]);return a?fe.jsx(Mt,{className:pe("h-10 w-full",h)}):s?fe.jsxs("div",{className:pe("flex items-center gap-2 p-2 border border-destructive/20 rounded-md",h),children:[fe.jsx(i.AlertCircle,{className:"h-4 w-4 text-destructive"}),fe.jsx("span",{className:"text-sm text-destructive",children:s.message||"Erro ao carregar dados"})]}):fe.jsxs(Qe,{value:t,onValueChange:n,disabled:p||0===r.length,children:[fe.jsx(Ge,{className:h,children:fe.jsx(Xe,{placeholder:m})}),fe.jsxs(Ze,{children:[fe.jsx("div",{className:"px-2 pb-2",children:fe.jsxs("div",{className:"relative",children:[fe.jsx(i.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),fe.jsx(ye,{placeholder:c,value:g,onChange:e=>x(e.target.value),onKeyDown:e=>e.stopPropagation(),className:"pl-8 h-9"})]})}),0===b.length?fe.jsx(tt,{value:"no-items",disabled:!0,children:g?d:u}):b.map(e=>fe.jsx(tt,{value:o(e),children:l(e)},o(e)))]})]})}const zr=(e={})=>{const{user:t,alias:n}=zn(),r=wn(),{enabled:a=r.enableUsersApi}=e;return g.useQuery({queryKey:["qualiex-users",n],queryFn:()=>hn.getUsers(n),enabled:a&&!!n&&!!t,retry:2,retryDelay:1e3})},Br=({value:e="",onChange:t,placeholder:n="Selecionar usuário",disabled:r,className:a,enabled:s})=>{const{data:o=[],isLoading:i,error:l}=zr({enabled:s});return fe.jsx(Or,{value:e,onChange:t,items:o,isLoading:i,error:l,getItemValue:e=>e.userId,getItemLabel:e=>e.userName,placeholder:n,searchPlaceholder:"Buscar usuário...",emptyMessage:"Nenhum usuário disponível",noResultsMessage:"Nenhum usuário encontrado",disabled:r,className:a})};function Ur({title:t,sections:n,initialData:r,onSubmit:a,onCancel:s,open:o,submitButtonText:i="Salvar",isLoading:l=!1,usersData:c}){const[u,d]=e.useState(n?.[0]?.id||""),f=e.useMemo(()=>n&&Array.isArray(n)?n.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[n]),{formData:m,errors:p,updateField:h,handleSubmit:g}=Er(f,r,void 0,o),x=e.useMemo(()=>n&&Array.isArray(n)?n.map(e=>({...e,disabled:e.condition?!e.condition(m):e.disabled||!1})):[],[n,m]),b=e.useMemo(()=>{const e=x.find(e=>e.id===u);if(e&&!e.disabled)return u;const t=x.find(e=>!e.disabled);return t?.id||u},[x,u]);e.useEffect(()=>{b!==u&&d(b)},[b,u]);const y=x.find(e=>e.id===b),v=e=>{const t=(e.computedValue,m[e.name]),n=void 0!==t?t:"",r=p[e.name];switch(e.type){case"group":return fe.jsxs("div",{className:"space-y-2",children:[e.label,fe.jsx("div",{className:e.className||("horizontal"===e.layout?"flex gap-3":"space-y-3"),children:e.fields?.map(e=>v(e))})]},e.name);case"user-select":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(Br,{value:n||"",onChange:t=>h(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:r?"border-red-500":""}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"textarea":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(at,{id:e.name,value:n||"",onChange:t=>{h(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"select":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsxs(Qe,{value:String(n),onValueChange:t=>{h(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[fe.jsx(Ge,{className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,children:fe.jsx(Xe,{placeholder:e.placeholder})}),fe.jsx(Ze,{children:e.options?.map(e=>fe.jsx(tt,{value:e.value,children:e.label},e.value))})]}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"date":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(ye,{id:e.name,type:"date",value:String(n),onChange:t=>h(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:pe("w-full",r?"border-red-500":"",e.disabled?"bg-gray-100 cursor-not-allowed":"")}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"color":return fe.jsxs("div",{children:[fe.jsxs(we,{htmlFor:e.name,children:[e.label," ",e.required&&fe.jsx("span",{className:"text-destructive",children:"*"})]}),fe.jsx(ye,{id:e.name,type:"color",value:n||e.defaultValue||"#000000",onChange:t=>h(e.name,t.target.value),className:"h-10"}),r&&fe.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"color-picker":return fe.jsxs("div",{children:[fe.jsx(Dr,{label:`${e.label} ${e.required?"*":""}`,value:n||e.defaultValue||"#3b82f6",onChange:t=>h(e.name,t)}),r&&fe.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"icon-picker":return fe.jsxs("div",{children:[fe.jsx(Lr,{label:`${e.label} ${e.required?"*":""}`,value:n||e.defaultValue||"Star",onChange:t=>h(e.name,t)}),r&&fe.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"custom":if(!e.component)return null;const t=e.component;return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(t,{value:n,onChange:t=>{h(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,error:r,...e.componentProps||{}}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"creatable-select":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsxs(we,{htmlFor:e.name,children:[e.label,e.required&&fe.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),fe.jsx(Mr,{options:e.options||[],value:n,onChange:t=>{h(e.name,t),e.onValueChange&&e.onValueChange(t)},onCreate:e.onCreate,placeholder:e.placeholder,searchPlaceholder:e.searchPlaceholder,createLabel:e.createLabel,emptyMessage:e.emptyMessage,disabled:e.disabled,error:r,mode:e.mode||"single"}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"number":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(ye,{id:e.name,type:"number",value:null!=n?String(n):"",onChange:t=>{const n=t.target.value,r=""===n?null:Number(n);h(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);default:return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(ye,{id:e.name,type:"text",value:n||"",onChange:t=>{h(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,readOnly:e.disabled}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name)}},w=e.useCallback(()=>{if(!y)return null;if(y.disabled)return fe.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[fe.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:fe.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:fe.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),fe.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),fe.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(y.component){const e=y.component;return fe.jsx(e,{formData:m,updateField:h,errors:p,users:c,disabled:y.disabled})}return fe.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:y.fields.map(v)})},[y,m,h,p,c,v]),k=fe.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[x.length>1&&fe.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:fe.jsx("div",{className:"flex space-x-2",children:x.map(e=>fe.jsx(xe,{variant:b===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=x.find(t=>t.id===e);t&&!t.disabled&&d(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),fe.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 pt-0 pb-2 md:pb-4",children:l?fe.jsx("div",{className:"flex items-center justify-center py-12",children:fe.jsx("div",{className:"text-muted-foreground",children:"Carregando dados..."})}):fe.jsxs("form",{onSubmit:g(a),className:"space-y-3 md:space-y-4",children:[w(),fe.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[fe.jsx(xe,{type:"button",variant:"outline",onClick:s,children:"Cancelar"}),fe.jsx(xe,{type:"submit",disabled:l,children:i})]})]})})]});return fe.jsx(Ie,{open:o,onOpenChange:e=>{!1===e&&!0===o&&s()},children:fe.jsxs(Re,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[fe.jsxs(Fe,{className:"bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-4",children:[fe.jsx(Le,{className:"text-white",children:t}),fe.jsx(Me,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),k]})})}function $r({currentPage:e,totalPages:t,totalItems:n,itemsPerPage:r,onPageChange:a,onItemsPerPageChange:s,variant:o="full"}){const l=(e-1)*r+1,c=Math.min(e*r,n);return fe.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[fe.jsx("div",{className:"flex items-center gap-2",children:"full"===o&&fe.jsxs(fe.Fragment,{children:[fe.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Itens por página"}),fe.jsxs(Qe,{value:String(r),onValueChange:e=>s(Number(e)),children:[fe.jsx(Ge,{className:"h-8 w-[70px]",children:fe.jsx(Xe,{})}),fe.jsxs(Ze,{children:[fe.jsx(tt,{value:"10",children:"10"}),fe.jsx(tt,{value:"25",children:"25"}),fe.jsx(tt,{value:"50",children:"50"}),fe.jsx(tt,{value:"100",children:"100"})]})]})]})}),fe.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[l,"-",c," de ",n," itens"]}),fe.jsxs("div",{className:"flex items-center gap-1",children:[fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(1),disabled:1===e,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronsLeft,{size:16})}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronLeft,{size:16})}),fe.jsxs("div",{className:"flex items-center gap-1 px-2",children:[fe.jsx("span",{className:"text-sm font-medium",children:e}),fe.jsx("span",{className:"text-sm text-muted-foreground",children:"de"}),fe.jsx("span",{className:"text-sm font-medium",children:t})]}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(e+1),disabled:e===t,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronRight,{size:16})}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(t),disabled:e===t,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronsRight,{size:16})})]})]})}function Vr({manager:e}){return fe.jsx($r,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const qr=({selectedCount:e,onClearSelection:t,onBulkDelete:n,customActions:r=[],isLoading:a=!1})=>fe.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-4 py-2 bg-primary/10 border-b border-primary/20",children:[fe.jsxs("div",{className:"flex items-center gap-3",children:[fe.jsxs("span",{className:"text-sm font-medium",children:[e," ",1===e?"item selecionado":"itens selecionados"]}),fe.jsxs(xe,{variant:"ghost",size:"sm",onClick:t,className:"h-7 px-2",children:[fe.jsx(i.X,{size:14,className:"mr-1"}),"Limpar"]})]}),fe.jsxs("div",{className:"flex items-center gap-2",children:[r.map((e,t)=>{const n=e.icon;return fe.jsxs(xe,{variant:e.variant||"outline",size:"sm",onClick:()=>e.action([]),disabled:a,className:"h-7",children:[n&&fe.jsx(n,{size:14,className:"mr-1"}),e.label]},t)}),n&&fe.jsxs(xe,{variant:"destructive",size:"sm",onClick:n,disabled:a,className:"h-7",children:[fe.jsx(i.Trash2,{size:14,className:"mr-1"}),"Remover"]})]})]}),Hr={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Wr={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Qr={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Kr({children:e,direction:t="column",gap:n="md",align:r="stretch",justify:a="start",wrap:s=!1,className:o}){return fe.jsx("div",{className:pe("flex","column"===t?"flex-col":"flex-row",Hr[n],Wr[r],Qr[a],s&&"flex-wrap",o),children:e})}function Xr({manager:e,filters:t,inline:n=!1}){const{isSearchVisible:r}=zn(),a=e.searchTerm,s=fe.jsxs(fe.Fragment,{children:[t.some(e=>"search"===e.type)&&!r&&fe.jsxs("div",{className:"relative flex-1",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),fe.jsx(ye,{placeholder:"Buscar...",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),t.filter(e=>"select"===e.type&&e.options).map((e,t)=>fe.jsxs("select",{value:e.value||"",onChange:t=>e.onChange?.(t.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm 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",children:[e.placeholder&&fe.jsx("option",{value:"",children:e.placeholder}),e.options.map(e=>fe.jsx("option",{value:e.value,children:e.label},e.value))]},`select-${t}`)),t.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return fe.jsx("div",{className:n?"":"w-full sm:w-auto",children:fe.jsx(r,{...e.props})},`custom-${t}`)}),a&&fe.jsxs(xe,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[fe.jsx(i.X,{className:"h-4 w-4 mr-2"}),"Limpar Filtros"]})]});return n?fe.jsx("div",{className:"flex items-center gap-2",children:s}):fe.jsx(Kr,{direction:"column",gap:"md",className:"mb-6",children:fe.jsx(Kr,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:s})})}function Gr({manager:t,config:n,formSections:r,onSave:a,onToggleStatus:s,defaultSort:o}){t&&t.queryKey;const{setSearchVisible:l}=zn(),[c,u]=x.useSearchParams(),[d,f]=e.useState(!1),[m,p]=e.useState(null),[h,g]=e.useState({isOpen:!1,entityId:null,entityName:""}),[b,y]=e.useState({isOpen:!1,count:0});e.useEffect(()=>(l(!0),()=>{l(!1)}),[l]),e.useEffect(()=>{if(o&&t){const e=`${t.queryKey}_sortField`,n=`${t.queryKey}_sortDirection`;c.has(e)||c.has(n)||(t.handleSort(o.column),"desc"===o.direction&&setTimeout(()=>t.handleSort(o.column),0))}},[]);return fe.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[n.enableBulkActions&&t.selectedIds.length>0&&fe.jsx(qr,{selectedCount:t.selectedIds.length,onClearSelection:t.clearSelection,onBulkDelete:n.bulkActions&&n.bulkActions.length>0?void 0:()=>{y({isOpen:!0,count:t.selectedIds.length})},customActions:n.bulkActions,isLoading:t.isBulkDeleting}),fe.jsxs("div",{className:"flex-shrink-0 flex justify-between items-center px-4 py-1.5 bg-muted/50 border-b gap-4",children:[fe.jsxs("div",{className:"flex items-center gap-2",children:[fe.jsxs(xe,{onClick:()=>{n.onNew?n.onNew():(p(null),f(!0))},children:[fe.jsx(i.Plus,{size:16,className:"mr-2"}),"Novo"]}),n.customActions?.map((e,t)=>fe.jsxs(xe,{onClick:e.action,variant:e.variant||"outline",children:[e.icon&&fe.jsx(e.icon,{size:16,className:"mr-2"}),e.label]},t))]}),n.filters&&n.filters.length>0&&fe.jsx("div",{className:"flex items-center gap-2 flex-1 justify-end",children:fe.jsx(Xr,{manager:t,filters:n.filters,inline:!0})})]}),fe.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:n.customListView?fe.jsx("div",{className:"flex-1 overflow-auto p-4",children:n.customListView(t.entities,t)}):fe.jsx(Pr,{manager:t,columns:n.columns,onEdit:e=>{n.onEdit?n.onEdit(e):(p(e),f(!0))},onDelete:e=>{g({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})},onToggleStatus:s,enableBulkActions:n.enableBulkActions,customRowActions:n.customRowActions})}),fe.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:fe.jsx(Vr,{manager:t})}),!n.useCustomRouting&&fe.jsx(Ur,{open:d,title:m?`Editar ${n.entityName}`:`Novo ${n.entityName}`,sections:r,initialData:m||void 0,onSubmit:e=>{a(e),f(!1),p(null)},onCancel:()=>{f(!1),p(null)},isLoading:t.isLoading,submitButtonText:m?"Atualizar":"Criar"}),fe.jsx(Jn,{open:h.isOpen,onOpenChange:()=>{g({isOpen:!1,entityId:null,entityName:""})},onConfirm:e=>{h.entityId&&(t.deleteEntity(h.entityId),g({isOpen:!1,entityId:null,entityName:""}))},item:h.entityId?{id:h.entityId,title:h.entityName}:void 0,entityName:n.entityName,isDeleting:t.isDeleting}),fe.jsx(Jn,{open:b.isOpen,onOpenChange:()=>y({isOpen:!1,count:0}),onConfirm:()=>(t.bulkDelete?.(t.selectedIds),void y({isOpen:!1,count:0})),item:{id:"bulk",title:`${b.count} ${1===b.count?n.entityName:n.entityNamePlural}`},entityName:n.entityNamePlural,isDeleting:t.isBulkDeleting,isBulk:!0,bulkCount:b.count})]})}function Yr(e,t,n={}){const r=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const n=t[e],a={key:e,header:Zr(e),label:Zr(e),...Jr(e,n),sortable:!0,searchable:"string"==typeof n};r.push(a)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...n}}function Jr(e,t){const n=e.toLowerCase();return n.includes("email")?{type:"email",required:!0}:n.includes("phone")||n.includes("tel")?{type:"tel"}:n.includes("description")||n.includes("content")||n.includes("notes")?{type:"textarea"}:n.includes("status")||n.includes("type")||n.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function Zr(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const ea={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}};const ta=n.cva("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"}}),na=L.forwardRef(({className:e,variant:t,...n},r)=>fe.jsx("div",{ref:r,role:"alert",className:pe(ta({variant:t}),e),...n}));na.displayName="Alert";const ra=L.forwardRef(({className:e,...t},n)=>fe.jsx("h5",{ref:n,className:pe("mb-1 font-medium leading-none tracking-tight",e),...t}));ra.displayName="AlertTitle";const aa=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("text-sm [&_p]:leading-relaxed",e),...t}));aa.displayName="AlertDescription";const sa=e.createContext(void 0);function oa({children:t}){const[n,r]=e.useState({});return fe.jsx(sa.Provider,{value:{metadata:n,setMetadata:r,clearMetadata:()=>r({})},children:t})}function ia(){const t=e.useContext(sa);if(!t)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return t}const la=W.Root,ca=L.forwardRef(({className:e,...t},n)=>fe.jsx(W.Item,{ref:n,className:pe("border-b",e),...t}));ca.displayName="AccordionItem";const ua=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsx(W.Header,{className:"flex",children:fe.jsxs(W.Trigger,{ref:r,className:pe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,fe.jsx(i.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ua.displayName=W.Trigger.displayName;const da=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsx(W.Content,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:fe.jsx("div",{className:pe("pb-4 pt-0",e),children:t})}));da.displayName=W.Content.displayName;const fa=Q.Root,ma=L.forwardRef(({className:e,...t},n)=>fe.jsx(K.Root,{ref:n,className:pe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ma.displayName=K.Root.displayName;const pa=L.forwardRef(({className:e,...t},n)=>fe.jsx(K.Image,{ref:n,className:pe("aspect-square h-full w-full",e),...t}));pa.displayName=K.Image.displayName;const ha=L.forwardRef(({className:e,...t},n)=>fe.jsx(K.Fallback,{ref:n,className:pe("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ha.displayName=K.Fallback.displayName;const ga=L.forwardRef(({...e},t)=>fe.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));ga.displayName="Breadcrumb";const xa=L.forwardRef(({className:e,...t},n)=>fe.jsx("ol",{ref:n,className:pe("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 ba=L.forwardRef(({className:e,...t},n)=>fe.jsx("li",{ref:n,className:pe("inline-flex items-center gap-1.5",e),...t}));ba.displayName="BreadcrumbItem";const ya=L.forwardRef(({asChild:e,className:t,...n},r)=>{const a=e?L.Fragment:"a";return fe.jsx(a,{ref:r,className:pe("transition-colors hover:text-foreground",t),...n})});ya.displayName="BreadcrumbLink";const va=L.forwardRef(({className:e,...t},n)=>fe.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:pe("font-normal text-foreground",e),...t}));va.displayName="BreadcrumbPage";const wa=({children:e,className:t,...n})=>fe.jsx("li",{role:"presentation","aria-hidden":"true",className:pe("[&>svg]:size-3.5",t),...n,children:e??fe.jsx(i.ChevronRight,{})});wa.displayName="BreadcrumbSeparator";const ka=({className:e,...t})=>fe.jsxs("span",{role:"presentation","aria-hidden":"true",className:pe("flex h-9 w-9 items-center justify-center",e),...t,children:[fe.jsx(i.MoreHorizontal,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"More"})]});function Na(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function ja(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,a=n?.width?String(n.width):t;r=e.formattingValues[a]||e.formattingValues[t]}else{const t=e.defaultWidth,a=n?.width?String(n.width):e.defaultWidth;r=e.values[a]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function Ca(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;const o=s[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(i,e=>e.test(o)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(i,e=>e.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;return{value:c,rest:t.slice(o.length)}}}ka.displayName="BreadcrumbEllipsis";const Sa={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:Na({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:Na({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Na({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ia={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"},Pa={ordinalNumber:(e,t)=>{const n=Number(e);return"week"===t?.unit?n+"ª":n+"º"},era:ja({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:ja({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:ja({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:ja({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:ja({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"})},Ea={ordinalNumber:(Aa={matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(Aa.matchPattern);if(!n)return null;const r=n[0],a=e.match(Aa.parsePattern);if(!a)return null;let s=Aa.valueCallback?Aa.valueCallback(a[0]):a[0];return s=t.valueCallback?t.valueCallback(s):s,{value:s,rest:e.slice(r.length)}}),era:Ca({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:Ca({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:Ca({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:Ca({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:Ca({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"})};var Aa;const Da={code:"pt-BR",formatDistance:(e,t,n)=>{let r;const a=Sa[e];return r="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?"em "+r:"há "+r:r},formatLong:Ta,formatRelative:(e,t,n,r)=>{const a=Ia[e];return"function"==typeof a?a(t):a},localize:Pa,match:Ea,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ra({className:e,classNames:t,showOutsideDays:n=!0,...r}){return fe.jsx(j.DayPicker,{showOutsideDays:n,className:pe("p-3",e),locale:Da,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:pe(ge({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:pe(ge({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})=>fe.jsx(i.ChevronLeft,{className:"h-4 w-4"}),IconRight:({...e})=>fe.jsx(i.ChevronRight,{className:"h-4 w-4"})},...r})}Ra.displayName="Calendar";const Fa=X.Root,_a=X.CollapsibleTrigger,La=X.CollapsibleContent;const Ma={Root:function({children:e,className:t}){return fe.jsx("div",{className:pe("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:n}){return fe.jsx(ke,{className:pe("transition-colors",t&&"cursor-pointer hover:bg-muted/50",n),onClick:t,children:fe.jsx(Se,{className:"p-4",children:e})})},Field:function({label:e,value:t,className:n}){return fe.jsxs("div",{className:pe("flex justify-between items-center text-sm",n),children:[fe.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),fe.jsx("span",{className:"text-foreground",children:t})]})}};const Oa={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))]"},za={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function Ba({children:e,cols:t="auto-fit",gap:n="md",className:r}){return fe.jsx("div",{className:pe("grid",Oa[t],za[n],r),children:e})}const Ua=({className:e,...t})=>fe.jsx("nav",{role:"navigation","aria-label":"pagination",className:pe("mx-auto flex w-full justify-center",e),...t});Ua.displayName="Pagination";const $a=L.forwardRef(({className:e,...t},n)=>fe.jsx("ul",{ref:n,className:pe("flex flex-row items-center gap-1",e),...t}));$a.displayName="PaginationContent";const Va=L.forwardRef(({className:e,...t},n)=>fe.jsx("li",{ref:n,className:pe("",e),...t}));Va.displayName="PaginationItem";const qa=({className:e,isActive:t,size:n="icon",...r})=>fe.jsx("a",{"aria-current":t?"page":void 0,className:pe(ge({variant:t?"outline":"ghost",size:n}),e),...r});qa.displayName="PaginationLink";const Ha=({className:e,...t})=>fe.jsxs(qa,{"aria-label":"Go to previous page",size:"default",className:pe("gap-1 pl-2.5",e),...t,children:[fe.jsx(i.ChevronLeft,{className:"h-4 w-4"}),fe.jsx("span",{children:"Previous"})]});Ha.displayName="PaginationPrevious";const Wa=({className:e,...t})=>fe.jsxs(qa,{"aria-label":"Go to next page",size:"default",className:pe("gap-1 pr-2.5",e),...t,children:[fe.jsx("span",{children:"Next"}),fe.jsx(i.ChevronRight,{className:"h-4 w-4"})]});Wa.displayName="PaginationNext";const Qa=({className:e,...t})=>fe.jsxs("span",{"aria-hidden":!0,className:pe("flex h-9 w-9 items-center justify-center",e),...t,children:[fe.jsx(i.MoreHorizontal,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"More pages"})]});Qa.displayName="PaginationEllipsis";const Ka=L.forwardRef(({className:e,value:t,...n},r)=>fe.jsx(G.Root,{ref:r,className:pe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:fe.jsx(G.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ka.displayName=G.Root.displayName;const Xa=L.forwardRef(({className:e,...t},n)=>fe.jsx(Y.Root,{className:pe("grid gap-2",e),...t,ref:n}));Xa.displayName=Y.Root.displayName;const Ga=L.forwardRef(({className:e,...t},n)=>fe.jsx(Y.Item,{ref:n,className:pe("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:fe.jsx(Y.Indicator,{className:"flex items-center justify-center",children:fe.jsx(i.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ga.displayName=Y.Item.displayName;const Ya=L.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>fe.jsx(J.Root,{ref:a,decorative:n,orientation:t,className:pe("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Ya.displayName=J.Root.displayName;const Ja=O.Root,Za=O.Trigger,es=O.Close,ts=O.Portal,ns=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Overlay,{className:pe("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:n}));ns.displayName=O.Overlay.displayName;const rs=n.cva("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"}}),as=L.forwardRef(({side:e="right",className:t,children:n,...r},a)=>fe.jsxs(ts,{children:[fe.jsx(ns,{}),fe.jsxs(O.Content,{ref:a,className:pe(rs({side:e}),t),...r,children:[n,fe.jsxs(O.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:[fe.jsx(i.X,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));as.displayName=O.Content.displayName;const ss=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col space-y-2 text-center sm:text-left",e),...t});ss.displayName="SheetHeader";const os=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});os.displayName="SheetFooter";const is=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Title,{ref:n,className:pe("text-lg font-semibold text-foreground",e),...t}));is.displayName=O.Title.displayName;const ls=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Description,{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));ls.displayName=O.Description.displayName;const cs=Z.Provider,us=Z.Root,ds=Z.Trigger,fs=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>fe.jsx(Z.Content,{ref:r,sideOffset:t,className:pe("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),...n}));fs.displayName=Z.Content.displayName;const ms="sidebar:state",ps=L.createContext(null);function hs(){const e=L.useContext(ps);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const gs=L.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:a,children:s,...o},i)=>{const[l,c]=L.useState(!1);L.useEffect(()=>{const e=()=>c(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const[u,d]=L.useState(!1),[f,m]=L.useState(()=>{if("undefined"!=typeof window){const t=localStorage.getItem(ms);return null!==t?"true"===t:e}return e}),p=t??f,h=L.useCallback(e=>{const t="function"==typeof e?e(p):e;n?n(t):m(t),"undefined"!=typeof window&&localStorage.setItem(ms,String(t))},[n,p]),g=L.useCallback(()=>l?d(e=>!e):h(e=>!e),[l,h,d]);L.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 x=p?"expanded":"collapsed",b=L.useMemo(()=>({state:x,open:p,setOpen:h,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:g}),[x,p,h,l,u,d,g]);return fe.jsx(ps.Provider,{value:b,children:fe.jsx(cs,{delayDuration:0,children:fe.jsx("div",{className:pe("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",r),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4.5rem",...a},ref:i,...o,children:s})})})});gs.displayName="SidebarProvider";const xs=L.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:a,...s},o)=>{const{isMobile:i,state:l,openMobile:c,setOpenMobile:u}=hs();return"none"===n?fe.jsx("div",{className:pe("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:o,...s,children:a}):i?fe.jsx(Ja,{open:c,onOpenChange:u,...s,children:fe.jsxs(as,{"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:[fe.jsx(is,{className:"sr-only",children:"Menu de Navegação"}),fe.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):fe.jsxs("div",{ref:o,className:"group peer hidden md:block text-sidebar-foreground","data-state":l,"data-collapsible":"collapsed"===l?n:"","data-variant":t,"data-side":e,children:[fe.jsx("div",{className:pe("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]")}),fe.jsx("div",{className:pe("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",r),...s,children:fe.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:a})})]})});xs.displayName="Sidebar";const bs=L.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:a}=hs();return fe.jsxs(xe,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:pe("h-7 w-7",e),onClick:e=>{t?.(e),a()},...n,children:[fe.jsx(i.PanelLeft,{}),fe.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});bs.displayName="SidebarTrigger";const ys=L.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=hs();return fe.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:pe("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})});ys.displayName="SidebarRail";const vs=L.forwardRef(({className:e,...t},n)=>fe.jsx("main",{ref:n,className:pe("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}));vs.displayName="SidebarInset";const ws=L.forwardRef(({className:e,...t},n)=>fe.jsx(ye,{ref:n,"data-sidebar":"input",className:pe("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));ws.displayName="SidebarInput";const ks=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"header",className:pe("flex flex-col gap-2 p-2",e),...t}));ks.displayName="SidebarHeader";const Ns=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"footer",className:pe("flex flex-col gap-2 p-2",e),...t}));Ns.displayName="SidebarFooter";const js=L.forwardRef(({className:e,...t},n)=>fe.jsx(Ya,{ref:n,"data-sidebar":"separator",className:pe("mx-2 w-auto bg-sidebar-border",e),...t}));js.displayName="SidebarSeparator";const Cs=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"content",className:pe("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));Cs.displayName="SidebarContent";const Ss=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"group",className:pe("relative flex w-full min-w-0 flex-col p-2",e),...t}));Ss.displayName="SidebarGroup";const Ts=L.forwardRef(({className:e,asChild:n=!1,...r},a)=>{const s=n?t.Slot:"div";return fe.jsx(s,{ref:a,"data-sidebar":"group-label",className:pe("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})});Ts.displayName="SidebarGroupLabel";const Is=L.forwardRef(({className:e,asChild:n=!1,...r},a)=>{const s=n?t.Slot:"button";return fe.jsx(s,{ref:a,"data-sidebar":"group-action",className:pe("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})});Is.displayName="SidebarGroupAction";const Ps=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"group-content",className:pe("w-full text-sm",e),...t}));Ps.displayName="SidebarGroupContent";const Es=L.forwardRef(({className:e,...t},n)=>fe.jsx("ul",{ref:n,"data-sidebar":"menu",className:pe("flex w-full min-w-0 flex-col gap-1",e),...t}));Es.displayName="SidebarMenu";const As=L.forwardRef(({className:e,...t},n)=>fe.jsx("li",{ref:n,"data-sidebar":"menu-item",className:pe("group/menu-item relative",e),...t}));As.displayName="SidebarMenuItem";const Ds=n.cva("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"}}),Rs=L.forwardRef(({asChild:e=!1,isActive:n=!1,variant:r="default",size:a="default",tooltip:s,className:o,...i},l)=>{const c=e?t.Slot:"button",{isMobile:u,state:d}=hs(),f=fe.jsx(c,{ref:l,"data-sidebar":"menu-button","data-size":a,"data-active":n,className:pe(Ds({variant:r,size:a}),o),...i});return s?("string"==typeof s&&(s={children:s}),fe.jsxs(us,{children:[fe.jsx(ds,{asChild:!0,children:f}),fe.jsx(fs,{side:"right",align:"center",hidden:"collapsed"!==d||u,...s})]})):f});Rs.displayName="SidebarMenuButton";const Fs=L.forwardRef(({className:e,asChild:n=!1,showOnHover:r=!1,...a},s)=>{const o=n?t.Slot:"button";return fe.jsx(o,{ref:s,"data-sidebar":"menu-action",className:pe("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),...a})});Fs.displayName="SidebarMenuAction";const _s=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:pe("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}));_s.displayName="SidebarMenuBadge";const Ls=L.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const a=L.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return fe.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:pe("rounded-md h-8 flex gap-2 px-2 items-center",e),...n,children:[t&&fe.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),fe.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":a}})]})});Ls.displayName="SidebarMenuSkeleton";const Ms=L.forwardRef(({className:e,...t},n)=>fe.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:pe("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}));Ms.displayName="SidebarMenuSub";const Os=L.forwardRef(({...e},t)=>fe.jsx("li",{ref:t,...e}));Os.displayName="SidebarMenuSubItem";const zs=L.forwardRef(({asChild:e=!1,size:n="md",isActive:r,className:a,...s},o)=>{const i=e?t.Slot:"a";return fe.jsx(i,{ref:o,"data-sidebar":"menu-sub-button","data-size":n,"data-active":r,className:pe("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"===n&&"text-xs","md"===n&&"text-sm","group-data-[collapsible=icon]:hidden",a),...s})});zs.displayName="SidebarMenuSubButton";const Bs=L.forwardRef(({className:e,...t},n)=>fe.jsxs(ee.Root,{ref:n,className:pe("relative flex w-full touch-none select-none items-center",e),...t,children:[fe.jsx(ee.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:fe.jsx(ee.Range,{className:"absolute h-full bg-primary"})}),fe.jsx(ee.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"})]}));Bs.displayName=ee.Root.displayName;function Us(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function $s(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Vs(...e){return L.useCallback(function(...e){return t=>{let n=!1;const r=e.map(e=>{const r=$s(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():$s(e[t],null)}}}}(...e),e)}function qs(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Hs=globalThis?.document?L.useLayoutEffect:()=>{},Ws=L[" useInsertionEffect ".trim().toString()]||Hs;function Qs({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,o]=function({defaultProp:e,onChange:t}){const[n,r]=L.useState(e),a=L.useRef(n),s=L.useRef(t);return Ws(()=>{s.current=t},[t]),L.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}({defaultProp:t,onChange:n}),i=void 0!==e,l=i?e:a;{const t=L.useRef(void 0!==e);L.useEffect(()=>{const e=t.current;if(e!==i){}t.current=i},[i,r])}const c=L.useCallback(t=>{if(i){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&o.current?.(n)}else s(t)},[i,e,s,o]);return[l,c]}var Ks=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=t.createSlot(`Primitive.${n}`),a=L.forwardRef((e,t)=>{const{asChild:a,...s}=e,o=a?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),fe.jsx(o,{...s,ref:t})});return a.displayName=`Primitive.${n}`,{...e,[n]:a}},{}),Xs="Switch",[Gs]=function(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>L.createContext(e));return function(n){const r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const a=L.createContext(r),s=n.length;n=[...n,r];const o=t=>{const{scope:n,children:r,...o}=t,i=n?.[e]?.[s]||a,l=L.useMemo(()=>o,Object.values(o));return fe.jsx(i.Provider,{value:l,children:r})};return o.displayName=t+"Provider",[o,function(n,o){const i=o?.[e]?.[s]||a,l=L.useContext(i);if(l)return l;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},qs(r,...t)]}(Xs),[Ys,Js]=Gs(Xs),Zs=L.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:s,required:o,disabled:i,value:l="on",onCheckedChange:c,form:u,...d}=e,[f,m]=L.useState(null),p=Vs(t,e=>m(e)),h=L.useRef(!1),g=!f||(u||!!f.closest("form")),[x,b]=Qs({prop:a,defaultProp:s??!1,onChange:c,caller:Xs});return fe.jsxs(Ys,{scope:n,checked:x,disabled:i,children:[fe.jsx(Ks.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":ro(x),"data-disabled":i?"":void 0,disabled:i,value:l,...d,ref:p,onClick:Us(e.onClick,e=>{b(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&fe.jsx(no,{control:f,bubbles:!h.current,name:r,value:l,checked:x,required:o,disabled:i,form:u,style:{transform:"translateX(-100%)"}})]})});Zs.displayName=Xs;var eo="SwitchThumb",to=L.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Js(eo,n);return fe.jsx(Ks.span,{"data-state":ro(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});to.displayName=eo;var no=L.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},s)=>{const o=L.useRef(null),i=Vs(o,s),l=function(e){const t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}(n),c=function(e){const[t,n]=L.useState(void 0);return Hs(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let a,s;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(t);return L.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==n&&a){const t=new Event("click",{bubbles:r});a.call(e,n),e.dispatchEvent(t)}},[l,n,r]),fe.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ro(e){return e?"checked":"unchecked"}no.displayName="SwitchBubbleInput";var ao=Zs,so=to;const oo=L.forwardRef(({className:e,...t},n)=>fe.jsx(ao,{className:pe("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:n,children:fe.jsx(so,{className:pe("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")})}));oo.displayName=ao.displayName;const io=te.Root,lo=L.forwardRef(({className:e,...t},n)=>fe.jsx(te.List,{ref:n,className:pe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));lo.displayName=te.List.displayName;const co=L.forwardRef(({className:e,...t},n)=>fe.jsx(te.Trigger,{ref:n,className:pe("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}));co.displayName=te.Trigger.displayName;const uo=L.forwardRef(({className:e,...t},n)=>fe.jsx(te.Content,{ref:n,className:pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));uo.displayName=te.Content.displayName;const fo=n.cva("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"}}),mo=L.forwardRef(({className:e,variant:t,size:n,...r},a)=>fe.jsx(ne.Root,{ref:a,className:pe(fo({variant:t,size:n,className:e})),...r}));mo.displayName=ne.Root.displayName;const po=L.createContext({size:"default",variant:"default"}),ho=L.forwardRef(({className:e,variant:t,size:n,children:r,...a},s)=>fe.jsx(re.Root,{ref:s,className:pe("flex items-center justify-center gap-1",e),...a,children:fe.jsx(po.Provider,{value:{variant:t,size:n},children:r})}));ho.displayName=re.Root.displayName;const go=L.forwardRef(({className:e,children:t,variant:n,size:r,...a},s)=>{const o=L.useContext(po);return fe.jsx(re.Item,{ref:s,className:pe(fo({variant:o.variant||n,size:o.size||r}),e),...a,children:t})});function xo({onEdit:e,onDelete:t,onToggleStatus:n,isActive:r=!0,canEdit:a=!0,canDelete:s=!0,customActions:o=[],renderAs:l="dropdown",variant:c="default"}){const u=[];return e&&a&&u.push({icon:i.Edit,label:"Editar",onClick:e,variant:"default"}),n&&u.push({icon:r?i.PowerOff:i.Power,label:r?"Inativar":"Ativar",onClick:n,variant:"default"}),o.forEach(e=>{!1!==e.show&&u.push({icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default"})}),t&&s&&u.push({icon:i.Trash2,label:"Remover",onClick:t,variant:"destructive"}),0===u.length?null:"dropdown"===l?fe.jsxs(dr,{children:[fe.jsx(fr,{asChild:!0,children:fe.jsx(xe,{variant:"ghost",size:"compact"===c?"sm":"default",className:"compact"===c?"h-7 px-2":"",children:fe.jsx(i.EllipsisVertical,{size:"compact"===c?14:16})})}),fe.jsx(yr,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:u.map((e,t)=>fe.jsxs(vr,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&fe.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},t))})]}):fe.jsx("div",{className:"flex items-center gap-1",children:u.map((e,t)=>fe.jsxs(xe,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===c?"sm":"default",onClick:e.onClick,className:"compact"===c?"h-7 px-2":"",children:[e.icon&&fe.jsx(e.icon,{size:"compact"===c?14:16}),"compact"!==c&&fe.jsx("span",{className:"ml-1",children:e.label})]},t))})}function bo(e){const t=x.useNavigate();return{onNew:()=>{const n=e.newPath||`${e.basePath}/new`;t(n)},onEdit:n=>{const r=e.editPath?e.editPath.replace(":id",n.id):`${e.basePath}/${n.id}/edit`;t(r)}}}go.displayName=re.Item.displayName;const yo=e.memo(({variant:t="card",className:n="",selectedUnit:r,onUnitChange:a})=>{const{user:s,companies:o,alias:l,isAuthenticated:c,logout:u,switchUnit:d}=zn(),f=o?.[0]||null,m=l?o?.find(e=>e.alias===l):f,p=o||[],h=r||m||f||f,g=e.useCallback(e=>{a?a(e):d(e)},[a,d]),x=e.useMemo(()=>{if(!p?.length)return[];const e=new Map;p.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),n=t.find(e=>e.alias===h?.alias),r=t.filter(e=>e.alias!==h?.alias);return r.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),n?[n,...r]:r},[p,h?.alias]);if(!c||!s)return null;const b=()=>fe.jsxs(fe.Fragment,{children:[fe.jsxs("div",{className:"flex items-center space-x-3",children:[fe.jsx("div",{className:"flex-shrink-0",children:fe.jsx("div",{className:"w-10 h-10 bg-primary rounded-full flex items-center justify-center",children:fe.jsx(i.User,{className:"h-5 w-5 text-primary-foreground"})})}),fe.jsxs("div",{className:"flex-1 min-w-0",children:[fe.jsx("p",{className:"text-sm font-medium truncate",children:s.name}),fe.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",h?.name||"N/A"]})]})]}),h&&fe.jsx("div",{className:"mt-3",children:fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsx(i.Building2,{className:"h-4 w-4 text-muted-foreground"}),fe.jsx("span",{className:"text-sm font-medium",children:h.name})]})}),x.length>1&&fe.jsxs("div",{className:"mt-2",children:[fe.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",x.length]}),fe.jsxs("div",{className:"flex flex-wrap gap-1",children:[x.slice(0,3).map(e=>fe.jsx(ot,{variant:e.alias===h?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>g(e),children:e.name},e.alias)),x.length>3&&fe.jsxs(ot,{variant:"outline",className:"text-xs",children:["+",x.length-3]})]})]})]});return"dropdown"===t?fe.jsxs(dr,{children:[fe.jsx(fr,{asChild:!0,children:fe.jsx(xe,{variant:"ghost",className:`h-auto p-2 ${n}`,children:fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsxs("div",{className:"hidden md:block text-left",children:[fe.jsx("p",{className:"text-sm font-medium",children:s.name}),fe.jsx("p",{className:"text-xs text-muted-foreground",children:h?.name||"N/A"})]}),fe.jsx("div",{className:"w-8 h-8 bg-primary rounded-full flex items-center justify-center",children:fe.jsx(i.User,{className:"h-4 w-4 text-primary-foreground"})}),fe.jsx(i.ChevronDown,{className:"h-4 w-4"})]})})}),fe.jsxs(yr,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[fe.jsxs(hr,{children:[fe.jsxs(xr,{children:[fe.jsx(i.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),fe.jsx(br,{children:x.map(e=>fe.jsxs(vr,{onClick:()=>g(e),className:e.alias===h?.alias?"bg-muted":"",children:[fe.jsx(i.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===h?.alias&&fe.jsx(ot,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),fe.jsx(jr,{}),fe.jsxs(vr,{onClick:u,children:[fe.jsx(i.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}):fe.jsxs(ke,{className:n,children:[fe.jsx(Ne,{children:fe.jsx(je,{className:"text-lg",children:"Informações do Usuário"})}),fe.jsxs(Se,{className:"space-y-4",children:[fe.jsx(b,{}),fe.jsx(Ya,{}),fe.jsxs(xe,{variant:"outline",onClick:u,size:"sm",className:"w-full",children:[fe.jsx(i.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),vo=e.createContext({});function wo({children:t,config:n}){const r=e.useMemo(()=>({navigation:n?.navigation,appName:n?.appName}),[n?.navigation,n?.appName]);return fe.jsx(vo.Provider,{value:r,children:t})}function ko(){return e.useContext(vo)}function No(){const e=x.useLocation(),{navigation:t}=ko();if(!t)return"Página";const n=t.find(t=>t.path===e.pathname);if(n)return n.label;const r=t.find(t=>e.pathname.startsWith(t.path+"/"));return r?.label||"Página"}function jo(t,n){const[r,a]=e.useState(t),s=e.useRef(),o=e.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=void 0)},[]);return e.useEffect(()=>(o(),s.current=setTimeout(()=>{a(t)},n),o),[t,n,o]),[r,o]}const Co=e.memo(function({actions:t}){const n=x.useLocation(),r=No(),{navigation:a,appName:s}=ko(),{metadata:o}=ia(),{companies:l,alias:c,isSearchVisible:u,clearSearch:d,refreshData:f,switchUnit:m}=zn(),p=c?l?.find(e=>e.alias===c)||l?.[0]||null:l?.[0]||null,[h,g]=x.useSearchParams(),[b,y]=e.useState(()=>h.get("search")||""),[v,w]=jo(b,bn.debounceDelay);e.useEffect(()=>{if(!u)return;const e=new URLSearchParams(h);v?(e.set("search",v),e.set("page","1")):e.delete("search"),g(e)},[v,g,u]);const k=a?.find(e=>e.path===n.pathname)||a?.find(e=>n.pathname.startsWith(e.path+"/")),N=o.title||r,j=o.subtitle||k?.complementaryText||"Detalhes do item";return fe.jsx("header",{className:"bg-white border-b border-gray-200 px-2 md:px-4 py-2",children:fe.jsxs("div",{className:"flex items-center gap-4",children:[fe.jsxs("div",{className:"flex-shrink-0",children:[fe.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[fe.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:N}),fe.jsx(ot,{variant:"default",className:"bg-primary hover:bg-primary/90 text-primary-foreground text-xs px-2 py-1",children:s||"Módulo"})]}),fe.jsx("p",{className:"text-sm text-muted-foreground truncate",children:j})]}),u&&fe.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[fe.jsxs("div",{className:"relative flex-1",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),fe.jsx(ye,{placeholder:"/wiki"===n.pathname?"Buscar artigos...":"Buscar...",value:b,onChange:e=>(e=>{y(e)})(e.target.value),className:"w-full pl-10 pr-8"}),b&&fe.jsx(xe,{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:()=>{w(),y("");const e=new URLSearchParams(h);e.delete("search"),e.delete("page"),g(e)},title:"Limpar busca",children:fe.jsx(i.X,{size:14})})]}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:f,className:"flex-shrink-0 h-10 w-10 p-0",title:"Atualizar dados",children:fe.jsx(i.RefreshCw,{size:14})})]}),fe.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[t&&fe.jsx("div",{className:"flex items-center gap-2",children:t}),(void 0).VITE_WIKI_URL&&fe.jsx(xe,{variant:"secondary",size:"sm",className:"h-8 px-3",onClick:e=>me((void 0).VITE_WIKI_URL,e),title:"Abrir Wiki",children:"Wiki"}),fe.jsx("div",{className:"text-sm",children:fe.jsx(yo,{variant:"dropdown",selectedUnit:p,onUnitChange:m})})]})]})})}),So=(e={})=>{const{enabled:t=!0}=e,{alias:n}=zn();return g.useQuery({queryKey:["active-modules",n],queryFn:async()=>{if(!n)return[];const e=an(),{data:t,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",n).eq("status","active").order("name");if(r){if(!un.handleError(r))throw r;return[]}return t||[]},enabled:t&&!!n})},To=({key:e,enabled:t,checkFn:n,staleTime:r=3e5,gcTime:a=6e5})=>g.useQuery({queryKey:["permission",e],queryFn:n,enabled:t,staleTime:r,gcTime:a,retry:0,refetchOnWindowFocus:!1}),Io=(void 0).VITE_SUPABASE_PROJECT_ID,Po={logo:`https://${Io}.supabase.co/storage/v1/object/public/library-assets/logo.svg`,smallLogo:`https://${Io}.supabase.co/storage/v1/object/public/library-assets/small.svg`},Eo=Po.logo,Ao=Po.smallLogo,Do="forlogic-sidebar-pinned",Ro=()=>{try{const e=localStorage.getItem(Do);return!!e&&JSON.parse(e)}catch{return!1}};function Fo({config:t}={}){const{state:n,open:r,setOpen:a}=hs(),s=x.useLocation(),{alias:o,user:l}=zn(),[c,u]=e.useState(!1),[d,f]=e.useState(Ro),[m,p]=e.useState(!1);e.useEffect(()=>{a(!!d||!(!m&&!c))},[d,m,c,a]);const{data:h,isLoading:g,error:b}=So({enabled:c}),y=e=>s.pathname===e||s.pathname.startsWith(e+"/"),v=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 fe.jsxs(xs,{collapsible:"icon",onMouseEnter:()=>{d||p(!0)},onMouseLeave:()=>{d||p(!1)},className:"app-sidebar transition-all duration-300 ease-in-out bg-white border-r border-gray-200 py-6 px-3",children:[fe.jsxs(ks,{className:"p-0 gap-0",children:[fe.jsx("div",{className:"flex items-center justify-between h-[34px]",children:r?fe.jsxs(fe.Fragment,{children:[fe.jsx("div",{className:"flex items-center pl-[12px]",children:fe.jsx("img",{src:Po.logo,alt:"Logo",className:"h-6 max-w-full object-contain"})}),fe.jsx("button",{onClick:()=>{const e=!d;f(e),(e=>{try{localStorage.setItem(Do,JSON.stringify(e))}catch{}})(e)},className:"h-8 w-8 flex items-center justify-center rounded-md transition-colors duration-200 "+(d?"bg-primary text-primary-foreground":"hover:bg-muted text-muted-foreground"),children:fe.jsx(i.PanelLeft,{className:"h-4 w-4"})})]}):fe.jsx("div",{className:"flex items-center justify-center w-full h-[34px]",children:fe.jsx("img",{src:Po.smallLogo,alt:"Logo",className:"h-[34px] w-[34px] object-contain"})})}),fe.jsx("div",{className:"mt-2 pt-0",children:fe.jsxs(dr,{onOpenChange:u,children:[fe.jsx(fr,{asChild:!0,children:r?fe.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:[fe.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[fe.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"}),fe.jsx("span",{className:"truncate group-data-[collapsible=icon]:hidden",children:t?.appName||"Título do módulo"})]}),fe.jsx(i.ChevronDown,{className:"h-6 w-6 flex-shrink-0 text-muted-foreground"})]}):fe.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:fe.jsx(i.ChevronDown,{className:"h-6 w-6 text-muted-foreground"})})}),fe.jsx(yr,{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:g?fe.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-muted-foreground",children:[fe.jsx(i.Loader2,{className:"h-4 w-4 animate-spin"}),fe.jsx("span",{className:"text-sm",children:"Carregando módulos..."})]}):b?fe.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-destructive",children:[fe.jsx(i.AlertCircle,{className:"h-4 w-4"}),fe.jsx("span",{className:"text-sm",children:"Erro ao carregar módulos"})]}):h&&0!==h.length?fe.jsx("div",{className:"space-y-2",children:h.map((e,t)=>fe.jsx("div",{onClick:()=>(e=>{const t=h?.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 ${v(t)} transition-colors duration-200\n `,children:fe.jsxs("div",{className:"flex items-center justify-between",children:[fe.jsx("span",{className:"font-medium text-foreground text-sm",children:e.name}),e.url&&fe.jsx(i.ExternalLink,{className:"h-4 w-4 text-muted-foreground"})]})},e.id))}):fe.jsx("div",{className:"py-3 px-3 text-muted-foreground text-sm",children:"Nenhum módulo disponível"})})]})})]}),fe.jsx(Cs,{children:fe.jsx(Ss,{className:"p-0 mt-6",children:fe.jsx(Ps,{children:fe.jsx(Es,{className:"space-y-2",children:fe.jsx(cs,{children:t?.navigation?.map((e,t)=>{const n=({item:e,index:t})=>{const n=`${e.path}-${t}-${o??"noalias"}-${l?.id??"nouser"}`,{data:r=!0,isLoading:a}=To({key:n,enabled:Boolean(e.permissionCheck&&o&&l?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),s=e.permissionCheck&&!r,c=a?i.Loader2:s?i.Lock:e.icon;return s||e.complementaryText,fe.jsx(As,{children:s||a?fe.jsxs(us,{children:[fe.jsx(ds,{asChild:!0,children:fe.jsx(Rs,{size:"lg",className:"h-10 opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:fe.jsxs("div",{className:"flex w-full items-center gap-3",children:[fe.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:fe.jsx(c,{className:"h-4 w-4 "+(a?"animate-spin":"")})}),fe.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label})]})})}),fe.jsx(fs,{children:fe.jsx("p",{children:a?"Verificando acesso...":"Acesso restrito"})})]}):fe.jsx(Rs,{asChild:!0,isActive:y(e.path),size:"lg",className:"h-10",children:fe.jsxs(x.Link,{to:e.path,className:"flex w-full items-center gap-3",children:[fe.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:fe.jsx(c,{className:"h-5 w-4"})}),fe.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label})]})})},e.path)};return fe.jsx(n,{item:e,index:t},e.path)})})})})})})]})}const _o=e.memo(function({children:t,sidebar:n,sidebarConfig:r,showHeader:a=!0}){const s=e.useMemo(()=>n||fe.jsx(Fo,{config:r}),[n,r]),o=e.useMemo(()=>({"--sidebar-width":"240px","--sidebar-width-icon":"58px"}),[]);return fe.jsx(wo,{config:r,children:fe.jsx(oa,{children:fe.jsx(gs,{defaultOpen:!1,style:o,children:fe.jsxs("div",{className:"min-h-screen flex w-full",children:[s,fe.jsxs("main",{className:"flex-1 flex flex-col h-screen overflow-hidden",children:[a&&fe.jsx("div",{className:"flex-shrink-0 sticky top-0 z-10 bg-background",children:fe.jsx(Co,{})}),fe.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50",children:t})]})]})})})})});var Lo=Object.defineProperty,Mo=(e,t,n)=>((e,t,n)=>t in e?Lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n);class Oo extends e.Component{constructor(e){super(e),Mo(this,"copyErrorDetails",()=>{const e=Yt.getErrors().slice(-2),t=`\n=== ERRO ATUAL ===\n${this.state.error?.message||"Erro desconhecido"}\n\nStack Trace:\n${this.state.error?.stack||"Não disponível"}\n\n=== ÚLTIMOS ERROS ===\n${e.map((e,t)=>`${t+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||"Nenhum erro registrado"}\n `.trim();navigator.clipboard.writeText(t),gt({title:"Detalhes copiados!",description:"Os detalhes do erro foram copiados para a área de transferência."})}),this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){Yt.handleError(e,!1),this.setState({errorInfo:t})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const e=Yt.getErrors().slice(-2);return fe.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:fe.jsxs(ke,{className:"w-full max-w-2xl",children:[fe.jsxs(Ne,{className:"text-center",children:[fe.jsx("div",{className:"flex justify-center mb-4",children:fe.jsx(i.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),fe.jsx(je,{children:"Algo deu errado"})]}),fe.jsxs(Se,{className:"space-y-4",children:[fe.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),fe.jsxs(Fa,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[fe.jsx(_a,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[fe.jsx(i.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),fe.jsxs(La,{className:"mt-4 space-y-4",children:[fe.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[fe.jsxs("div",{children:[fe.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),fe.jsxs("div",{className:"text-sm space-y-2",children:[fe.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||"Erro desconhecido"}),this.state.error?.stack&&fe.jsx(Rr,{className:"h-32 w-full rounded border bg-muted p-2",children:fe.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),e.length>0&&fe.jsxs("div",{className:"pt-3 border-t",children:[fe.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),fe.jsx("div",{className:"space-y-2",children:e.map((t,n)=>fe.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:fe.jsxs("div",{className:"flex items-start gap-2",children:[fe.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[e.length-n,"."]}),fe.jsxs("div",{className:"flex-1 min-w-0",children:[fe.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:fe.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(t.timestamp).toLocaleTimeString(),"]"]})}),fe.jsx("p",{className:"text-sm break-words",children:t.message})]})]})},t.id))})]})]}),fe.jsxs(xe,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[fe.jsx(i.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),fe.jsx(xe,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}class zo{static async sendEmail(e){const t=an(),{data:n,error:r}=await t.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return n}}const Bo=zo;function Uo(){const[t,n]=e.useState([]),[r,a]=e.useState(!1),[s,i]=e.useState(null),[l,c]=e.useState(null);e.useEffect(()=>{u()},[]);const u=async()=>{try{const e=an(),{data:t,error:r}=await e.functions.invoke("openai-chat",{body:{action:"createThread"}});if(r)throw r;i(t.threadId),n([{id:"initial",role:"assistant",content:"Olá! Como posso ajudá-lo hoje?",timestamp:new Date}])}catch(e){c("Erro ao inicializar conversa"),o.toast.error("Erro ao inicializar conversa")}},d=e.useCallback(async e=>{if(!s||!e.trim())return;const t={id:`user-${Date.now()}`,role:"user",content:e,timestamp:new Date};n(e=>[...e,t]),a(!0),c(null);try{const t=an(),{data:r,error:a}=await t.functions.invoke("openai-chat",{body:{action:"sendMessage",threadId:s,message:e}});if(a)throw a;const{runId:o}=r,i=await(async e=>{if(!s)return!1;for(let n=0;n<60;n++)try{const t=an(),{data:n,error:r}=await t.functions.invoke("openai-chat",{body:{action:"checkRunStatus",threadId:s,runId:e}});if(r)throw r;const{status:a}=n;if("completed"===a)return!0;if("failed"===a||"cancelled"===a)throw new Error("O assistente encontrou um erro");await new Promise(e=>setTimeout(e,1e3))}catch(t){throw t}throw new Error("Tempo limite excedido")})(o);i&&await(async()=>{if(s)try{const e=an(),{data:t,error:r}=await e.functions.invoke("openai-chat",{body:{action:"getMessages",threadId:s}});if(r)throw r;const a=t.messages.map(e=>({id:e.id,role:e.role,content:e.content,timestamp:new Date(1e3*e.created_at)}));n(a)}catch(e){throw e}})()}catch(r){const e=r instanceof Error?r.message:"Erro ao enviar mensagem";c(e),o.toast.error(e),n(e=>e.filter(e=>e.id!==t.id))}finally{a(!1)}},[s]);return{messages:t,isLoading:r,error:l,sendMessage:d,threadId:s}}function $o(){}function Vo(){}const qo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ho=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wo={};function Qo(e,t){return(Wo.jsx?Ho:qo).test(e)}const Ko=/[ \t\n\f\r]/g;function Xo(e){return""===e.replace(Ko,"")}class Go{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Yo(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Go(n,r,t)}function Jo(e){return e.toLowerCase()}Go.prototype.normal={},Go.prototype.property={},Go.prototype.space=void 0;class Zo{constructor(e,t){this.attribute=t,this.property=e}}Zo.prototype.attribute="",Zo.prototype.booleanish=!1,Zo.prototype.boolean=!1,Zo.prototype.commaOrSpaceSeparated=!1,Zo.prototype.commaSeparated=!1,Zo.prototype.defined=!1,Zo.prototype.mustUseProperty=!1,Zo.prototype.number=!1,Zo.prototype.overloadedBoolean=!1,Zo.prototype.property="",Zo.prototype.spaceSeparated=!1,Zo.prototype.space=void 0;let ei=0;const ti=li(),ni=li(),ri=li(),ai=li(),si=li(),oi=li(),ii=li();function li(){return 2**++ei}var ci=Object.freeze({__proto__:null,boolean:ti,booleanish:ni,commaOrSpaceSeparated:ii,commaSeparated:oi,number:ai,overloadedBoolean:ri,spaceSeparated:si});const ui=Object.keys(ci);class di extends Zo{constructor(e,t,n,r){let a=-1;if(super(e,t),fi(this,"space",r),"number"==typeof n)for(;++a<ui.length;){const e=ui[a];fi(this,ui[a],(n&ci[e])===ci[e])}}}function fi(e,t,n){n&&(e[t]=n)}function mi(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const s=new di(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Jo(r)]=r,n[Jo(s.attribute)]=r}return new Go(t,n,e.space)}di.prototype.defined=!0;const pi=mi({properties:{ariaActiveDescendant:null,ariaAtomic:ni,ariaAutoComplete:null,ariaBusy:ni,ariaChecked:ni,ariaColCount:ai,ariaColIndex:ai,ariaColSpan:ai,ariaControls:si,ariaCurrent:null,ariaDescribedBy:si,ariaDetails:null,ariaDisabled:ni,ariaDropEffect:si,ariaErrorMessage:null,ariaExpanded:ni,ariaFlowTo:si,ariaGrabbed:ni,ariaHasPopup:null,ariaHidden:ni,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:si,ariaLevel:ai,ariaLive:null,ariaModal:ni,ariaMultiLine:ni,ariaMultiSelectable:ni,ariaOrientation:null,ariaOwns:si,ariaPlaceholder:null,ariaPosInSet:ai,ariaPressed:ni,ariaReadOnly:ni,ariaRelevant:null,ariaRequired:ni,ariaRoleDescription:si,ariaRowCount:ai,ariaRowIndex:ai,ariaRowSpan:ai,ariaSelected:ni,ariaSetSize:ai,ariaSort:null,ariaValueMax:ai,ariaValueMin:ai,ariaValueNow:ai,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function hi(e,t){return t in e?e[t]:t}function gi(e,t){return hi(e,t.toLowerCase())}const xi=mi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oi,acceptCharset:si,accessKey:si,action:null,allow:null,allowFullScreen:ti,allowPaymentRequest:ti,allowUserMedia:ti,alt:null,as:null,async:ti,autoCapitalize:null,autoComplete:si,autoFocus:ti,autoPlay:ti,blocking:si,capture:null,charSet:null,checked:ti,cite:null,className:si,cols:ai,colSpan:null,content:null,contentEditable:ni,controls:ti,controlsList:si,coords:ai|oi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ti,defer:ti,dir:null,dirName:null,disabled:ti,download:ri,draggable:ni,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ti,formTarget:null,headers:si,height:ai,hidden:ri,high:ai,href:null,hrefLang:null,htmlFor:si,httpEquiv:si,id:null,imageSizes:null,imageSrcSet:null,inert:ti,inputMode:null,integrity:null,is:null,isMap:ti,itemId:null,itemProp:si,itemRef:si,itemScope:ti,itemType:si,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ti,low:ai,manifest:null,max:null,maxLength:ai,media:null,method:null,min:null,minLength:ai,multiple:ti,muted:ti,name:null,nonce:null,noModule:ti,noValidate:ti,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ti,optimum:ai,pattern:null,ping:si,placeholder:null,playsInline:ti,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ti,referrerPolicy:null,rel:si,required:ti,reversed:ti,rows:ai,rowSpan:ai,sandbox:si,scope:null,scoped:ti,seamless:ti,selected:ti,shadowRootClonable:ti,shadowRootDelegatesFocus:ti,shadowRootMode:null,shape:null,size:ai,sizes:null,slot:null,span:ai,spellCheck:ni,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ai,step:null,style:null,tabIndex:ai,target:null,title:null,translate:null,type:null,typeMustMatch:ti,useMap:null,value:ni,width:ai,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:si,axis:null,background:null,bgColor:null,border:ai,borderColor:null,bottomMargin:ai,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ti,declare:ti,event:null,face:null,frame:null,frameBorder:null,hSpace:ai,leftMargin:ai,link:null,longDesc:null,lowSrc:null,marginHeight:ai,marginWidth:ai,noResize:ti,noHref:ti,noShade:ti,noWrap:ti,object:null,profile:null,prompt:null,rev:null,rightMargin:ai,rules:null,scheme:null,scrolling:ni,standby:null,summary:null,text:null,topMargin:ai,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ai,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ti,disableRemotePlayback:ti,prefix:null,property:null,results:ai,security:null,unselectable:null},space:"html",transform:gi}),bi=mi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ii,accentHeight:ai,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ai,amplitude:ai,arabicForm:null,ascent:ai,attributeName:null,attributeType:null,azimuth:ai,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ai,by:null,calcMode:null,capHeight:ai,className:si,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ai,diffuseConstant:ai,direction:null,display:null,dur:null,divisor:ai,dominantBaseline:null,download:ti,dx:null,dy:null,edgeMode:null,editable:null,elevation:ai,enableBackground:null,end:null,event:null,exponent:ai,externalResourcesRequired:null,fill:null,fillOpacity:ai,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oi,g2:oi,glyphName:oi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ai,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ai,horizOriginX:ai,horizOriginY:ai,id:null,ideographic:ai,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ai,k:ai,k1:ai,k2:ai,k3:ai,k4:ai,kernelMatrix:ii,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ai,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ai,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ai,overlineThickness:ai,paintOrder:null,panose1:null,path:null,pathLength:ai,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:si,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ai,pointsAtY:ai,pointsAtZ:ai,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ii,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ii,rev:ii,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ii,requiredFeatures:ii,requiredFonts:ii,requiredFormats:ii,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ai,specularExponent:ai,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ai,strikethroughThickness:ai,string:null,stroke:null,strokeDashArray:ii,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ai,strokeOpacity:ai,strokeWidth:null,style:null,surfaceScale:ai,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ii,tabIndex:ai,tableValues:null,target:null,targetX:ai,targetY:ai,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ii,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ai,underlineThickness:ai,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ai,values:null,vAlphabetic:ai,vMathematical:ai,vectorEffect:null,vHanging:ai,vIdeographic:ai,version:null,vertAdvY:ai,vertOriginX:ai,vertOriginY:ai,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ai,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:hi}),yi=mi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),vi=mi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gi}),wi=mi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),ki={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ni=/[A-Z]/g,ji=/-[a-z]/g,Ci=/^data[-\w.:]+$/i;function Si(e){return"-"+e.toLowerCase()}function Ti(e){return e.charAt(1).toUpperCase()}const Ii=Yo([pi,xi,yi,vi,wi],"html"),Pi=Yo([pi,bi,yi,vi,wi],"svg");var Ei,Ai,Di,Ri={};function Fi(){if(Di)return Ri;Di=1;var e=Ri&&Ri.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.default=function(e,n){var r=null;if(!e||"string"!=typeof e)return r;var a=(0,t.default)(e),s="function"==typeof n;return a.forEach(function(e){if("declaration"===e.type){var t=e.property,a=e.value;s?n(t,a,e):a&&((r=r||{})[t]=a)}}),r};var t=e(function(){if(Ai)return Ei;Ai=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,i=/^\s+|\s+$/g,l="";function c(e){return e?e.replace(i,l):l}return Ei=function(i,u){if("string"!=typeof i)throw new TypeError("First argument must be a string");if(!i)return[];u=u||{};var d=1,f=1;function m(e){var n=e.match(t);n&&(d+=n.length);var r=e.lastIndexOf("\n");f=~r?e.length-r:f+e.length}function p(){var e={line:d,column:f};return function(t){return t.position=new h(e),b(),t}}function h(e){this.start=e,this.end={line:d,column:f},this.source=u.source}function g(e){var t=new Error(u.source+":"+d+":"+f+": "+e);if(t.reason=e,t.filename=u.source,t.line=d,t.column=f,t.source=i,!u.silent)throw t}function x(e){var t=e.exec(i);if(t){var n=t[0];return m(n),i=i.slice(n.length),t}}function b(){x(n)}function y(e){var t;for(e=e||[];t=v();)!1!==t&&e.push(t);return e}function v(){var e=p();if("/"==i.charAt(0)&&"*"==i.charAt(1)){for(var t=2;l!=i.charAt(t)&&("*"!=i.charAt(t)||"/"!=i.charAt(t+1));)++t;if(t+=2,l===i.charAt(t-1))return g("End of comment missing");var n=i.slice(2,t-2);return f+=2,m(n),i=i.slice(t),f+=2,e({type:"comment",comment:n})}}function w(){var t=p(),n=x(r);if(n){if(v(),!x(a))return g("property missing ':'");var i=x(s),u=t({type:"declaration",property:c(n[0].replace(e,l)),value:i?c(i[0].replace(e,l)):l});return x(o),u}}return h.prototype.content=i,b(),function(){var e,t=[];for(y(t);e=w();)!1!==e&&(t.push(e),y(t));return t}()},Ei}());return Ri}var _i,Li,Mi,Oi={};function zi(){if(_i)return Oi;_i=1,Object.defineProperty(Oi,"__esModule",{value:!0}),Oi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=function(e,t){return t.toUpperCase()},o=function(e,t){return"".concat(t,"-")};return Oi.camelCase=function(i,l){return void 0===l&&(l={}),function(t){return!t||n.test(t)||e.test(t)}(i)?i:(i=i.toLowerCase(),(i=l.reactCompat?i.replace(a,o):i.replace(r,o)).replace(t,s))},Oi}var Bi=function(){if(Mi)return Li;Mi=1;var e=(Li&&Li.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Fi()),t=zi();function n(n,r){var a={};return n&&"string"==typeof n?((0,e.default)(n,function(e,n){e&&n&&(a[(0,t.camelCase)(e,r)]=n)}),a):a}return n.default=n,Li=n}(),Ui=ae(Bi);const $i=qi("end"),Vi=qi("start");function qi(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Hi(e){return e&&"object"==typeof e?"position"in e||"type"in e?Qi(e.position):"start"in e||"end"in e?Qi(e):"line"in e||"column"in e?Wi(e):"":""}function Wi(e){return Ki(e&&e.line)+":"+Ki(e&&e.column)}function Qi(e){return Wi(e&&e.start)+"-"+Wi(e&&e.end)}function Ki(e){return e&&"number"==typeof e?e:1}class Xi extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",a={},s=!1;if(t&&(a="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!a.cause&&e&&(s=!0,r=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?a.ruleId=n:(a.source=n.slice(0,e),a.ruleId=n.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){const e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=Hi(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Xi.prototype.file="",Xi.prototype.name="",Xi.prototype.reason="",Xi.prototype.message="",Xi.prototype.stack="",Xi.prototype.column=void 0,Xi.prototype.line=void 0,Xi.prototype.ancestors=void 0,Xi.prototype.cause=void 0,Xi.prototype.fatal=void 0,Xi.prototype.place=void 0,Xi.prototype.ruleId=void 0,Xi.prototype.source=void 0;const Gi={}.hasOwnProperty,Yi=new Map,Ji=/[A-Z]/g,Zi=new Set(["table","tbody","thead","tfoot","tr"]),el=new Set(["td","th"]),tl="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function nl(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,a,s){const o=Array.isArray(a.children),i=Vi(n);return t(r,a,s,o,{columnNumber:i?i.column-1:void 0,fileName:e,lineNumber:i?i.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,a,s){const o=Array.isArray(a.children)?n:t;return s?o(r,a,s):o(r,a)}}(0,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?Pi:Ii,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},s=rl(a,e,void 0);return s&&"string"!=typeof s?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function rl(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let a=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(a=Pi,e.schema=a);e.ancestors.push(t);const s=ll(e,t.tagName,!1),o=function(e,t){const n={};let r,a;for(a in t.properties)if("children"!==a&&Gi.call(t.properties,a)){const s=il(e,a,t.properties[a]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&"align"===a&&"string"==typeof o&&el.has(t.tagName)?r=o:n[a]=o}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let i=ol(e,t);Zi.has(t.tagName)&&(i=i.filter(function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&Xo(t.value):Xo(t));var t}));return al(e,o,s,t),sl(o,i),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}cl(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let a=r;"svg"===t.name&&"html"===r.space&&(a=Pi,e.schema=a);e.ancestors.push(t);const s=null===t.name?e.Fragment:ll(e,t.name,!0),o=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];$o(t.type);const a=t.expression;$o(a.type);const s=a.properties[0];$o(s.type),Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else cl(e,t.position);else{const a=r.name;let s;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];$o(t.type),s=e.evaluater.evaluateExpression(t.expression)}else cl(e,t.position);else s=null===r.value||r.value;n[a]=s}return n}(e,t),i=ol(e,t);return al(e,o,s,t),sl(o,i),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);cl(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return sl(r,ol(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function al(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function sl(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ol(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:Yi;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const e="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(e){const t=a.get(e)||0;o=e+"-"+t,a.set(e,t+1)}}const i=rl(e,s,o);void 0!==i&&n.push(i)}return n}function il(e,t,n){const r=function(e,t){const n=Jo(t);let r=t,a=Zo;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Ci.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(ji,Ti);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!ji.test(e)){let n=e.replace(Ni,Si);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}a=di}return new a(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return Ui(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const t=n,r=new Xi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=tl+"#cannot-parse-style-attribute",r}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Gi.call(e,n)&&(t[ul(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?ki[r.property]||r.property:r.attribute,n]}}function ll(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,a=-1;for(;++a<e.length;){const t=Qo(e[a])?{type:"Identifier",name:e[a]}:{type:"Literal",value:e[a]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(a&&"Literal"===t.type),optional:!1}:t}r=n}else r=Qo(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Gi.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);cl(e)}function cl(e,t){const n=new Xi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=tl+"#cannot-handle-mdx-estrees-without-createevaluater",n}function ul(e){let t=e.replace(Ji,dl);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function dl(e){return"-"+e.toLowerCase()}const fl={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},ml={};function pl(e,t){return hl(e,"boolean"!=typeof ml.includeImageAlt||ml.includeImageAlt,"boolean"!=typeof ml.includeHtml||ml.includeHtml)}function hl(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return gl(e.children,t,n)}return Array.isArray(e)?gl(e,t,n):""}function gl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=hl(e[a],t,n);return r.join("")}const xl=document.createElement("i");function bl(e){const t="&"+e+";";xl.innerHTML=t;const n=xl.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function yl(e,t,n,r){const a=e.length;let s,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function vl(e,t){return e.length>0?(yl(e,e.length,0,t),e):t}const wl={}.hasOwnProperty;function kl(e){const t={};let n=-1;for(;++n<e.length;)Nl(t,e[n]);return t}function Nl(e,t){let n;for(n in t){const r=(wl.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){wl.call(r,s)||(r[s]=[]);const e=a[s];jl(r[s],Array.isArray(e)?e:e?[e]:[])}}}function jl(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);yl(e,0,0,r)}function Cl(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function Sl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Tl=zl(/[A-Za-z]/),Il=zl(/[\dA-Za-z]/),Pl=zl(/[#-'*+\--9=?A-Z^-~]/);function El(e){return null!==e&&(e<32||127===e)}const Al=zl(/\d/),Dl=zl(/[\dA-Fa-f]/),Rl=zl(/[!-/:-@[-`{-~]/);function Fl(e){return null!==e&&e<-2}function _l(e){return null!==e&&(e<0||32===e)}function Ll(e){return-2===e||-1===e||32===e}const Ml=zl(/\p{P}|\p{S}/u),Ol=zl(/\s/);function zl(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function Bl(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(37===s&&Il(e.charCodeAt(n+1))&&Il(e.charCodeAt(n+2)))a=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(o=String.fromCharCode(s,t),a=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Ul(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let s=0;return function(r){if(Ll(r))return e.enter(n),o(r);return t(r)};function o(r){return Ll(r)&&s++<a?(e.consume(r),o):(e.exit(n),t(r))}}const $l={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ul(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,a(t)}function a(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):Fl(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),a)}}};const Vl={tokenize:function(e){const t=this,n=[];let r,a,s,o=0;return i;function i(r){if(o<n.length){const a=n[o];return t.containerState=a[1],e.attempt(a[0].continuation,l,c)(r)}return c(r)}function l(e){if(o++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const n=t.events.length;let a,s=n;for(;s--;)if("exit"===t.events[s][0]&&"chunkFlow"===t.events[s][1].type){a=t.events[s][1].end;break}x(o);let i=n;for(;i<t.events.length;)t.events[i][1].end={...a},i++;return yl(t.events,s+1,0,t.events.slice(n)),t.events.length=i,c(e)}return i(e)}function c(a){if(o===n.length){if(!r)return f(a);if(r.currentConstruct&&r.currentConstruct.concrete)return p(a);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ql,u,d)(a)}function u(e){return r&&b(),x(o),f(e)}function d(e){return t.parser.lazy[t.now().line]=o!==n.length,s=t.now().offset,p(e)}function f(n){return t.containerState={},e.attempt(ql,m,p)(n)}function m(e){return o++,n.push([t.currentConstruct,t.containerState]),f(e)}function p(n){return null===n?(r&&b(),x(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:a}),h(n))}function h(n){return null===n?(g(e.exit("chunkFlow"),!0),x(0),void e.consume(n)):Fl(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,t.interrupt=void 0,i):(e.consume(n),h)}function g(e,n){const i=t.sliceStream(e);if(n&&i.push(null),e.previous=a,a&&(a.next=e),a=e,r.defineSkip(e.start),r.write(i),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<s&&(!r.events[e][1].end||r.events[e][1].end.offset>s))return;const n=t.events.length;let a,i,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(a){i=t.events[l][1].end;break}a=!0}for(x(o),e=n;e<t.events.length;)t.events[e][1].end={...i},e++;yl(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function x(r){let a=n.length;for(;a-- >r;){const r=n[a];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function b(){r.write([null]),a=void 0,r=void 0,t.containerState._closeFlow=void 0}}},ql={tokenize:function(e,t,n){return Ul(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Hl(e){return null===e||_l(e)||Ol(e)?1:Ml(e)?2:void 0}function Wl(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const s=e[a].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Ql={name:"attention",resolveAll:function(e,t){let n,r,a,s,o,i,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;i=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[n][1].end},f={...e[u][1].start};Kl(d,-i),Kl(f,i),s={type:i>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:i>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:f},a={type:i>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:i>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=vl(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=vl(l,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",a,t]]),l=vl(l,Wl(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=vl(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=vl(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,yl(e,n-1,u-n+3,l),u=n+l.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Hl(r);let s;return function(t){return s=t,e.enter("attentionSequence"),o(t)};function o(i){if(i===s)return e.consume(i),o;const l=e.exit("attentionSequence"),c=Hl(i),u=!c||2===c&&a||n.includes(i),d=!a||2===a&&c||n.includes(r);return l._open=Boolean(42===s?u:u&&(a||!d)),l._close=Boolean(42===s?d:d&&(c||!u)),t(i)}}};function Kl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Xl={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return Tl(t)?(e.consume(t),s):64===t?n(t):l(t)}function s(e){return 43===e||45===e||46===e||Il(e)?(r=1,o(e)):l(e)}function o(t){return 58===t?(e.consume(t),r=0,i):(43===t||45===t||46===t||Il(t))&&r++<32?(e.consume(t),o):(r=0,l(t))}function i(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||El(r)?n(r):(e.consume(r),i)}function l(t){return 64===t?(e.consume(t),c):Pl(t)?(e.consume(t),l):n(t)}function c(e){return Il(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||Il(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}};const Gl={partial:!0,tokenize:function(e,t,n){return function(t){return Ll(t)?Ul(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||Fl(e)?t(e):n(e)}}};const Yl={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(Ll(t))return Ul(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return a(t)};function a(r){return e.attempt(Yl,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return n(t)};function a(n){return Ll(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const Jl={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return Rl(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const Zl={name:"characterReference",tokenize:function(e,t,n){const r=this;let a,s,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),i};function i(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),a=31,s=Il,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=Dl,c):(e.enter("characterReferenceValue"),a=7,s=Al,c(t))}function c(i){if(59===i&&o){const a=e.exit("characterReferenceValue");return s!==Il||bl(r.sliceSerialize(a))?(e.enter("characterReferenceMarker"),e.consume(i),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(i)}return s(i)&&o++<a?(e.consume(i),c):n(i)}}};const ec={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a};function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},tc={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return o;function o(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),Ll(t)?Ul(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===s?(e.enter("codeFencedFenceSequence"),u(t)):n(t)}function u(t){return t===s?(a++,e.consume(t),u):a>=i?(e.exit("codeFencedFenceSequence"),Ll(t)?Ul(e,d,"whitespace")(t):d(t)):n(t)}function d(r){return null===r||Fl(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let s,o=0,i=0;return function(t){return function(t){const n=r.events[r.events.length-1];return o=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===s?(i++,e.consume(t),l):i<3?n(t):(e.exit("codeFencedFenceSequence"),Ll(t)?Ul(e,c,"whitespace")(t):c(t))}function c(n){return null===n||Fl(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(ec,m,b)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||Fl(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):Ll(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ul(e,d,"whitespace")(t)):96===t&&t===s?n(t):(e.consume(t),u)}function d(t){return null===t||Fl(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||Fl(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===s?n(t):(e.consume(t),f)}function m(t){return e.attempt(a,b,p)(t)}function p(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&Ll(t)?Ul(e,g,"linePrefix",o+1)(t):g(t)}function g(t){return null===t||Fl(t)?e.check(ec,m,b)(t):(e.enter("codeFlowValue"),x(t))}function x(t){return null===t||Fl(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),x)}function b(n){return e.exit("codeFenced"),t(n)}}};const nc={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),Ul(e,a,"linePrefix",5)(t)};function a(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?s(e):n(e)}function s(t){return null===t?i(t):Fl(t)?e.attempt(rc,s,i)(t):(e.enter("codeFlowValue"),o(t))}function o(t){return null===t||Fl(t)?(e.exit("codeFlowValue"),s(t)):(e.consume(t),o)}function i(n){return e.exit("codeIndented"),t(n)}}},rc={partial:!0,tokenize:function(e,t,n){const r=this;return a;function a(t){return r.parser.lazy[r.now().line]?n(t):Fl(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):Ul(e,s,"linePrefix",5)(t)}function s(e){const s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):Fl(e)?a(e):n(e)}}};const ac={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,a=3;if(!("lineEnding"!==e[a][1].type&&"space"!==e[a][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=a;++t<r;)if("codeTextData"===e[t][1].type){e[a][1].type="codeTextPadding",e[r][1].type="codeTextPadding",a+=2,r-=2;break}t=a-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,a,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),o(t)};function o(t){return 96===t?(e.consume(t),s++,o):(e.exit("codeTextSequence"),i(t))}function i(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),i):96===t?(a=e.enter("codeTextSequence"),r=0,c(t)):Fl(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||Fl(t)?(e.exit("codeTextData"),i(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(a.type="codeTextData",l(n))}}};class sc{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const a=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&oc(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),oc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),oc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);oc(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);oc(this.left,t.reverse())}}}function oc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ic(e){const t={};let n,r,a,s,o,i,l,c=-1;const u=new sc(e);for(;++c<u.length;){for(;c in t;)c=t[c];if(n=u.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&(i=n[1]._tokenizer.events,a=0,a<i.length&&"lineEndingBlank"===i[a][1].type&&(a+=2),a<i.length&&"content"===i[a][1].type))for(;++a<i.length&&"content"!==i[a][1].type;)"chunkText"===i[a][1].type&&(i[a][1]._isInFirstContentOfListItem=!0,a++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,lc(u,c)),c=t[c],l=!0);else if(n[1]._container){for(a=c,r=void 0;a--;)if(s=u.get(a),"lineEnding"===s[1].type||"lineEndingBlank"===s[1].type)"enter"===s[0]&&(r&&(u.get(r)[1].type="lineEndingBlank"),s[1].type="lineEnding",r=a);else if("linePrefix"!==s[1].type&&"listItemIndent"!==s[1].type)break;r&&(n[1].end={...u.get(r)[1].start},o=u.slice(r,c),o.unshift(n),u.splice(r,c-r+1,o))}}return yl(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function lc(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const i=o.events,l=[],c={};let u,d,f=-1,m=n,p=0,h=0;const g=[h];for(;m;){for(;e.get(++a)[1]!==m;);s.push(a),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),d&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<i.length;)"exit"===i[f][0]&&"enter"===i[f-1][0]&&i[f][1].type===i[f-1][1].type&&i[f][1].start.line!==i[f][1].end.line&&(h=f+1,g.push(h),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):g.pop(),f=g.length;f--;){const t=i.slice(g[f],g[f+1]),n=s.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const cc={resolve:function(e){return ic(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?a(t):Fl(t)?e.check(uc,s,a)(t):(e.consume(t),r)}function a(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function s(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},uc={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Ul(e,a,"linePrefix")};function a(a){if(null===a||Fl(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}};function dc(e,t,n,r,a,s,o,i,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){if(60===t)return e.enter(r),e.enter(a),e.enter(s),e.consume(t),e.exit(s),d;if(null===t||32===t||41===t||El(t))return n(t);return e.enter(r),e.enter(o),e.enter(i),e.enter("chunkString",{contentType:"string"}),p(t)};function d(n){return 62===n?(e.enter(s),e.consume(n),e.exit(s),e.exit(a),e.exit(r),t):(e.enter(i),e.enter("chunkString",{contentType:"string"}),f(n))}function f(t){return 62===t?(e.exit("chunkString"),e.exit(i),d(t)):null===t||60===t||Fl(t)?n(t):(e.consume(t),92===t?m:f)}function m(t){return 60===t||62===t||92===t?(e.consume(t),f):f(t)}function p(a){return u||null!==a&&41!==a&&!_l(a)?u<c&&40===a?(e.consume(a),u++,p):41===a?(e.consume(a),u--,p):null===a||32===a||40===a||El(a)?n(a):(e.consume(a),92===a?h:p):(e.exit("chunkString"),e.exit(i),e.exit(o),e.exit(r),t(a))}function h(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function fc(e,t,n,r,a,s){const o=this;let i,l=0;return function(t){return e.enter(r),e.enter(a),e.consume(t),e.exit(a),e.enter(s),c};function c(d){return l>999||null===d||91===d||93===d&&!i||94===d&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(d):93===d?(e.exit(s),e.enter(a),e.consume(d),e.exit(a),e.exit(r),t):Fl(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||Fl(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),i||(i=!Ll(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function mc(e,t,n,r,a,s){let o;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(a),e.consume(t),e.exit(a),o=40===t?41:t,i;return n(t)};function i(n){return n===o?(e.enter(a),e.consume(n),e.exit(a),e.exit(r),t):(e.enter(s),l(n))}function l(t){return t===o?(e.exit(s),i(o)):null===t?n(t):Fl(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Ul(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===o||null===t||Fl(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function pc(e,t){let n;return function r(a){if(Fl(a))return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r;if(Ll(a))return Ul(e,r,n?"linePrefix":"lineSuffix")(a);return t(a)}}const hc={name:"definition",tokenize:function(e,t,n){const r=this;let a;return function(t){return e.enter("definition"),function(t){return fc.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function s(t){return a=Sl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return _l(t)?pc(e,i)(t):i(t)}function i(t){return dc(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(gc,c,c)(t)}function c(t){return Ll(t)?Ul(e,u,"whitespace")(t):u(t)}function u(s){return null===s||Fl(s)?(e.exit("definition"),r.parser.defined.push(a),t(s)):n(s)}}},gc={partial:!0,tokenize:function(e,t,n){return function(t){return _l(t)?pc(e,r)(t):n(t)};function r(t){return mc(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function a(t){return Ll(t)?Ul(e,s,"whitespace")(t):s(t)}function s(e){return null===e||Fl(e)?t(e):n(e)}}};const xc={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return Fl(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const bc={name:"headingAtx",resolve:function(e,t){let n,r,a=e.length-2,s=3;"whitespace"===e[s][1].type&&(s+=2);a-2>s&&"whitespace"===e[a][1].type&&(a-=2);"atxHeadingSequence"===e[a][1].type&&(s===a-1||a-4>s&&"whitespace"===e[a-2][1].type)&&(a-=s+1===a?2:4);a>s&&(n={type:"atxHeadingText",start:e[s][1].start,end:e[a][1].end},r={type:"chunkText",start:e[s][1].start,end:e[a][1].end,contentType:"text"},yl(e,s,a-s+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),a(t)}(t)};function a(t){return 35===t&&r++<6?(e.consume(t),a):null===t||_l(t)?(e.exit("atxHeadingSequence"),s(t)):n(t)}function s(n){return 35===n?(e.enter("atxHeadingSequence"),o(n)):null===n||Fl(n)?(e.exit("atxHeading"),t(n)):Ll(n)?Ul(e,s,"whitespace")(n):(e.enter("atxHeadingText"),i(n))}function o(t){return 35===t?(e.consume(t),o):(e.exit("atxHeadingSequence"),s(t))}function i(t){return null===t||35===t||_l(t)?(e.exit("atxHeadingText"),s(t)):(e.consume(t),i)}}};const yc=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],vc=["pre","script","style","textarea"],wc={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let a,s,o,i,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(i){return 33===i?(e.consume(i),u):47===i?(e.consume(i),s=!0,m):63===i?(e.consume(i),a=3,r.interrupt?t:F):Tl(i)?(e.consume(i),o=String.fromCharCode(i),p):n(i)}function u(s){return 45===s?(e.consume(s),a=2,d):91===s?(e.consume(s),a=5,i=0,f):Tl(s)?(e.consume(s),a=4,r.interrupt?t:F):n(s)}function d(a){return 45===a?(e.consume(a),r.interrupt?t:F):n(a)}function f(a){const s="CDATA[";return a===s.charCodeAt(i++)?(e.consume(a),6===i?r.interrupt?t:S:f):n(a)}function m(t){return Tl(t)?(e.consume(t),o=String.fromCharCode(t),p):n(t)}function p(i){if(null===i||47===i||62===i||_l(i)){const l=47===i,c=o.toLowerCase();return l||s||!vc.includes(c)?yc.includes(o.toLowerCase())?(a=6,l?(e.consume(i),h):r.interrupt?t(i):S(i)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(i):s?g(i):x(i)):(a=1,r.interrupt?t(i):S(i))}return 45===i||Il(i)?(e.consume(i),o+=String.fromCharCode(i),p):n(i)}function h(a){return 62===a?(e.consume(a),r.interrupt?t:S):n(a)}function g(t){return Ll(t)?(e.consume(t),g):j(t)}function x(t){return 47===t?(e.consume(t),j):58===t||95===t||Tl(t)?(e.consume(t),b):Ll(t)?(e.consume(t),x):j(t)}function b(t){return 45===t||46===t||58===t||95===t||Il(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),v):Ll(t)?(e.consume(t),y):x(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,w):Ll(t)?(e.consume(t),v):k(t)}function w(t){return t===l?(e.consume(t),l=null,N):null===t||Fl(t)?n(t):(e.consume(t),w)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||_l(t)?y(t):(e.consume(t),k)}function N(e){return 47===e||62===e||Ll(e)?x(e):n(e)}function j(t){return 62===t?(e.consume(t),C):n(t)}function C(t){return null===t||Fl(t)?S(t):Ll(t)?(e.consume(t),C):n(t)}function S(t){return 45===t&&2===a?(e.consume(t),E):60===t&&1===a?(e.consume(t),A):62===t&&4===a?(e.consume(t),_):63===t&&3===a?(e.consume(t),F):93===t&&5===a?(e.consume(t),R):!Fl(t)||6!==a&&7!==a?null===t||Fl(t)?(e.exit("htmlFlowData"),T(t)):(e.consume(t),S):(e.exit("htmlFlowData"),e.check(kc,L,T)(t))}function T(t){return e.check(Nc,I,L)(t)}function I(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return null===t||Fl(t)?T(t):(e.enter("htmlFlowData"),S(t))}function E(t){return 45===t?(e.consume(t),F):S(t)}function A(t){return 47===t?(e.consume(t),o="",D):S(t)}function D(t){if(62===t){const n=o.toLowerCase();return vc.includes(n)?(e.consume(t),_):S(t)}return Tl(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),D):S(t)}function R(t){return 93===t?(e.consume(t),F):S(t)}function F(t){return 62===t?(e.consume(t),_):45===t&&2===a?(e.consume(t),F):S(t)}function _(t){return null===t||Fl(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),_)}function L(n){return e.exit("htmlFlow"),t(n)}}},kc={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Gl,t,n)}}},Nc={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(Fl(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a;return n(t)};function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const jc={name:"htmlText",tokenize:function(e,t,n){const r=this;let a,s,o;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),i};function i(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),b):Tl(t)?(e.consume(t),N):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),s=0,m):Tl(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),f):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):Fl(t)?(o=u,D(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),f):u(t)}function f(e){return 62===e?A(e):45===e?d(e):u(e)}function m(t){const r="CDATA[";return t===r.charCodeAt(s++)?(e.consume(t),6===s?p:m):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),h):Fl(t)?(o=p,D(t)):(e.consume(t),p)}function h(t){return 93===t?(e.consume(t),g):p(t)}function g(t){return 62===t?A(t):93===t?(e.consume(t),g):p(t)}function x(t){return null===t||62===t?A(t):Fl(t)?(o=x,D(t)):(e.consume(t),x)}function b(t){return null===t?n(t):63===t?(e.consume(t),y):Fl(t)?(o=b,D(t)):(e.consume(t),b)}function y(e){return 62===e?A(e):b(e)}function v(t){return Tl(t)?(e.consume(t),w):n(t)}function w(t){return 45===t||Il(t)?(e.consume(t),w):k(t)}function k(t){return Fl(t)?(o=k,D(t)):Ll(t)?(e.consume(t),k):A(t)}function N(t){return 45===t||Il(t)?(e.consume(t),N):47===t||62===t||_l(t)?j(t):n(t)}function j(t){return 47===t?(e.consume(t),A):58===t||95===t||Tl(t)?(e.consume(t),C):Fl(t)?(o=j,D(t)):Ll(t)?(e.consume(t),j):A(t)}function C(t){return 45===t||46===t||58===t||95===t||Il(t)?(e.consume(t),C):S(t)}function S(t){return 61===t?(e.consume(t),T):Fl(t)?(o=S,D(t)):Ll(t)?(e.consume(t),S):j(t)}function T(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,I):Fl(t)?(o=T,D(t)):Ll(t)?(e.consume(t),T):(e.consume(t),P)}function I(t){return t===a?(e.consume(t),a=void 0,E):null===t?n(t):Fl(t)?(o=I,D(t)):(e.consume(t),I)}function P(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||_l(t)?j(t):(e.consume(t),P)}function E(e){return 47===e||62===e||_l(e)?j(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function D(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return Ll(t)?Ul(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):F(t)}function F(t){return e.enter("htmlTextData"),o(t)}}};const Cc={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&yl(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,a,s,o=e.length,i=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(a){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){i=2;break}}else"labelEnd"===n.type&&(a=o);const l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[r+i+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=vl(s,e.slice(r+1,r+i+3)),s=vl(s,[["enter",u,t]]),s=vl(s,Wl(t.parser.constructs.insideSpan.null,e.slice(r+i+4,a-3),t)),s=vl(s,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),s=vl(s,e.slice(a+1)),s=vl(s,[["exit",l,t]]),yl(e,r,e.length,s),e},tokenize:function(e,t,n){const r=this;let a,s,o=r.events.length;for(;o--;)if(("labelImage"===r.events[o][1].type||"labelLink"===r.events[o][1].type)&&!r.events[o][1]._balanced){a=r.events[o][1];break}return function(t){if(!a)return n(t);if(a._inactive)return u(t);return s=r.parser.defined.includes(Sl(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),i};function i(t){return 40===t?e.attempt(Sc,c,s?c:u)(t):91===t?e.attempt(Tc,c,s?l:u)(t):s?c(t):u(t)}function l(t){return e.attempt(Ic,c,u)(t)}function c(e){return t(e)}function u(e){return a._balanced=!0,n(e)}}},Sc={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return _l(t)?pc(e,a)(t):a(t)}function a(t){return 41===t?c(t):dc(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return _l(t)?pc(e,i)(t):c(t)}function o(e){return n(e)}function i(t){return 34===t||39===t||40===t?mc(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return _l(t)?pc(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},Tc={tokenize:function(e,t,n){const r=this;return function(t){return fc.call(r,e,a,s,"reference","referenceMarker","referenceString")(t)};function a(e){return r.parser.defined.includes(Sl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function s(e){return n(e)}}},Ic={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const Pc={name:"labelStartImage",resolveAll:Cc.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),a};function a(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):n(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const Ec={name:"labelStartLink",resolveAll:Cc.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),a};function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const Ac={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Ul(e,t,"linePrefix")}}};const Dc={name:"thematicBreak",tokenize:function(e,t,n){let r,a=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,s(e)}(t)};function s(s){return s===r?(e.enter("thematicBreakSequence"),o(s)):a>=3&&(null===s||Fl(s))?(e.exit("thematicBreak"),t(s)):n(s)}function o(t){return t===r?(e.consume(t),a++,o):(e.exit("thematicBreakSequence"),Ll(t)?Ul(e,s,"whitespace")(t):s(t))}}};const Rc={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Gl,a,s);function a(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ul(e,t,"listItemIndent",r.containerState.size+1)(n)}function s(n){return r.containerState.furtherBlankLines||!Ll(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(_c,t,o)(n))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ul(e,e.attempt(Rc,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,a=r.events[r.events.length-1];let s=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,o=0;return function(t){const a=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===a?!r.containerState.marker||t===r.containerState.marker:Al(t)){if(r.containerState.type||(r.containerState.type=a,e.enter(a,{_container:!0})),"listUnordered"===a)return e.enter("listItemPrefix"),42===t||45===t?e.check(Dc,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),i(t)}return n(t)};function i(t){return Al(t)&&++o<10?(e.consume(t),i):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(Gl,r.interrupt?n:c,e.attempt(Fc,d,u))}function c(e){return r.containerState.initialBlankLine=!0,s++,d(e)}function u(t){return Ll(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},Fc={partial:!0,tokenize:function(e,t,n){const r=this;return Ul(e,function(e){const a=r.events[r.events.length-1];return!Ll(e)&&a&&"listItemPrefixWhitespace"===a[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},_c={partial:!0,tokenize:function(e,t,n){const r=this;return Ul(e,function(e){const a=r.events[r.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Lc={name:"setextUnderline",resolveTo:function(e,t){let n,r,a,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){n=s;break}"paragraph"===e[s][1].type&&(r=s)}else"content"===e[s][1].type&&e.splice(s,1),a||"definition"!==e[s][1].type||(a=s);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",a?(e.splice(r,0,["enter",o,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=o;return e.push(["exit",o,t]),e},tokenize:function(e,t,n){const r=this;let a;return function(t){let o,i=r.events.length;for(;i--;)if("lineEnding"!==r.events[i][1].type&&"linePrefix"!==r.events[i][1].type&&"content"!==r.events[i][1].type){o="paragraph"===r.events[i][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||o))return e.enter("setextHeadingLine"),a=t,function(t){return e.enter("setextHeadingLineSequence"),s(t)}(t);return n(t)};function s(t){return t===a?(e.consume(t),s):(e.exit("setextHeadingLineSequence"),Ll(t)?Ul(e,o,"lineSuffix")(t):o(t))}function o(r){return null===r||Fl(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const Mc={tokenize:function(e){const t=this,n=e.attempt(Gl,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,Ul(e,e.attempt(this.parser.constructs.flow,r,e.attempt(cc,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const Oc={resolveAll:$c()},zc=Uc("string"),Bc=Uc("text");function Uc(e){return{resolveAll:$c("text"===e?Vc:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],a=t.attempt(r,s,o);return s;function s(e){return l(e)?a(e):o(e)}function o(e){if(null!==e)return t.enter("data"),t.consume(e),i;t.consume(e)}function i(e){return l(e)?(t.exit("data"),a(e)):(t.consume(e),i)}function l(e){if(null===e)return!0;const t=r[e];let a=-1;if(t)for(;++a<t.length;){const e=t[a];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function $c(e){return function(t,n){let r,a=-1;for(;++a<=t.length;)void 0===r?t[a]&&"data"===t[a][1].type&&(r=a,a++):t[a]&&"data"===t[a][1].type||(a!==r+2&&(t[r][1].end=t[a-1][1].end,t.splice(r+2,a-r-2),a=r+2),r=void 0);return e?e(t,n):t}}function Vc(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],a=t.sliceStream(r);let s,o=a.length,i=-1,l=0;for(;o--;){const e=a[o];if("string"==typeof e){for(i=e.length;32===e.charCodeAt(i-1);)l++,i--;if(i)break;i=-1}else if(-2===e)s=!0,l++;else if(-1!==e){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const a={type:n===e.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?i:r.start._bufferIndex+i,_index:r.start._index+o,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...a.start},r.start.offset===r.end.offset?Object.assign(r,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}const qc={42:Rc,43:Rc,45:Rc,48:Rc,49:Rc,50:Rc,51:Rc,52:Rc,53:Rc,54:Rc,55:Rc,56:Rc,57:Rc,62:Yl},Hc={91:hc},Wc={[-2]:nc,[-1]:nc,32:nc},Qc={35:bc,42:Dc,45:[Lc,Dc],60:wc,61:Lc,95:Dc,96:tc,126:tc},Kc={38:Zl,92:Jl},Xc={[-5]:Ac,[-4]:Ac,[-3]:Ac,33:Pc,38:Zl,42:Ql,60:[Xl,jc],91:Ec,92:[xc,Jl],93:Cc,95:Ql,96:ac},Gc={null:[Ql,Oc]};var Yc=Object.freeze({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Hc,disable:{null:[]},document:qc,flow:Qc,flowInitial:Wc,insideSpan:Gc,string:Kc,text:Xc});function Jc(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},s=[];let o=[],i=[];const l={attempt:g(function(e,t){x(e,t.from)}),check:g(h),consume:function(e){Fl(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,b()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=f(),c.events.push(["enter",n,c]),i.push(n),n},exit:function(e){const t=i.pop();return t.end=f(),c.events.push(["exit",t,c]),t},interrupt:g(h,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){a[e.line]=e.column,b()},events:[],now:f,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const s=e[n];let o;if("string"==typeof s)o=s;else switch(s){case-5:o="\r";break;case-4:o="\n";break;case-3:o="\r\n";break;case-2:o=t?" ":"\t";break;case-1:if(!t&&a)continue;o=" ";break;default:o=String.fromCharCode(s)}a=-2===s,r.push(o)}return r.join("")}(d(e),t)},sliceStream:d,write:function(e){if(o=vl(o,e),m(),null!==o[o.length-1])return[];return x(t,0),c.events=Wl(s,c.events,c),c.events}};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,s)];else{if(o=e.slice(n,a),r>-1){const e=o[0];"string"==typeof e?o[0]=e.slice(r):o.shift()}s>0&&o.push(e[a].slice(0,s))}return o}(o,e)}function f(){const{_bufferIndex:e,_index:t,line:n,column:a,offset:s}=r;return{_bufferIndex:e,_index:t,line:n,column:a,offset:s}}function m(){let e;for(;r._index<o.length;){const t=o[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)p(t.charCodeAt(r._bufferIndex));else p(t)}}function p(e){u=u(e)}function h(e,t){t.restore()}function g(e,t){return function(n,a,s){let o,u,d,m;return Array.isArray(n)?p(n):"tokenize"in n?p([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return p([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function p(e){return o=e,u=0,0===e.length?s:h(e[u])}function h(e){return function(n){m=function(){const e=f(),t=c.previous,n=c.currentConstruct,a=c.events.length,s=Array.from(i);return{from:a,restore:o};function o(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=a,i=s,b()}}(),d=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return x();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,x)(n)}}function g(t){return e(d,m),a}function x(e){return m.restore(),++u<o.length?h(o[u]):s}}}function x(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&yl(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function b(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}const Zc=/[\0\t\n\r]/g;const eu=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function tu(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return Cl(n.slice(t?2:1),t?16:10)}return bl(n)||e}const nu={}.hasOwnProperty;function ru(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(te),autolinkProtocol:C,autolinkEmail:C,atxHeading:s(Y),blockQuote:s(W),characterEscape:C,characterReference:C,codeFenced:s(Q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Q,o),codeText:s(K,o),codeTextData:C,data:C,codeFlowValue:C,definition:s(X),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(G),hardBreakEscape:s(J),hardBreakTrailing:s(J),htmlFlow:s(Z,o),htmlFlowData:C,htmlText:s(Z,o),htmlTextData:C,image:s(ee),label:o,link:s(te),listItem:s(re),listItemValue:f,listOrdered:s(ne,d),listUnordered:s(ne),paragraph:s(ae),reference:z,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Y),strong:s(se),thematicBreak:s(ie)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:H,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:$,characterReference:V,codeFenced:l(g),codeFencedFence:h,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:S,codeIndented:l(x),codeText:l(A),codeTextData:S,data:S,definition:l(),definitionDestinationString:v,definitionLabelString:b,definitionTitleString:y,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(P),htmlFlowData:S,htmlText:l(E),htmlTextData:S,image:l(R),label:_,labelText:F,lineEnding:T,link:l(D),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:L,resourceTitleString:M,resource:O,setextHeading:l(j),setextHeadingLineSequence:N,setextHeadingText:k,strong:l(),thematicBreak:l()}};su(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const s={stack:[r],tokenStack:[],config:t,enter:i,exit:c,buffer:o,resume:u,data:n},l=[];let d=-1;for(;++d<e.length;)if("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)if("enter"===e[d][0])l.push(d);else{d=a(e,l.pop(),d)}for(d=-1;++d<e.length;){const n=t[e[d][0]];nu.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},s),e[d][1])}if(s.tokenStack.length>0){const e=s.tokenStack[s.tokenStack.length-1];(e[1]||iu).call(s,void 0,e[0])}for(r.position={start:au(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:au(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function a(e,t,n){let r,a,s,o,i=t-1,l=-1,c=!1;for(;++i<=n;){const t=e[i];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||s||(s=i),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=i;for(a=void 0;o--;){const t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;a&&(e[a][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",a=o}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}s&&(!a||s<a)&&(r._spread=!0),r.end=Object.assign({},a?e[a][1].start:t[1].end),e.splice(a||i,0,["exit",r,t[2]]),i++,n++}if("listItemPrefix"===t[1].type){const a={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=a,e.splice(i,0,["enter",a,t[2]]),i++,n++,s=void 0,o=!0}}}return e[t][1]._spread=c,n}function s(e,t){return n;function n(n){i.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:"fragment",children:[]})}function i(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:au(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Hi({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(t)t.call(this,e,r[0]);else{(r[1]||iu).call(this,e,r[0])}n.position.end=au(e.end)}function u(){return pl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function p(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function b(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Sl(this.sliceSerialize(e)).toLowerCase()}function y(){const e=this.resume();this.stack[this.stack.length-1].title=e}function v(){const e=this.resume();this.stack[this.stack.length-1].url=e}function w(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function N(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function j(){this.data.setextHeadingSlurpLineEnding=void 0}function C(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=oe(),n.position={start:au(e.start),end:void 0},t.push(n)),this.stack.push(n)}function S(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=au(e.end)}function T(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=au(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(C.call(this,e),S.call(this,e))}function I(){this.data.atHardBreak=!0}function P(){const e=this.resume();this.stack[this.stack.length-1].value=e}function E(){const e=this.resume();this.stack[this.stack.length-1].value=e}function A(){const e=this.resume();this.stack[this.stack.length-1].value=e}function D(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function R(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function F(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(eu,tu)}(t),n.identifier=Sl(t).toLowerCase()}function _(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function L(){const e=this.resume();this.stack[this.stack.length-1].url=e}function M(){const e=this.resume();this.stack[this.stack.length-1].title=e}function O(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function B(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Sl(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function U(e){this.data.characterReferenceType=e.type}function $(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;if(n)r=Cl(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{r=bl(t)}this.stack[this.stack.length-1].value+=r}function V(e){this.stack.pop().position.end=au(e.end)}function q(e){S.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function H(e){S.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function W(){return{type:"blockquote",children:[]}}function Q(){return{type:"code",lang:null,meta:null,value:""}}function K(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function G(){return{type:"emphasis",children:[]}}function Y(){return{type:"heading",depth:0,children:[]}}function J(){return{type:"break"}}function Z(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function ae(){return{type:"paragraph",children:[]}}function se(){return{type:"strong",children:[]}}function oe(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}(n)(function(e){for(;!ic(e););return e}(function(e){const t={constructs:kl([Yc,...(e||{}).extensions||[]]),content:n($l),defined:[],document:n(Vl),flow:n(Mc),lazy:{},string:n(zc),text:n(Bc)};return t;function n(e){return function(n){return Jc(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(a,s,o){const i=[];let l,c,u,d,f;for(a=n+("string"==typeof a?a.toString():new TextDecoder(s||void 0).decode(a)),u=0,n="",r&&(65279===a.charCodeAt(0)&&u++,r=void 0);u<a.length;){if(Zc.lastIndex=u,l=Zc.exec(a),d=l&&void 0!==l.index?l.index:a.length,f=a.charCodeAt(d),!l){n=a.slice(u);break}if(10===f&&u===d&&e)i.push(-3),e=void 0;else switch(e&&(i.push(-5),e=void 0),u<d&&(i.push(a.slice(u,d)),t+=d-u),f){case 0:i.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),i.push(-2);t++<c;)i.push(-1);break;case 10:i.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return o&&(e&&i.push(-5),n&&i.push(n),i.push(null)),i}}()(e,t,!0))))}function au(e){return{line:e.line,column:e.column,offset:e.offset}}function su(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?su(e,r):ou(e,r)}}function ou(e,t){let n;for(n in t)if(nu.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function iu(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Hi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Hi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Hi({start:t.start,end:t.end})+") is still open")}function lu(e){const t=this;t.parser=function(n){return ru(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function cu(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),s=a[0];s&&"text"===s.type?s.value="["+s.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&"text"===o.type?o.value+=r:a.push({type:"text",value:r}),a}function uu(e){const t=e.spread;return null==t?e.children.length>1:t}function du(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const s=[];for(;r;)s.push(fu(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return s.push(fu(t.slice(a),a>0,!1)),s.join("")}function fu(e,t,n){let r=0,a=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(a-1);for(;9===t||32===t;)a--,t=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}const mu={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=Bl(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,i=e.footnoteCounts.get(r);void 0===i?(i=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,i+=1,e.footnoteCounts.set(r,i);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return cu(e,t);const a={src:Bl(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(a.title=r.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){const n={src:Bl(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return cu(e,t);const a={href:Bl(r.url||"")};null!==r.title&&void 0!==r.title&&(a.title=r.title);const s={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){const n={href:Bl(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){const r=e.all(t),a=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=uu(n[r])}return t}(n):uu(t),s={},o=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let i=-1;for(;++i<r.length;){const e=r[i];(a||0!==i||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||a?o.push(e):o.push(...e.children)}const l=r[r.length-1];l&&(a||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},r=e.all(t);let a=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++a<r.length;){const e=r[a];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),a.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=Vi(t.children[1]),o=$i(t.children[t.children.length-1]);s&&o&&(r.position={start:s,end:o}),a.push(r)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,a=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,o=s?s.length:t.children.length;let i=-1;const l=[];for(;++i<o;){const n=t.children[i],r={},o=s?s[i]:void 0;o&&(r.align=o);let c={type:"element",tagName:a,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:du(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:pu,yaml:pu,definition:pu,footnoteDefinition:pu};function pu(){}const hu="object"==typeof self?self:globalThis,gu=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=a=>{if(e.has(a))return e.get(a);const[s,o]=t[a];switch(s){case 0:case-1:return n(o,a);case 1:{const e=n([],a);for(const t of o)e.push(r(t));return e}case 2:{const e=n({},a);for(const[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),a);case 4:{const{source:e,flags:t}=o;return n(new RegExp(e,t),a)}case 5:{const e=n(new Map,a);for(const[t,n]of o)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,a);for(const t of o)e.add(r(t));return e}case 7:{const{name:e,message:t}=o;return n(new hu[e](t),a)}case 8:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new hu[s](o),a)};return r})(new Map,e)(0),xu="",{toString:bu}={},{keys:yu}=Object,vu=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=bu.call(e).slice(8,-1);switch(n){case"Array":return[1,xu];case"Object":return[2,xu];case"Date":return[3,xu];case"RegExp":return[4,xu];case"Map":return[5,xu];case"Set":return[6,xu];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},wu=([e,t])=>0===e&&("function"===t||"symbol"===t),ku=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const a=(e,t)=>{const a=r.push(e)-1;return n.set(t,a),a},s=r=>{if(n.has(r))return n.get(r);let[o,i]=vu(r);switch(o){case 0:{let t=r;switch(i){case"bigint":o=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+i);t=null;break;case"undefined":return a([-1],r)}return a([o,t],r)}case 1:{if(i){let e=r;return"DataView"===i?e=new Uint8Array(r.buffer):"ArrayBuffer"===i&&(e=new Uint8Array(r)),a([i,[...e]],r)}const e=[],t=a([o,e],r);for(const n of r)e.push(s(n));return t}case 2:{if(i)switch(i){case"BigInt":return a([i,r.toString()],r);case"Boolean":case"Number":case"String":return a([i,r.valueOf()],r)}if(t&&"toJSON"in r)return s(r.toJSON());const n=[],l=a([o,n],r);for(const t of yu(r))!e&&wu(vu(r[t]))||n.push([s(t),s(r[t])]);return l}case 3:return a([o,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return a([o,{source:e,flags:t}],r)}case 5:{const t=[],n=a([o,t],r);for(const[a,o]of r)(e||!wu(vu(a))&&!wu(vu(o)))&&t.push([s(a),s(o)]);return n}case 6:{const t=[],n=a([o,t],r);for(const a of r)!e&&wu(vu(a))||t.push(s(a));return n}}const{message:l}=r;return a([o,{name:i,message:l}],r)};return s})(!(t||n),!!t,new Map,r)(e),r};var Nu="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?gu(ku(e,t)):structuredClone(e):(e,t)=>gu(ku(e,t));function ju(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Cu(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const Su=function(e){if(null==e)return Iu;if("function"==typeof e)return Tu(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Su(e[n]);return Tu(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return Tu(n);function n(n){const r=n;let a;for(a in e)if(r[a]!==t[a])return!1;return!0}}(e);if("string"==typeof e)return function(e){return Tu(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function Tu(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function Iu(){return!0}const Pu=[],Eu=!0,Au=!1;function Du(e,t,n,r){let a;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):a=t;const s=Su(a),o=r?-1:1;!function e(a,i,l){const c=a&&"object"==typeof a?a:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return u;function u(){let c,u,d,f=Pu;if((!t||s(a,i,l[l.length-1]||void 0))&&(f=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[Eu,e];return null==e?Pu:[e]}(n(a,l)),f[0]===Au))return f;if("children"in a&&a.children){const t=a;if(t.children&&"skip"!==f[0])for(u=(r?t.children.length:-1)+o,d=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,d)(),c[0]===Au)return c;u="number"==typeof c[1]?c[1]:u+o}}return f}}(e,void 0,[])()}function Ru(e,t,n,r){let a,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,a=n):(s=t,o=n,a=r),Du(e,s,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},a)}const Fu={}.hasOwnProperty,_u={};function Lu(e,t){e.position&&(t.position=function(e){const t=Vi(e),n=$i(e);if(t&&n)return{start:t,end:n}}(e))}function Mu(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,a=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&a&&Object.assign(n.properties,Nu(a)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function Ou(e,t){const n=t.data||{},r=!("value"in t)||Fu.call(n,"hProperties")||Fu.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function zu(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function Bu(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Uu(e,t){const n=function(e,t){const n=t||_u,r=new Map,a=new Map,s=new Map,o={...mu,...n.handlers},i={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const a=i.one(n[r],e);if(a){if(r&&"break"===n[r-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=Bu(a.value)),!Array.isArray(a)&&"element"===a.type)){const e=a.children[0];e&&"text"===e.type&&(e.value=Bu(e.value))}Array.isArray(a)?t.push(...a):t.push(a)}}}return t},applyData:Mu,definitionById:r,footnoteById:a,footnoteCounts:s,footnoteOrder:[],handlers:o,one:function(e,t){const n=e.type,r=i.handlers[n];if(Fu.call(i.handlers,n)&&r)return r(i,e,t);if(i.options.passThrough&&i.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=Nu(n);return r.children=i.all(e),r}return Nu(e)}return(i.options.unknownHandler||Ou)(i,e,t)},options:n,patch:Lu,wrap:zu};return Ru(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:a,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),i}(e,t),r=n.one(e,void 0),a=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||ju,r=e.options.footnoteBackLabel||Cu,a=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},i=[];let l=-1;for(;++l<e.footnoteOrder.length;){const a=e.footnoteById.get(e.footnoteOrder[l]);if(!a)continue;const s=e.all(a),o=String(a.identifier).toUpperCase(),c=Bl(o.toLowerCase());let u=0;const d=[],f=e.footnoteCounts.get(o);for(;void 0!==f&&++u<=f;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const m=s[s.length-1];if(m&&"element"===m.type&&"p"===m.tagName){const e=m.children[m.children.length-1];e&&"text"===e.type?e.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...d)}else s.push(...d);const p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(s,!0)};e.patch(a,p),i.push(p)}if(0!==i.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Nu(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(i,!0)},{type:"text",value:"\n"}]}}(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&s.children.push({type:"text",value:"\n"},a),s}function $u(e,t){return e&&"run"in e?async function(n,r){const a=Uu(n,{file:r,...t});await e.run(a,r)}:function(n,r){return Uu(n,{file:r,...e||t})}}function Vu(e){if(e)throw e}var qu,Hu;var Wu=function(){if(Hu)return qu;Hu=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},s=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,a=e.call(n,"constructor"),s=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!a&&!s)return!1;for(r in n);return void 0===r||e.call(n,r)},o=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},i=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return qu=function e(){var t,n,r,l,c,u,d=arguments[0],f=1,m=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<m;++f)if(null!=(t=arguments[f]))for(n in t)r=i(d,n),d!==(l=i(t,n))&&(p&&l&&(s(l)||(c=a(l)))?(c?(c=!1,u=r&&a(r)?r:[]):u=r&&s(r)?r:{},o(d,{name:n,newValue:e(p,u,l)})):void 0!==l&&o(d,{name:n,newValue:l}));return d},qu}(),Qu=ae(Wu);function Ku(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Xu(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function a(s,...o){const i=e[++n];let l=-1;if(s)r(s);else{for(;++l<t.length;)null!==o[l]&&void 0!==o[l]||(o[l]=t[l]);t=o,i?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let i;r&&t.push(a);try{i=e.apply(this,t)}catch(s){if(r&&n)throw s;return a(s)}r||(i&&i.then&&"function"==typeof i.then?i.then(o,a):i instanceof Error?a(i):o(i))}function a(e,...r){n||(n=!0,t(e,...r))}function o(e){a(null,e)}}(i,a)(...o):r(null,...o)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const Gu={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Yu(e);let n,r=0,a=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else a<0&&(n=!0,a=s+1);return a<0?"":e.slice(r,a)}if(t===e)return"";let o=-1,i=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else o<0&&(n=!0,o=s+1),i>-1&&(e.codePointAt(s)===t.codePointAt(i--)?i<0&&(a=s):(i=-1,a=o));r===a?a=o:a<0&&(a=e.length);return e.slice(r,a)},dirname:function(e){if(Yu(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){Yu(e);let t,n=e.length,r=-1,a=0,s=-1,o=0;for(;n--;){const i=e.codePointAt(n);if(47!==i)r<0&&(t=!0,r=n+1),46===i?s<0?s=n:1!==o&&(o=1):s>-1&&(o=-1);else if(t){a=n+1;break}}if(s<0||r<0||0===o||1===o&&s===r-1&&s===a+1)return"";return e.slice(s,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)Yu(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Yu(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,a="",s=0,o=-1,i=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(o===l-1||1===i);else if(o!==l-1&&2===i){if(a.length<2||2!==s||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2))if(a.length>2){if(r=a.lastIndexOf("/"),r!==a.length-1){r<0?(a="",s=0):(a=a.slice(0,r),s=a.length-1-a.lastIndexOf("/")),o=l,i=0;continue}}else if(a.length>0){a="",s=0,o=l,i=0;continue}t&&(a=a.length>0?a+"/..":"..",s=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),s=l-o-1;o=l,i=0}else 46===n&&i>-1?i++:i=-1}return a}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function Yu(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Ju={cwd:function(){return"/"}};function Zu(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function ed(e){if("string"==typeof e)e=new URL(e);else if(!Zu(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const td=["history","path","basename","stem","extname","dirname"];class nd{constructor(e){let t;t=e?Zu(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":Ju.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<td.length;){const e=td[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)td.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?Gu.basename(this.path):void 0}set basename(e){ad(e,"basename"),rd(e,"basename"),this.path=Gu.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?Gu.dirname(this.path):void 0}set dirname(e){sd(this.basename,"dirname"),this.path=Gu.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?Gu.extname(this.path):void 0}set extname(e){if(rd(e,"extname"),sd(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Gu.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){Zu(e)&&(e=ed(e)),ad(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?Gu.basename(this.path,this.extname):void 0}set stem(e){ad(e,"stem"),rd(e,"stem"),this.path=Gu.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Xi(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function rd(e,t){if(e&&e.includes(Gu.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Gu.sep+"`")}function ad(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function sd(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const od=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},id={}.hasOwnProperty;class ld extends od{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Xu()}copy(){const e=new ld;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Qu(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(fd("data",this.frozen),this.namespace[e]=t,this):id.call(this.namespace,e)&&this.namespace[e]||void 0:e?(fd("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=hd(e),n=this.parser||this.Parser;return ud("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),ud("process",this.parser||this.Parser),dd("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,a){const s=hd(e),o=n.parse(s);function i(e,n){e||!n?a(e):r?r(n):t(void 0,n)}n.run(o,s,function(e,t,r){if(e||!t||!r)return i(e);const a=t,s=n.stringify(a,r);!function(e){return"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)}(s)?r.result=s:r.value=s,i(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),ud("processSync",this.parser||this.Parser),dd("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,Vu(e),t=r}),pd("processSync","process",n),t}run(e,t,n){md(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?a(void 0,n):new Promise(a);function a(a,s){const o=hd(t);r.run(e,o,function(t,r,o){const i=r||e;t?s(t):a?a(i):n(void 0,i,o)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){Vu(e),n=t,r=!0}),pd("runSync","run",r),n}stringify(e,t){this.freeze();const n=hd(t),r=this.compiler||this.Compiler;return dd("stringify",r),md(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(fd("use",this.frozen),null==e);else if("function"==typeof e)i(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?o(e):s(e)}return this;function a(e){if("function"==typeof e)i(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;i(t,n)}else s(e)}}function s(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=Qu(!0,r.settings,e.settings))}function o(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){a(e[t])}}}function i(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(-1===a)n.push([e,...t]);else if(t.length>0){let[r,...s]=t;const o=n[a][1];Ku(o)&&Ku(r)&&(r=Qu(!0,o,r)),n[a]=[e,r,...s]}}}}const cd=(new ld).freeze();function ud(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function dd(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function fd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function md(e){if(!Ku(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function pd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function hd(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new nd(e)}const gd=[],xd={allowDangerousHtml:!0},bd=/^(https?|ircs?|mailto|xmpp)$/i,yd=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function vd(e){const t=function(e){const t=e.rehypePlugins||gd,n=e.remarkPlugins||gd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...xd}:xd,a=cd().use(lu).use(n).use($u,r).use(t);return a}(e),n=function(e){const t=e.children||"",n=new nd;"string"==typeof t&&(n.value=t);return n}(e);return function(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,s=t.disallowedElements,o=t.skipHtml,i=t.unwrapDisallowed,l=t.urlTransform||wd;for(const u of yd)Object.hasOwn(t,u.from)&&Vo((u.from,u.to&&u.to,u.id));return Ru(e,c),nl(e,{Fragment:fe.Fragment,components:a,ignoreInvalidStyle:!0,jsx:fe.jsx,jsxs:fe.jsxs,passKeys:!0,passNode:!0});function c(e,t,a){if("raw"===e.type&&a&&"number"==typeof t)return o?a.children.splice(t,1):a.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in fl)if(Object.hasOwn(fl,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=fl[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!s&&s.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,a)),o&&a&&"number"==typeof t)return i&&e.children?a.children.splice(t,1,...e.children):a.children.splice(t,1),t}}}(t.runSync(t.parse(n),n),e)}function wd(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return-1===t||-1!==a&&t>a||-1!==n&&t>n||-1!==r&&t>r||bd.test(e.slice(0,t))?e:""}function kd(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;-1!==a;)r++,a=n.indexOf(t,a+t.length);return r}function Nd(e,t,n){const r=Su((n||{}).ignore||[]),a=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([jd(e[0]),Cd(e[1])])}return t}(t);let s=-1;for(;++s<a.length;)Du(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){const e=t[o],a=n?n.children:void 0;if(r(e,a?a.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=a[s][0],o=a[s][1];let i=0;const l=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,a={index:d.index,input:d.input,stack:[...t,e]};let s=o(...d,a);if("string"==typeof s&&(s=s.length>0?{type:"text",value:s}:void 0),!1===s?r.lastIndex=n+1:(i!==n&&u.push({type:"text",value:e.value.slice(i,n)}),Array.isArray(s)?u.push(...s):s&&u.push(s),i=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}c?(i<e.value.length&&u.push({type:"text",value:e.value.slice(i)}),n.children.splice(l,1,...u)):u=[e];return l+u.length}(e,t)}}function jd(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function Cd(e){return"function"==typeof e?e:function(){return e}}const Sd="phrasing",Td=["autolink","link","image","label"];function Id(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Pd(e){this.config.enter.autolinkProtocol.call(this,e)}function Ed(e){this.config.exit.autolinkProtocol.call(this,e)}function Ad(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Dd(e){this.config.exit.autolinkEmail.call(this,e)}function Rd(e){this.exit(e)}function Fd(e){Nd(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,_d],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Ld]],{ignore:["link","linkReference"]})}function _d(e,t,n,r,a){let s="";if(!Md(a))return!1;if(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(n))return!1;const o=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=kd(e,"(");let s=kd(e,")");for(;-1!==r&&a>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}(n+r);if(!o[0])return!1;const i={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[i,{type:"text",value:o[1]}]:i}function Ld(e,t,n,r){return!(!Md(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Md(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||Ol(n)||Ml(n))&&(!t||47!==n)}function Od(){this.buffer()}function zd(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Bd(){this.buffer()}function Ud(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function $d(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sl(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Vd(e){this.exit(e)}function qd(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sl(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hd(e){this.exit(e)}function Wd(e,t,n,r){const a=n.createTracker(r);let s=a.move("[^");const o=n.enter("footnoteReference"),i=n.enter("reference");return s+=a.move(n.safe(n.associationId(e),{after:"]",before:s})),i(),o(),s+=a.move("]"),s}function Qd(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,a){const s=r.createTracker(a);let o=s.move("[^");const i=r.enter("footnoteDefinition"),l=r.enter("label");o+=s.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),o+=s.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,s.current()),t?Xd:Kd)));return i(),o},footnoteReference:Wd},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function Kd(e,t,n){return 0===t?e:Xd(e,t,n)}function Xd(e,t,n){return(n?"":" ")+e}Wd.peek=function(){return"["};const Gd=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Yd(e){this.enter({type:"delete",children:[]},e)}function Jd(e){this.exit(e)}function Zd(e,t,n,r){const a=n.createTracker(r),s=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),s(),o}function ef(e){return e.length}function tf(e){return null==e?"":String(e)}function nf(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function rf(e,t,n){return">"+(n?"":" ")+e}function af(e,t){return sf(e,t.inConstruct,!0)&&!sf(e,t.notInConstruct,!1)}function sf(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function of(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if("\n"===n.unsafe[a].character&&af(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function lf(e,t,n){return(n?"":" ")+e}function cf(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function uf(e){return"&#x"+e.toString(16).toUpperCase()+";"}function df(e,t,n){const r=Hl(e),a=Hl(t);return void 0===r?void 0===a?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===a?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===a?{inside:!1,outside:!1}:1===a?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===a?{inside:!1,outside:!1}:1===a?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function ff(e,t,n,r){const a=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),s=n.enter("emphasis"),o=n.createTracker(r),i=o.move(a);let l=o.move(n.containerPhrasing(e,{after:a,before:i,...o.current()}));const c=l.charCodeAt(0),u=df(r.before.charCodeAt(r.before.length-1),c,a);u.inside&&(l=uf(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=df(r.after.charCodeAt(0),d,a);f.inside&&(l=l.slice(0,-1)+uf(d));const m=o.move(a);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},i+l+m}function mf(e){return e.value||""}function pf(e,t,n,r){const a=cf(n),s='"'===a?"Quote":"Apostrophe",o=n.enter("image");let i=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),i(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(i=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(i=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),i(),e.title&&(i=n.enter(`title${s}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),i()),c+=l.move(")"),o(),c}function hf(e,t,n,r){const a=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const i=n.createTracker(r);let l=i.move("![");const c=n.safe(e.alt,{before:l,after:"]",...i.current()});l+=i.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...i.current()});return o(),n.stack=u,s(),"full"!==a&&c&&c===d?"shortcut"===a?l=l.slice(0,-1):l+=i.move("]"):l+=i.move(d+"]"),l}function gf(e,t,n){let r=e.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const e=n.unsafe[s],t=n.compilePattern(e);let a;if(e.atBreak)for(;a=t.exec(r);){let e=a.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(a.index+1)}}return a+r+a}function xf(e,t){const n=pl(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function bf(e,t,n,r){const a=cf(n),s='"'===a?"Quote":"Apostrophe",o=n.createTracker(r);let i,l;if(xf(e,n)){const t=n.stack;n.stack=[],i=n.enter("autolink");let r=o.move("<");return r+=o.move(n.containerPhrasing(e,{before:r,after:">",...o.current()})),r+=o.move(">"),i(),n.stack=t,r}i=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=o.move(" "+a),c+=o.move(n.safe(e.title,{before:c,after:a,...o.current()})),c+=o.move(a),l()),c+=o.move(")"),i(),c}function yf(e,t,n,r){const a=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const i=n.createTracker(r);let l=i.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...i.current()});l+=i.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...i.current()});return o(),n.stack=u,s(),"full"!==a&&c&&c===d?"shortcut"===a?l=l.slice(0,-1):l+=i.move("]"):l+=i.move(d+"]"),l}function vf(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function wf(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}Zd.peek=function(){return"~"},ff.peek=function(e,t,n){return n.options.emphasis||"*"},mf.peek=function(){return"<"},pf.peek=function(){return"!"},hf.peek=function(){return"!"},gf.peek=function(){return"`"},bf.peek=function(e,t,n){return xf(e,n)?"<":"["},yf.peek=function(){return"["};const kf=Su(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Nf(e,t,n,r){const a=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),s=n.enter("strong"),o=n.createTracker(r),i=o.move(a+a);let l=o.move(n.containerPhrasing(e,{after:a,before:i,...o.current()}));const c=l.charCodeAt(0),u=df(r.before.charCodeAt(r.before.length-1),c,a);u.inside&&(l=uf(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=df(r.after.charCodeAt(0),d,a);f.inside&&(l=l.slice(0,-1)+uf(d));const m=o.move(a+a);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},i+l+m}Nf.peek=function(e,t,n){return n.options.strong||"*"};const jf={blockquote:function(e,t,n,r){const a=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),rf);return a(),o},break:of,code:function(e,t,n,r){const a=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),s=e.value||"",o="`"===a?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(s,lf);return e(),t}const i=n.createTracker(r),l=a.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),a=r,s=0,o=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===a?++s>o&&(o=s):s=1,a=r+t.length,r=n.indexOf(t,a);return o}(s,a)+1,3)),c=n.enter("codeFenced");let u=i.move(l);if(e.lang){const t=n.enter(`codeFencedLang${o}`);u+=i.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...i.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${o}`);u+=i.move(" "),u+=i.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...i.current()})),t()}return u+=i.move("\n"),s&&(u+=i.move(s+"\n")),u+=i.move(l),c(),u},definition:function(e,t,n,r){const a=cf(n),s='"'===a?"Quote":"Apostrophe",o=n.enter("definition");let i=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),i(),!e.url||/[\0- \u007F]/.test(e.url)?(i=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(i=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),i(),e.title&&(i=n.enter(`title${s}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),i()),o(),c},emphasis:ff,hardBreak:of,heading:function(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(function(e,t){let n=!1;return Ru(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Au}),Boolean((!e.depth||e.depth<3)&&pl(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),o=n.containerPhrasing(e,{...s.current(),before:"\n",after:"\n"});return r(),t(),o+"\n"+(1===a?"=":"-").repeat(o.length-(Math.max(o.lastIndexOf("\r"),o.lastIndexOf("\n"))+1))}const o="#".repeat(a),i=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...s.current()});return/^[\t ]/.test(c)&&(c=uf(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),i(),c},html:mf,image:pf,imageReference:hf,inlineCode:gf,link:bf,linkReference:yf,list:function(e,t,n,r){const a=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):vf(n);const i=e.ordered?"."===o?")":".":function(e){const t=vf(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&o===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==o&&"-"!==o||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),wf(n)===o&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(o=i),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,a(),c},listItem:function(e,t,n,r){const a=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let s=n.bulletCurrent||vf(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let o=s.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));const i=n.createTracker(r);i.move(s+" ".repeat(o-s.length)),i.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,i.current()),function(e,t,n){if(t)return(n?"":" ".repeat(o))+e;return(n?s:s+" ".repeat(o-s.length))+e});return l(),c},paragraph:function(e,t,n,r){const a=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),a(),o},root:function(e,t,n,r){return(e.children.some(function(e){return kf(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:Nf,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(wf(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function Cf(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function Sf(e){this.exit(e),this.data.inTable=void 0}function Tf(e){this.enter({type:"tableRow",children:[]},e)}function If(e){this.exit(e)}function Pf(e){this.enter({type:"tableCell",children:[]},e)}function Ef(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Af));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Af(e,t){return"|"===t?t:e}function Df(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=jf.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return i(function(e,t,n){const r=e.children;let a=-1;const s=[],o=t.enter("table");for(;++a<r.length;)s[a]=l(r[a],t,n);return o(),s}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){const a=l(e,n,r),s=i([a]);return s.slice(0,s.indexOf("\n"))}}};function o(e,t,n,r){const a=n.enter("tableCell"),o=n.enter("phrasing"),i=n.containerPhrasing(e,{...r,before:s,after:s});return o(),a(),i}function i(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||ef,s=[],o=[],i=[],l=[];let c=0,u=-1;for(;++u<e.length;){const t=[],r=[];let s=-1;for(e[u].length>c&&(c=e[u].length);++s<e[u].length;){const o=tf(e[u][s]);if(!1!==n.alignDelimiters){const e=a(o);r[s]=e,(void 0===l[s]||e>l[s])&&(l[s]=e)}t.push(o)}o[u]=t,i[u]=r}let d=-1;if("object"==typeof r&&"length"in r)for(;++d<c;)s[d]=nf(r[d]);else{const e=nf(r);for(;++d<c;)s[d]=e}d=-1;const f=[],m=[];for(;++d<c;){const e=s[d];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let a=!1===n.alignDelimiters?1:Math.max(1,l[d]-t.length-r.length);const o=t+"-".repeat(a)+r;!1!==n.alignDelimiters&&(a=t.length+a+r.length,a>l[d]&&(l[d]=a),m[d]=a),f[d]=o}o.splice(1,0,f),i.splice(1,0,m),u=-1;const p=[];for(;++u<o.length;){const e=o[u],t=i[u];d=-1;const r=[];for(;++d<c;){const a=e[d]||"";let o="",i="";if(!1!==n.alignDelimiters){const e=l[d]-(t[d]||0),n=s[d];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),i=" ".repeat(e/2-.5)):(o=" ".repeat(e/2),i=o):i=" ".repeat(e)}!1===n.delimiterStart||d||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===a||!1===n.delimiterStart&&!d||r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(a),!1!==n.alignDelimiters&&r.push(i),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&d===c-1||r.push("|")}p.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return p.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:a})}function l(e,t,n){const r=e.children;let a=-1;const s=[],i=t.enter("tableRow");for(;++a<r.length;)s[a]=o(r[a],0,t,n);return i(),s}}function Rf(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function Ff(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let a,s=-1;for(;++s<r.length;){const e=r[s];if("paragraph"===e.type){a=e;break}}a===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function _f(e,t,n,r){const a=e.children[0],s="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",i=n.createTracker(r);s&&i.move(o);let l=jf.listItem(e,t,n,{...r,...i.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}const Lf={tokenize:function(e,t,n){let r=0;return function t(s){if((87===s||119===s)&&r<3)return r++,e.consume(s),t;if(46===s&&3===r)return e.consume(s),a;return n(s)};function a(e){return null===e?n(e):t(e)}},partial:!0},Mf={tokenize:function(e,t,n){let r,a,s;return o;function o(t){return 46===t||95===t?e.check(zf,l,i)(t):null===t||_l(t)||Ol(t)||45!==t&&Ml(t)?l(t):(s=!0,e.consume(t),o)}function i(t){return 95===t?r=!0:(a=r,r=void 0),e.consume(t),o}function l(e){return a||r||!s?n(e):t(e)}},partial:!0},Of={tokenize:function(e,t){let n=0,r=0;return a;function a(o){return 40===o?(n++,e.consume(o),a):41===o&&r<n?s(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(zf,t,s)(o):null===o||_l(o)||Ol(o)?t(o):(e.consume(o),a)}function s(t){return 41===t&&r++,e.consume(t),a}},partial:!0},zf={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),s):93===o?(e.consume(o),a):60===o||null===o||_l(o)||Ol(o)?t(o):n(o)}function a(e){return null===e||40===e||91===e||_l(e)||Ol(e)?t(e):r(e)}function s(e){return Tl(e)?o(e):n(e)}function o(t){return 59===t?(e.consume(t),r):Tl(t)?(e.consume(t),o):n(t)}},partial:!0},Bf={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return Il(e)?n(e):t(e)}},partial:!0},Uf={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!Wf.call(r,r.previous)||Gf(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Lf,e.attempt(Mf,e.attempt(Of,a),n),n)(t)};function a(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Wf},$f={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let a="",s=!1;return function(t){if((72===t||104===t)&&Qf.call(r,r.previous)&&!Gf(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o;return n(t)};function o(t){if(Tl(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){const n=a.toLowerCase();if("http"===n||"https"===n)return e.consume(t),i}return n(t)}function i(t){return 47===t?(e.consume(t),s?l:(s=!0,i)):n(t)}function l(t){return null===t||El(t)||_l(t)||Ol(t)||Ml(t)?n(t):e.attempt(Mf,e.attempt(Of,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Qf},Vf={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let a,s;return function(t){if(!Xf(t)||!Kf.call(r,r.previous)||Gf(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(t)};function o(t){return Xf(t)?(e.consume(t),o):64===t?(e.consume(t),i):n(t)}function i(t){return 46===t?e.check(Bf,c,l)(t):45===t||95===t||Il(t)?(s=!0,e.consume(t),i):c(t)}function l(t){return e.consume(t),a=!0,i}function c(o){return s&&a&&Tl(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:Kf},qf={};let Hf=48;for(;Hf<123;)qf[Hf]=Vf,Hf++,58===Hf?Hf=65:91===Hf&&(Hf=97);function Wf(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||_l(e)}function Qf(e){return!Tl(e)}function Kf(e){return!(47===e||Xf(e))}function Xf(e){return 43===e||45===e||46===e||95===e||Il(e)}function Gf(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}qf[43]=Vf,qf[45]=Vf,qf[46]=Vf,qf[95]=Vf,qf[72]=[Vf,$f],qf[104]=[Vf,$f],qf[87]=[Vf,Uf],qf[119]=[Vf,Uf];const Yf={tokenize:function(e,t,n){const r=this;return Ul(e,function(e){const a=r.events[r.events.length-1];return a&&"gfmFootnoteDefinitionIndent"===a[1].type&&4===a[2].sliceSerialize(a[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function Jf(e,t,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;a--;){const e=r.events[a][1];if("labelImage"===e.type){o=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!o||!o._balanced)return n(a);const i=Sl(r.sliceSerialize({start:o.end,end:r.now()}));if(94!==i.codePointAt(0)||!s.includes(i.slice(1)))return n(a);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)}}function Zf(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},i=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...i),e}function em(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),i};function i(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(i){if(o>999||93===i&&!s||null===i||91===i||_l(i))return n(i);if(93===i){e.exit("chunkString");const s=e.exit("gfmFootnoteCallString");return a.includes(Sl(r.sliceSerialize(s)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(i)}return _l(i)||(s=!0),o++,e.consume(i),92===i?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function tm(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o,i=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(i>999||93===t&&!o||null===t||91===t||_l(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return s=Sl(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return _l(t)||(o=!0),i++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),i++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a.includes(s)||a.push(s),Ul(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function nm(e,t,n){return e.check(Gl,t,e.attempt(Yf,t,n))}function rm(e){e.exit("gfmFootnoteDefinition")}function am(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const a=this.previous,s=this.events;let o=0;return function(t){if(126===a&&"characterEscape"!==s[s.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),i(t)};function i(s){const l=Hl(a);if(126===s)return o>1?r(s):(e.consume(s),o++,i);if(o<2&&!t)return r(s);const c=e.exit("strikethroughSequenceTemporary"),u=Hl(s);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),n(s)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const a={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},s={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",a,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",s,t]],i=t.parser.constructs.insideSpan.null;i&&yl(o,o.length,0,Wl(i,e.slice(r+1,n),t)),yl(o,o.length,0,[["exit",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",a,t]]),yl(e,r-1,n-r+3,o),n=r+o.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class sm{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let a=0;if(0===n&&0===r.length)return;for(;a<e.map.length;){if(e.map[a][0]===t)return e.map[a][1]+=n,void e.map[a][2].push(...r);a+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(const t of r)e.push(t);r=n.pop()}this.map.length=0}}function om(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if("enter"===a[0])"tableContent"===a[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===a[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===a[1].type)break}else"enter"===a[0]&&"tableDelimiterRow"===a[1].type&&(n=!0);t+=1}return r}function im(e,t,n){const r=this;let a,s=0,o=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const a=t>-1?r.events[t][1].type:null,s="tableHead"===a||"tableRow"===a?v:i;if(s===v&&r.parser.lazy[r.now().line])return n(e);return s(e)};function i(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return l(e);return a=!0,o+=1,l(e)}(t)}function l(t){return null===t?n(t):Fl(t)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):Ll(t)?Ul(e,l,"whitespace")(t):(o+=1,a&&(a=!1,s+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),a=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||_l(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),a=!1,Ll(t)?Ul(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):f(t))}function f(t){return 45===t||58===t?p(t):124===t?(a=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),m):y(t)}function m(t){return Ll(t)?Ul(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||Fl(t)?b(t):y(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):y(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(t))}function x(t){return Ll(t)?Ul(e,b,"whitespace")(t):b(t)}function b(n){return 124===n?f(n):(null===n||Fl(n))&&a&&s===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):y(n)}function y(e){return n(e)}function v(t){return e.enter("tableRow"),w(t)}function w(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),w):null===n||Fl(n)?(e.exit("tableRow"),t(n)):Ll(n)?Ul(e,w,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||_l(t)?(e.exit("data"),w(t)):(e.consume(t),92===t?N:k)}function N(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function lm(e,t){let n,r,a,s=-1,o=!0,i=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const f=new sm;for(;++s<e.length;){const m=e[s],p=m[1];"enter"===m[0]?"tableHead"===p.type?(u=!1,0!==d&&(um(f,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(s,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,a=void 0,l=[0,0,0,0],c=[0,s+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(s,0,[["enter",r,t]])),i="tableDelimiterRow"===p.type?2:r?3:1):!i||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type?"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],a=cm(f,t,l,i,void 0,a)),l=c,c=[l[1],s,0,0])):(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],a=cm(f,t,l,i,void 0,a),l=[0,0,0,0]),c[2]=s)):"tableHead"===p.type?(u=!0,d=s):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=s,0!==l[1]?(c[0]=c[1],a=cm(f,t,l,i,s,a)):0!==c[1]&&(a=cm(f,t,c,i,s,a)),i=0):!i||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type||(c[3]=s)}for(0!==d&&um(f,t,d,n,r),f.consume(t.events),s=-1;++s<t.events.length;){const e=t.events[s];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=om(t.events,s))}return e}function cm(e,t,n,r,a,s){const o=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(s.end=Object.assign({},dm(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const i=dm(t.events,n[1]);if(s={type:o,start:Object.assign({},i),end:Object.assign({},i)},e.add(n[1],0,[["enter",s,t]]),0!==n[2]){const a=dm(t.events,n[2]),s=dm(t.events,n[3]),o={type:"tableContent",start:Object.assign({},a),end:Object.assign({},s)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){const r=t.events[n[2]],a=t.events[n[3]];if(r[1].end=Object.assign({},a[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==a&&(s.end=Object.assign({},dm(t.events,a)),e.add(a,0,[["exit",s,t]]),s=void 0),s}function um(e,t,n,r,a){const s=[],o=dm(t.events,n);a&&(a.end=Object.assign({},o),s.push(["exit",a,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function dm(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const fm={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){if(null!==r.previous||!r._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a};function a(t){return _l(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),s):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),s):n(t)}function s(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return Fl(r)?t(r):Ll(r)?e.check({tokenize:mm},t,n)(r):n(r)}}};function mm(e,t,n){return Ul(e,function(e){return null===e?n(e):t(e)},"whitespace")}const pm={};function hm(e){const t=e||pm,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return kl([{text:qf},{document:{91:{name:"gfmFootnoteDefinition",tokenize:tm,continuation:{tokenize:nm},exit:rm}},text:{91:{name:"gfmFootnoteCall",tokenize:em},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Jf,resolveTo:Zf}}},am(e),{flow:{null:{name:"table",tokenize:im,resolveAll:lm}}},{text:{91:fm}}])}(t)),a.push([{transforms:[Fd],enter:{literalAutolink:Id,literalAutolinkEmail:Pd,literalAutolinkHttp:Pd,literalAutolinkWww:Pd},exit:{literalAutolink:Rd,literalAutolinkEmail:Dd,literalAutolinkHttp:Ed,literalAutolinkWww:Ad}},{enter:{gfmFootnoteCallString:Od,gfmFootnoteCall:zd,gfmFootnoteDefinitionLabelString:Bd,gfmFootnoteDefinition:Ud},exit:{gfmFootnoteCallString:$d,gfmFootnoteCall:Vd,gfmFootnoteDefinitionLabelString:qd,gfmFootnoteDefinition:Hd}},{canContainEols:["delete"],enter:{strikethrough:Yd},exit:{strikethrough:Jd}},{enter:{table:Cf,tableData:Pf,tableHeader:Pf,tableRow:Tf},exit:{codeText:Ef,table:Sf,tableData:If,tableHeader:If,tableRow:If}},{exit:{taskListCheckValueChecked:Rf,taskListCheckValueUnchecked:Rf,paragraph:Ff}}]),s.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Sd,notInConstruct:Td},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Sd,notInConstruct:Td},{character:":",before:"[ps]",after:"\\/",inConstruct:Sd,notInConstruct:Td}]},Qd(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Gd}],handlers:{delete:Zd}},Df(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_f}}]}}(t))}function gm({content:e,className:t}){return fe.jsx("div",{className:pe("prose prose-sm max-w-none",t),children:fe.jsx(vd,{remarkPlugins:[hm],components:{h1:({children:e})=>fe.jsx("h1",{className:"text-lg font-bold mt-4 mb-2 text-foreground",children:e}),h2:({children:e})=>fe.jsx("h2",{className:"text-base font-bold mt-3 mb-2 text-foreground",children:e}),h3:({children:e})=>fe.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1 text-foreground",children:e}),p:({children:e})=>fe.jsx("p",{className:"text-sm mb-2 last:mb-0 text-foreground",children:e}),ul:({children:e})=>fe.jsx("ul",{className:"list-disc list-inside mb-2 space-y-1",children:e}),ol:({children:e})=>fe.jsx("ol",{className:"list-decimal list-inside mb-2 space-y-1",children:e}),li:({children:e})=>fe.jsx("li",{className:"text-sm text-foreground",children:e}),code:({inline:e,children:t,...n})=>e?fe.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs font-mono text-foreground",...n,children:t}):fe.jsx("code",{className:"block bg-muted p-2 rounded text-xs font-mono overflow-x-auto mb-2 text-foreground",...n,children:t}),pre:({children:e})=>fe.jsx("pre",{className:"bg-muted p-2 rounded overflow-x-auto mb-2",children:e}),a:({children:e,href:t})=>fe.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:e}),blockquote:({children:e})=>fe.jsx("blockquote",{className:"border-l-4 border-primary pl-3 italic my-2 text-muted-foreground",children:e}),strong:({children:e})=>fe.jsx("strong",{className:"font-bold text-foreground",children:e}),em:({children:e})=>fe.jsx("em",{className:"italic text-foreground",children:e})},children:e})})}function xm({open:t,onOpenChange:n,placeId:r,placeName:a,onMakeManager:s,onMakeMembers:o,currentManagerId:l,currentMemberIds:c=[]}){const[u,d]=e.useState([]),[f,m]=e.useState(!1),[p,h]=e.useState(""),{data:g=[],isLoading:x}=zr({enabled:t}),b=e.useMemo(()=>{let e=[...g];if(e.sort((e,t)=>{const n=e.userName?.toLowerCase()||"",r=t.userName?.toLowerCase()||"";return n.localeCompare(r)}),p){const t=p.toLowerCase();e=e.filter(e=>e.userName?.toLowerCase().includes(t)||e.userEmail?.toLowerCase().includes(t))}return e},[g,p]),y=e=>{d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},v=1===u.length,w=u.length>0;return fe.jsx(Ie,{open:t,onOpenChange:n,children:fe.jsxs(Re,{className:"max-w-2xl",children:[fe.jsx(Fe,{children:fe.jsxs(Le,{className:"flex items-center gap-2",children:[fe.jsx(i.Users,{className:"h-5 w-5"}),"Gerenciar Acessos - ",a]})}),fe.jsxs("div",{className:"relative",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),fe.jsx(ye,{placeholder:"Buscar por nome ou email...",value:p,onChange:e=>h(e.target.value),className:"pl-9"})]}),fe.jsx(Rr,{className:"h-[400px] pr-4",children:x?fe.jsx("div",{className:"space-y-2",children:[...Array(5)].map((e,t)=>fe.jsx(Mt,{className:"h-16 w-full"},t))}):0===b.length?fe.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[fe.jsx(i.Users,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:p?"Nenhum usuário encontrado":"Nenhum usuário disponível"})]}):fe.jsx("div",{className:"space-y-2",children:b.map(e=>{const t=e.userId===l,n=c.includes(e.userId||""),r=u.includes(e.userId||"");return fe.jsxs("div",{className:pe("flex items-center gap-3 p-3 rounded-lg border transition-colors",r&&"bg-accent border-primary","hover:bg-accent/50 cursor-pointer"),onClick:()=>y(e.userId||""),children:[fe.jsx(rt,{checked:r,onCheckedChange:()=>y(e.userId||""),onClick:e=>e.stopPropagation()}),fe.jsxs("div",{className:"flex-1",children:[fe.jsxs("div",{className:"flex items-center gap-2",children:[fe.jsx("p",{className:"font-medium",children:e.userName}),t&&fe.jsx(i.Crown,{className:"h-4 w-4 text-yellow-500"})]}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:e.userEmail})]}),(t||n)&&fe.jsx("div",{className:"text-xs text-muted-foreground",children:t?"Gestor":"Membro"})]},e.userId)})})}),fe.jsxs(_e,{className:"flex gap-2 sm:gap-2",children:[fe.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:u.length>0&&fe.jsxs("span",{children:[u.length," selecionado(s)"]})}),v&&s&&fe.jsxs(xe,{onClick:async()=>{if(s&&1===u.length){m(!0);try{await s(u[0],r),d([])}finally{m(!1)}}},disabled:f,variant:"outline",children:[fe.jsx(i.Crown,{className:"h-4 w-4 mr-2"}),"Tornar Gestor"]}),w&&o&&fe.jsxs(xe,{onClick:async()=>{if(o&&0!==u.length){m(!0);try{await o(u,r),d([])}finally{m(!1)}}},disabled:f,children:[fe.jsx(i.UserPlus,{className:"h-4 w-4 mr-2"}),"Tornar ",u.length>1?"Membros":"Membro"]})]})]})})}function bm({place:t,level:n=0,manageAccessConfig:r}){const[a,s]=e.useState(!1),[o,l]=e.useState(!1),c=t.subPlaces&&t.subPlaces.length>0,u=t.isActive??!0,d=t.usersCount??0;return fe.jsxs("div",{children:[fe.jsxs(Fa,{open:a,onOpenChange:s,children:[fe.jsxs("div",{className:"flex items-center gap-2 py-3 px-4 hover:bg-accent/50 transition-colors",style:{paddingLeft:2*n+1+"rem"},children:[c?fe.jsxs(_a,{className:"flex items-center gap-2 flex-1",children:[fe.jsx(i.ChevronRight,{className:pe("h-4 w-4 transition-transform shrink-0",a&&"rotate-90")}),fe.jsx(i.Building2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),fe.jsx("span",{className:"font-medium",children:t.name}),fe.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",t.subPlaces.length,")"]})]}):fe.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[fe.jsx("div",{className:"w-4 shrink-0"}),fe.jsx(i.Building2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),fe.jsx("span",{className:"font-medium",children:t.name})]}),fe.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[fe.jsxs("div",{className:"flex items-center gap-1.5",children:[fe.jsx(i.Users,{className:"h-3.5 w-3.5 text-muted-foreground"}),fe.jsx("span",{className:"text-sm text-muted-foreground",children:d})]}),fe.jsx(ot,{variant:u?"default":"secondary",className:"text-xs",children:u?"Ativo":"Inativo"}),r&&fe.jsx(xo,{customActions:[{label:"Gerenciar Acessos",icon:i.Settings,onClick:()=>l(!0),variant:"default"}],renderAs:"dropdown",variant:"compact"})]})]}),c&&fe.jsx(La,{children:t.subPlaces.map(e=>fe.jsx(bm,{place:e,level:n+1,manageAccessConfig:r},e.id))})]}),0===n&&fe.jsx(Ya,{}),r&&fe.jsx(xm,{open:o,onOpenChange:l,placeId:t.id,placeName:t.name,onMakeManager:r.onMakeManager,onMakeMembers:r.onMakeMembers,currentManagerId:r.getCurrentManagerId?.(t.id),currentMemberIds:r.getCurrentMemberIds?.(t.id)})]})}var ym=Object.defineProperty,vm=(e,t,n)=>((e,t,n)=>t in e?ym(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n);const wm=new class{constructor(){vm(this,"baseUrl",(void 0).VITE_QUALIEX_API_URL)}async makeApiCall(e,t,n){const r=fn.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const a=Kt.getAccessToken();if(!a)throw new Error("Token Qualiex não encontrado");if(!n||""===n.trim())throw new Error("Alias da unidade é obrigatório");const s=new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{s.searchParams.append(e,t)});const o=await fetch(s.toString(),{method:"GET",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json","un-alias":n}});if(!o.ok){const e=new Error(`API call failed: ${o.status}`);throw e.status=o.status,e}return o.json()}buildHierarchy(e){const t=new Map,n=[];return e.forEach(e=>{t.set(e.id,{...e,subPlaces:[]})}),e.forEach(e=>{const r=t.get(e.id);if(e.parentId){const a=t.get(e.parentId);a?(a.subPlaces=a.subPlaces||[],a.subPlaces.push(r)):n.push(r)}else n.push(r)}),n}async getPlaces(e,t){try{const n=await this.makeApiCall("/api/common/v1/places",{companyId:t},e),r=n.data||n||[];return this.buildHierarchy(r)}catch(n){if(await fn.handleApiError(n))try{const n=await this.makeApiCall("/api/common/v1/places",{companyId:t},e),r=n.data||n||[];return this.buildHierarchy(r)}catch(r){return Yt.handleError(r instanceof Error?r:"Erro ao buscar locais após renovação de token",!0),[]}return Yt.handleError(n instanceof Error?n.message:"Erro ao buscar locais",!0),[]}}};Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return o.toast}}),exports.AUTH_CONFIG=gn,exports.Accordion=la,exports.AccordionContent=da,exports.AccordionItem=ca,exports.AccordionTrigger=ua,exports.ActionButton=be,exports.ActionMenu=xo,exports.ActionMenuItems=Sr,exports.Alert=na,exports.AlertDescription=aa,exports.AlertDialog=Un,exports.AlertDialogAction=Gn,exports.AlertDialogCancel=Yn,exports.AlertDialogContent=Hn,exports.AlertDialogDescription=Xn,exports.AlertDialogFooter=Qn,exports.AlertDialogHeader=Wn,exports.AlertDialogOverlay=qn,exports.AlertDialogPortal=Vn,exports.AlertDialogTitle=Kn,exports.AlertDialogTrigger=$n,exports.AlertTitle=ra,exports.AppHeader=Co,exports.AppLayout=_o,exports.AppSidebar=Fo,exports.AspectRatio=fa,exports.AuthErrorInterceptor=un,exports.AuthProvider=({children:t})=>{const[n,r]=e.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let a=null;try{a=g.useQueryClient()}catch{}const[s,o]=e.useState(!1),[i,l]=e.useState(0),c=e.useCallback(e=>{r(t=>({...t,...e}))},[]),u=e.useCallback(e=>{r(t=>({...t,isLoading:e}))},[]),d=e.useCallback(()=>{r({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),f=e.useCallback(async e=>{try{u(!0);const r=Kt.getAccessToken();if(!r)return;const s=await sn.generateToken(r,e.alias,void 0,!0);if(!s)return;Kt.setSupabaseToken(s),Kt.setSelectedAlias(e.alias);const o=Kt.extractTokenData(),i=o?.alias||e.alias,l=o?.companyId||Kt.getCompanyId(e.alias),d={id:l||e.id,name:e.name,alias:i};let f=null,m=null;if(n.user?.id&&i&&l)try{const e=(await hn.fetchActiveUsersMap(i,l)).get(n.user.id);if(e){const t=_n(e);f=t.placeId,m=t.placeName}}catch(t){}c({alias:i,selectedUnit:d,placeId:f,placeName:m,activePlaceId:f,activePlaceName:m}),a&&(await a.clear(),await new Promise(e=>setTimeout(e,100)))}catch(t){}finally{u(!1)}},[c,a,u,n.user]),m=e.useCallback(async()=>await Mn.processCallback(),[]),p=e.useCallback(async()=>{Mn.logout(),d(),a&&await a.clear()},[d,a]),h=e.useCallback(e=>{o(e)},[]),x=e.useCallback(()=>{l(e=>e+1)},[]),b=e.useCallback(()=>{l(e=>e+1)},[]);e.useEffect(()=>{if(!n.isAuthenticated)return;let e=!0;const t=setInterval(()=>{e&&(Kt.areAllTokensValid()||e&&p())},6e5);return()=>{e=!1,clearInterval(t)}},[n.isAuthenticated,p]),e.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await Mn.initialize();if(!e)return;t&&t.isAuthenticated?c({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias,placeId:t.placeId,placeName:t.placeName,activePlaceId:t.activePlaceId,activePlaceName:t.activePlaceName}):e&&u(!1)}catch(t){e&&(un.handleError(t),u(!1))}})(),()=>{e=!1}},[c,u,p]);const y=e.useMemo(()=>({...n,logout:p,processCallback:m,switchUnit:f,availableUnits:n.companies,isSearchVisible:s,setSearchVisible:h,clearSearch:x,refreshData:b}),[n.user,n.companies,n.alias,n.isAuthenticated,n.isLoading,n.selectedUnit,n.userId,n.userAlias,n.placeId,n.placeName,n.activePlaceId,n.activePlaceName,p,m,f,s,h,x,b]);return fe.jsx(On.Provider,{value:y,children:t})},exports.AuthService=Mn,exports.Avatar=ma,exports.AvatarFallback=ha,exports.AvatarImage=pa,exports.Badge=ot,exports.BaseForm=Ur,exports.Breadcrumb=ga,exports.BreadcrumbEllipsis=ka,exports.BreadcrumbItem=ba,exports.BreadcrumbLink=ya,exports.BreadcrumbList=xa,exports.BreadcrumbPage=va,exports.BreadcrumbSeparator=wa,exports.BulkActionBar=qr,exports.Button=xe,exports.CRUD_CONFIG=xn,exports.Calendar=Ra,exports.CallbackPage=()=>{const{processCallback:t}=zn(),[n,r]=e.useState(null),[a,s]=e.useState(!1);e.useEffect(()=>{(async()=>{try{if(await t()){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){r(e?.message||"Erro durante a autenticação. Tente novamente.")}})()},[t]);const o=async()=>{s(!0),r(null);try{await t()||r("Falha na autenticação. Tente novamente.")}catch(e){r(e?.message||"Erro ao tentar novamente.")}finally{s(!1)}},l=()=>{window.location.href="/"};return n?fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsxs(je,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[fe.jsx(i.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),fe.jsxs(Se,{className:"space-y-4",children:[fe.jsx(na,{variant:"destructive",children:fe.jsx(aa,{children:n})}),fe.jsx("div",{className:"text-sm text-muted-foreground",children:fe.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),fe.jsxs("div",{className:"flex gap-2",children:[fe.jsx(xe,{onClick:o,disabled:a,className:"flex-1",children:a?fe.jsxs(fe.Fragment,{children:[fe.jsx(lt,{size:"sm",className:"mr-2"}),"Tentando..."]}):fe.jsxs(fe.Fragment,{children:[fe.jsx(i.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),fe.jsx(xe,{onClick:l,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"flex justify-center mb-4",children:fe.jsx(lt,{size:"lg"})}),fe.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=ke,exports.CardContent=Se,exports.CardDescription=Ce,exports.CardFooter=Te,exports.CardHeader=Ne,exports.CardSkeleton=lr,exports.CardTitle=je,exports.Cards=function({data:e,renderCard:t,isLoading:n=!1,emptyMessage:r="Nenhum item encontrado",columns:a,gap:s="md",className:o}){return n?fe.jsx(Ba,{cols:a?String(a):"auto-fit",gap:s,className:o,children:[...Array(6)].map((e,t)=>fe.jsx(Mt,{className:"h-48 w-full"},t))}):0===e.length?fe.jsx("div",{className:"flex items-center justify-center p-8",children:fe.jsx("div",{className:"text-center text-muted-foreground",children:fe.jsx("p",{children:r})})}):fe.jsx(Ba,{cols:a?String(a):"auto-fit",gap:s,className:o,children:e.map(t)})},exports.ChatbotPage=function(){const[t,n]=e.useState(!1),[r,a]=e.useState(""),{messages:s,isLoading:o,error:l,sendMessage:c}=Uo(),u=e.useRef(null),d=e.useRef(null);e.useEffect(()=>{if(u.current){const e=u.current.querySelector("[data-radix-scroll-area-viewport]");e&&(e.scrollTop=e.scrollHeight)}},[s]),e.useEffect(()=>{t&&d.current&&d.current.focus()},[t]),e.useEffect(()=>{const e=e=>{"Escape"===e.key&&t&&n(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);const f=()=>{r.trim()&&!o&&(c(r),a(""))};return fe.jsxs(fe.Fragment,{children:[fe.jsx(xe,{onClick:()=>n(!t),className:"fixed bottom-6 right-6 h-14 w-14 rounded-full shadow-lg z-50",size:"icon",children:t?fe.jsx(i.X,{className:"h-6 w-6"}):fe.jsx(i.MessageCircle,{className:"h-6 w-6"})}),t&&fe.jsxs(ke,{className:"fixed bottom-24 right-6 w-96 h-[600px] shadow-xl z-50 flex flex-col",children:[fe.jsxs(Ne,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[fe.jsx(je,{className:"text-lg font-semibold",children:"Chat Assistant"}),fe.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>n(!1),className:"h-8 w-8",children:fe.jsx(i.X,{className:"h-4 w-4"})})]}),fe.jsxs(Se,{className:"flex-1 flex flex-col p-0 overflow-hidden",children:[fe.jsx(Rr,{ref:u,className:"flex-1 px-4",children:fe.jsxs("div",{className:"space-y-4 py-4",children:[s.map(e=>fe.jsx("div",{className:"flex "+("user"===e.role?"justify-end":"justify-start"),children:fe.jsx("div",{className:"max-w-[80%] rounded-lg px-4 py-2 "+("user"===e.role?"bg-primary text-primary-foreground":"bg-muted"),children:"assistant"===e.role?fe.jsx(gm,{content:e.content}):fe.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.content})})},e.id)),o&&fe.jsx("div",{className:"flex justify-start",children:fe.jsx("div",{className:"bg-muted rounded-lg px-4 py-2",children:fe.jsxs("div",{className:"flex space-x-2",children:[fe.jsx("div",{className:"w-2 h-2 bg-foreground/40 rounded-full animate-bounce"}),fe.jsx("div",{className:"w-2 h-2 bg-foreground/40 rounded-full animate-bounce [animation-delay:0.2s]"}),fe.jsx("div",{className:"w-2 h-2 bg-foreground/40 rounded-full animate-bounce [animation-delay:0.4s]"})]})})}),l&&fe.jsx("div",{className:"text-center text-sm text-destructive py-2",children:l})]})}),fe.jsx("div",{className:"border-t p-4",children:fe.jsxs("div",{className:"flex space-x-2",children:[fe.jsx(ye,{ref:d,value:r,onChange:e=>a(e.target.value),onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),f())},placeholder:"Digite sua mensagem...",disabled:o,className:"flex-1"}),fe.jsx(xe,{onClick:f,disabled:o||!r.trim(),size:"icon",children:fe.jsx(i.Send,{className:"h-4 w-4"})})]})})]})]})]})},exports.Checkbox=rt,exports.Collapsible=Fa,exports.CollapsibleContent=La,exports.CollapsibleTrigger=_a,exports.ColorPicker=Dr,exports.Command=Pt,exports.CommandDialog=({children:e,...t})=>fe.jsx("div",{...t,children:fe.jsx(Pt,{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})}),exports.CommandEmpty=Dt,exports.CommandGroup=Rt,exports.CommandInput=Et,exports.CommandItem=_t,exports.CommandList=At,exports.CommandSeparator=Ft,exports.CommandShortcut=Lt,exports.CreatableCombobox=Mr,exports.CrudCards=function({manager:e,config:t,onEdit:n,onDelete:r}){return e.isLoading?fe.jsx(Ba,{children:Array.from({length:3}).map((e,t)=>fe.jsxs(ke,{children:[fe.jsxs(Ne,{children:[fe.jsx(Mt,{className:"h-4 w-3/4"}),fe.jsx(Mt,{className:"h-3 w-1/2"})]}),fe.jsx(Se,{children:fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(Mt,{className:"h-3 w-full"}),fe.jsx(Mt,{className:"h-3 w-2/3"})]})})]},t))}):fe.jsx(Ma.Root,{children:e.entities.map(e=>fe.jsxs(Ma.Item,{onClick:()=>n(e),children:[fe.jsx(Ne,{className:"pb-3",children:fe.jsxs("div",{className:"flex items-start justify-between",children:[fe.jsxs("div",{className:"flex-1 min-w-0",children:[fe.jsx(je,{className:"text-base leading-6 truncate",children:e.title||e.name||"Sem título"}),fe.jsx(Ce,{className:"text-sm",children:s.format(new Date(e.created_at),"dd/MM/yyyy HH:mm",{locale:Da})})]}),fe.jsxs("div",{className:"flex items-center gap-2 ml-2",children:[e.link&&fe.jsx(xe,{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),o.toast.info("Link copiado para a área de transferência"))}catch(t){window.location.href=e}})(e.link)},title:"Abrir link externo",children:fe.jsx(i.ExternalLink,{className:"h-4 w-4"})}),fe.jsx("div",{onClick:e=>e.stopPropagation(),children:fe.jsx(Tr,{onEdit:()=>n(e),onDelete:r?()=>r(e):void 0,canDelete:!!r})})]})]})}),fe.jsx(Se,{className:"pt-0",children:fe.jsx("div",{className:"space-y-2",children:t.cardFields?.map(t=>{const n=e[t.key];return n?fe.jsx(Ma.Field,{label:t.label,value:t.render?t.render(n,e):String(n)},String(t.key)):null})})})]},e.id))})},exports.CrudPageInternal=Gr,exports.CrudPagination=Vr,exports.CrudPrimitiveFilterBar=function({searchValue:e="",onSearchChange:t,customFilters:n=[],onClearFilters:r,showClearButton:a=!0,layout:s="horizontal"}){const o=e||n.length>0;return fe.jsxs("div",{className:`flex ${"vertical"===s?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[t&&fe.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),fe.jsx(ye,{type:"text",placeholder:"Buscar...",value:e,onChange:e=>t(e.target.value),className:"pl-9 h-9"})]}),n.map((e,t)=>fe.jsx("div",{className:"vertical"===s?"w-full":"",children:e},t)),a&&o&&r&&fe.jsxs(xe,{variant:"ghost",size:"sm",onClick:r,className:"h-9 px-3 whitespace-nowrap",children:[fe.jsx(i.X,{size:14,className:"mr-1"}),"Limpar"]})]})},exports.CrudPrimitivePagination=$r,exports.CrudPrimitiveTable=function({data:t,columns:n,sortField:r,sortDirection:a,onSort:s,onRowClick:o,renderActions:l,isLoading:c=!1,emptyMessage:u="Nenhum item encontrado",className:d,enableSelection:f=!1,selectedIds:m=[],onSelectItem:p,onSelectAll:h,isAllSelected:g=!1}){const x=e.useMemo(()=>{const e=n.reduce((e,t)=>t.width?e:e+(t.weight??1),0);return n.map(t=>{if(t.width)return`${t.width}px`;if(t.minWidth&&!t.weight)return`${t.minWidth}px`;const n=(t.weight??1)/e*100;return t.minWidth?`minmax(${t.minWidth}px, ${n}%)`:`${n}%`})},[n]);return c?fe.jsx("div",{className:"flex-1 overflow-auto",children:fe.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,t)=>fe.jsx(Mt,{className:"h-12 w-full"},t))})}):0===t.length?fe.jsx("div",{className:"flex-1 flex items-center justify-center",children:fe.jsx("div",{className:"text-center text-muted-foreground",children:fe.jsx("p",{children:u})})}):fe.jsx("div",{className:"flex-1 overflow-auto",children:fe.jsxs(Zn,{className:d,children:[fe.jsx(er,{className:"sticky top-0 bg-background z-10",children:fe.jsxs(rr,{children:[f&&fe.jsx(ar,{className:"w-[40px]",children:fe.jsx(rt,{checked:g,onCheckedChange:h,"aria-label":"Selecionar todos"})}),n.map((e,t)=>{return fe.jsx(ar,{className:e.className,style:{width:x[t]},children:e.sortable&&s?fe.jsxs("button",{onClick:()=>s(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(n=String(e.key),r!==n?fe.jsx(i.ArrowUpDown,{size:14,className:"ml-1 opacity-50"}):"asc"===a?fe.jsx(i.ArrowUp,{size:14,className:"ml-1"}):fe.jsx(i.ArrowDown,{size:14,className:"ml-1"}))]}):fe.jsx("span",{className:"font-medium",children:e.header})},String(e.key));var n}),l&&fe.jsx(ar,{className:"w-[80px] text-right",children:"Ações"})]})}),fe.jsx(tr,{children:t.map(e=>fe.jsxs(rr,{onClick:()=>o?.(e),className:o?"cursor-pointer":"",children:[f&&fe.jsx(sr,{children:fe.jsx(rt,{checked:m.includes(e.id),onCheckedChange:()=>p?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`Selecionar item ${e.id}`})}),n.map(t=>fe.jsx(sr,{className:t.className,children:t.render?t.render(e):String(e[t.key]??"-")},String(t.key))),l&&fe.jsx(sr,{className:"text-right",onClick:e=>e.stopPropagation(),children:l(e)})]},e.id))})]})})},exports.CrudTable=Pr,exports.DataList=Ma,exports.DeleteConfirmationDialog=Jn,exports.Dialog=Ie,exports.DialogClose=Ae,exports.DialogContent=Re,exports.DialogDescription=Me,exports.DialogFooter=_e,exports.DialogHeader=Fe,exports.DialogOverlay=De,exports.DialogPortal=Ee,exports.DialogTitle=Le,exports.DialogTrigger=Pe,exports.DropdownMenu=dr,exports.DropdownMenuCheckboxItem=wr,exports.DropdownMenuContent=yr,exports.DropdownMenuGroup=mr,exports.DropdownMenuItem=vr,exports.DropdownMenuLabel=Nr,exports.DropdownMenuPortal=pr,exports.DropdownMenuRadioGroup=gr,exports.DropdownMenuRadioItem=kr,exports.DropdownMenuSeparator=jr,exports.DropdownMenuShortcut=Cr,exports.DropdownMenuSub=hr,exports.DropdownMenuSubContent=br,exports.DropdownMenuSubTrigger=xr,exports.DropdownMenuTrigger=fr,exports.EmailService=zo,exports.EmptyState=ur,exports.EntitySelect=Or,exports.ErrorBoundary=Oo,exports.FilterBar=Xr,exports.Form=Oe,exports.FormControl=qe,exports.FormDescription=He,exports.FormField=({...e})=>fe.jsx(ze.Provider,{value:{name:e.name},children:fe.jsx(u.Controller,{...e})}),exports.FormItem=$e,exports.FormLabel=Ve,exports.FormMessage=We,exports.FormSkeleton=function({fields:e=4}){return fe.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,t)=>fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(Mt,{className:"h-4 w-24"}),fe.jsx(Mt,{className:"h-10 w-full"})]},t)),fe.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[fe.jsx(Mt,{className:"h-10 w-20"}),fe.jsx(Mt,{className:"h-10 w-20"})]})]})},exports.Grid=Ba,exports.HeaderSkeleton=function(){return fe.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[fe.jsxs("div",{className:"flex items-center space-x-3",children:[fe.jsx(Mt,{className:"h-8 w-8 rounded-full"}),fe.jsx(Mt,{className:"h-6 w-32"})]}),fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsx(Mt,{className:"h-8 w-8"}),fe.jsx(Mt,{className:"h-8 w-24"})]})]})},exports.IconPicker=Lr,exports.Input=ye,exports.Label=we,exports.LoadingState=function({isLoading:e,children:t,className:n,type:r="spinner",size:a="md"}){return e?"overlay"===r?fe.jsxs("div",{className:pe("relative",n),children:[t,fe.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:fe.jsx(lt,{size:a})})]}):"skeleton"===r?fe.jsx("div",{className:pe("animate-pulse",n),children:fe.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):fe.jsx("div",{className:pe("flex items-center justify-center py-8",n),children:fe.jsx(lt,{size:a})}):fe.jsx(fe.Fragment,{children:t})},exports.LoginPage=()=>fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),fe.jsxs(Se,{className:"text-center space-y-4",children:[fe.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),fe.jsx(xe,{onClick:async()=>{yn()?await Mn.loginDev():Mn.loginProd()},className:"w-full",size:"lg",children:yn()?"Login Desenvolvimento":"Entrar com Qualiex"})]})]})}),exports.MESSAGES=kn,exports.ManageAccessModal=xm,exports.MarkdownMessage=gm,exports.MultiSelect=function({options:t=[],value:n=[],onChange:r,getOptionValue:a=e=>e.value,getOptionLabel:s=e=>e.label,placeholder:o="Selecione itens...",label:l,icon:c,emptyMessage:u="Nenhum item disponível.",searchPlaceholder:d="Buscar...",disabled:f=!1,required:m=!1,isLoading:p=!1,error:h,className:g,sortOptions:x=!0,maxDisplayedBadges:b,onOpen:y,onClose:v}){const[w,k]=e.useState(!1),[N,j]=e.useState(""),C=e.useMemo(()=>{const e=t.map(e=>({original:e,value:a(e),label:s(e)}));return x?e.sort((e,t)=>e.label.localeCompare(t.label,"pt-BR",{sensitivity:"base"})):e},[t,a,s,x]),S=e.useMemo(()=>{if(!N)return C;const e=Ot(N);return C.filter(t=>Ot(t.label).includes(e))},[C,N]),T=e.useMemo(()=>C.filter(e=>n.includes(e.value)),[C,n]),I=(e,t)=>{t.preventDefault(),t.stopPropagation(),r&&r(n.filter(t=>t!==e))};if(p)return fe.jsxs("div",{className:pe("space-y-2",g),children:[l&&fe.jsxs(we,{children:[l,m&&fe.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),fe.jsx(Mt,{className:"h-10 w-full"})]});const P="string"==typeof h?h:h?"Erro ao carregar dados":void 0;if(P)return fe.jsxs("div",{className:pe("space-y-2",g),children:[l&&fe.jsxs(we,{children:[l,m&&fe.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),fe.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[fe.jsx(i.AlertCircle,{className:"h-4 w-4"}),fe.jsx("span",{className:"text-sm",children:P})]})]});const E=b?T.slice(0,b):T,A=b&&T.length>b?T.length-b:0;return fe.jsxs("div",{className:pe("space-y-2",g),children:[l&&fe.jsxs(we,{children:[l,m&&fe.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),fe.jsxs(St,{open:w,onOpenChange:e=>{k(e),e?y?.():(j(""),v?.())},children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",role:"combobox","aria-expanded":w,disabled:f,className:pe("w-full justify-between min-h-10 h-auto",0===T.length&&"text-muted-foreground"),children:[0===T.length?fe.jsxs("span",{className:"flex items-center gap-2",children:[c&&fe.jsx(c,{className:"h-4 w-4"}),o]}):fe.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[E.map(e=>fe.jsxs(ot,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,fe.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&I(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>I(e.value,t),children:fe.jsx(i.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),A>0&&fe.jsxs(ot,{variant:"outline",className:"gap-1",children:["+",A]})]}),fe.jsx(i.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),fe.jsx(It,{className:"w-full p-0",align:"start",children:fe.jsxs(Pt,{children:[fe.jsx(Et,{placeholder:d,value:N,onChange:e=>j(e.target.value)}),fe.jsx(At,{children:0===t.length?fe.jsx(Dt,{children:u}):0===S.length?fe.jsx(Dt,{children:"Nenhum item encontrado."}):fe.jsx(Rt,{children:S.map(e=>fe.jsxs(_t,{value:e.value,onSelect:()=>(e=>{if(!r)return;const t=n.includes(e)?n.filter(t=>t!==e):[...n,e];r(t)})(e.value),className:"cursor-pointer",children:[fe.jsx(i.Check,{className:pe("mr-2 h-4 w-4",n.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},e.value))})})]})})]}),P&&fe.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[fe.jsx(i.AlertCircle,{className:"h-3 w-3"}),P]})]})},exports.NavigationProvider=wo,exports.PageBreadcrumb=function({items:e,maxItems:t=3,className:n}){return e.length>t&&(e[0],e.slice(-(t-1))),e.length,fe.jsx(ga,{className:n})},exports.Pagination=Ua,exports.PaginationContent=$a,exports.PaginationEllipsis=Qa,exports.PaginationItem=Va,exports.PaginationLink=qa,exports.PaginationNext=Wa,exports.PaginationPrevious=Ha,exports.PlaceCard=bm,exports.PlacesList=function({places:e,isLoading:t,manageAccessConfig:n}){return t?fe.jsx("div",{className:"flex items-center justify-center py-12",children:fe.jsxs("div",{className:"text-center space-y-2",children:[fe.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando locais..."})]})}):e&&0!==e.length?fe.jsxs("div",{className:"space-y-1",children:[fe.jsx("h2",{className:"text-xl font-bold mb-4",children:"Estrutura de Locais"}),e.map(e=>fe.jsx(bm,{place:e,manageAccessConfig:n},e.id))]}):fe.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-3",children:[fe.jsx(i.Building2,{className:"h-12 w-12 text-muted-foreground/50"}),fe.jsxs("div",{children:[fe.jsx("h3",{className:"font-semibold text-lg",children:"Nenhum local encontrado"}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:"Não há locais cadastrados para esta unidade."})]})]})},exports.Popover=St,exports.PopoverContent=It,exports.PopoverTrigger=Tt,exports.Progress=Ka,exports.ProtectedRoute=({children:t})=>{const{isAuthenticated:n,isLoading:r}=zn();if(e.useEffect(()=>{if(!n)return;const e=()=>{Kt.areAllTokensValid()||Mn.logout()};e();const t=setInterval(e,3e5);return()=>clearInterval(t)},[n]),e.useEffect(()=>{if(r)return;if(n)return;if(Kt.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,a=new URLSearchParams(t);if(e.has("access_token")||a.has("access_token"))return;const s=yn();(async()=>{s?await Mn.loginDev():Mn.loginProd()})()},[n,r]),r)return fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Carregando..."})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),fe.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!n){if(new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token"))return fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Processando..."})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),fe.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})});try{if(Kt.areAllTokensValid())return fe.jsx(fe.Fragment,{children:t})}catch{}return fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Iniciando..."})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),fe.jsx("p",{className:"text-muted-foreground",children:yn()?"Fazendo login automático...":"Redirecionando para autenticação..."})]})]})})}return fe.jsx(fe.Fragment,{children:t})},exports.QUERY_KEYS={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]},exports.QualiexEnrichmentService=In,exports.QualiexErrorInterceptor=fn,exports.QualiexUserField=Br,exports.RadioGroup=Xa,exports.RadioGroupItem=Ga,exports.SEARCH_CONFIG=bn,exports.ScrollArea=Rr,exports.ScrollBar=Fr,exports.Select=Qe,exports.SelectContent=Ze,exports.SelectGroup=Ke,exports.SelectItem=tt,exports.SelectLabel=et,exports.SelectScrollDownButton=Je,exports.SelectScrollUpButton=Ye,exports.SelectSeparator=nt,exports.SelectTrigger=Ge,exports.SelectValue=Xe,exports.Separator=Ya,exports.Sheet=Ja,exports.SheetClose=es,exports.SheetContent=as,exports.SheetDescription=ls,exports.SheetFooter=os,exports.SheetHeader=ss,exports.SheetOverlay=ns,exports.SheetPortal=ts,exports.SheetTitle=is,exports.SheetTrigger=Za,exports.Sidebar=xs,exports.SidebarContent=Cs,exports.SidebarFooter=Ns,exports.SidebarGroup=Ss,exports.SidebarGroupAction=Is,exports.SidebarGroupContent=Ps,exports.SidebarGroupLabel=Ts,exports.SidebarHeader=ks,exports.SidebarInput=ws,exports.SidebarInset=vs,exports.SidebarMenu=Es,exports.SidebarMenuAction=Fs,exports.SidebarMenuBadge=_s,exports.SidebarMenuButton=Rs,exports.SidebarMenuItem=As,exports.SidebarMenuSkeleton=Ls,exports.SidebarMenuSub=Ms,exports.SidebarMenuSubButton=zs,exports.SidebarMenuSubItem=Os,exports.SidebarProvider=gs,exports.SidebarRail=ys,exports.SidebarSeparator=js,exports.SidebarSkeleton=function(){return fe.jsx("div",{className:"w-64 border-r bg-muted/10",children:fe.jsxs("div",{className:"p-4",children:[fe.jsx(Mt,{className:"h-8 w-32 mb-6"}),fe.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>fe.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[fe.jsx(Mt,{className:"h-4 w-4"}),fe.jsx(Mt,{className:"h-4 w-20"})]},t))})]})})},exports.SidebarTrigger=bs,exports.Skeleton=Mt,exports.Slider=Bs,exports.SonnerToaster=({...e})=>{const{theme:t="system"}=A.useTheme();return fe.jsx(o.Toaster,{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})},exports.Spinner=lt,exports.Stack=Kr,exports.StatusSelect=function({value:e,onChange:t,activeLabel:n="Ativo",inactiveLabel:r="Inativo",allLabel:a="[Todos]",placeholder:s="Status",className:o="w-full sm:w-[180px]"}){return fe.jsx(Or,{value:String(e),onChange:e=>t(e),items:[{id:"active",name:n},{id:"inactive",name:r},{id:"all",name:a}],getItemValue:e=>e.id,getItemLabel:e=>e.name,placeholder:s,className:o})},exports.Switch=oo,exports.TabPageContent=function({children:e,className:t}){return fe.jsx("div",{className:pe("space-y-6",t),children:e})},exports.TabPageHeader=function({title:e,description:t,actions:n,className:r}){return fe.jsxs("div",{className:pe("space-y-4",r),children:[fe.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[fe.jsxs("div",{className:"space-y-1",children:[fe.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),t&&fe.jsx("p",{className:"text-muted-foreground text-sm",children:t})]}),n&&fe.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),fe.jsx(Ya,{})]})},exports.TabPageLayout=function({children:e,className:t}){return fe.jsx("div",{className:pe("flex flex-col h-full",t),children:fe.jsx(Rr,{className:"flex-1",children:fe.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=Zn,exports.TableBody=tr,exports.TableCaption=or,exports.TableCell=sr,exports.TableFooter=nr,exports.TableHead=ar,exports.TableHeader=er,exports.TableRow=rr,exports.TableRowActions=Tr,exports.TableSkeleton=ir,exports.Tabs=io,exports.TabsContent=uo,exports.TabsList=lo,exports.TabsTrigger=co,exports.Textarea=at,exports.Toast=wt,exports.ToastAction=kt,exports.ToastClose=Nt,exports.ToastDescription=Ct,exports.ToastProvider=bt,exports.ToastTitle=jt,exports.ToastViewport=yt,exports.Toaster=function(){const{toasts:e}=xt();return fe.jsxs(bt,{children:[e.map(function({id:e,title:t,description:n,action:r,...a}){return fe.jsxs(wt,{...a,children:[fe.jsxs("div",{className:"grid gap-1",children:[t&&fe.jsx(jt,{children:t}),n&&fe.jsx(Ct,{children:n})]}),r,fe.jsx(Nt,{})]},e)}),fe.jsx(yt,{})]})},exports.Toggle=mo,exports.ToggleGroup=ho,exports.ToggleGroupItem=go,exports.TokenManager=Kt,exports.TokenService=Bt,exports.Tooltip=us,exports.TooltipContent=fs,exports.TooltipProvider=cs,exports.TooltipTrigger=ds,exports.assets=Po,exports.badgeVariants=st,exports.buttonVariants=ge,exports.cn=pe,exports.createCrudPage=function(e){return({manager:t})=>{const{manager:n,config:r,onSave:a,onEdit:s,onToggleStatus:o}=e,i=t??n,l={entityName:r.entityName,entityNamePlural:r.entityNamePlural,filters:r.filters||[],columns:r.columns,cardFields:r.cardFields||[],enableBulkActions:r.enableBulkActions??!1,bulkActions:r.bulkActions||[],customActions:r.customActions,customRowActions:r.customRowActions,customListView:r.customListView,onEdit:s||r.onEdit};return fe.jsx(Gr,{manager:i,config:l,formSections:r.formSections,onSave:a,onToggleStatus:o,defaultSort:r.defaultSort})}},exports.createCrudRoutingConfig=function(e,t){const n=bo({basePath:e,newPath:t.newPath,editPath:t.editPath});return{useCustomRouting:!0,onNew:n.onNew,onEdit:n.onEdit}},exports.createRoutingHandlers=bo,exports.createService=An,exports.createSimpleSaveHandler=function(e,t,n){return r=>{if(r.id){const t=n(r);e.updateEntity(r.id,t)}else{const n=t(r);e.createEntity(n)}}},exports.createSimpleService=function(e){const t=An({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment||!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:t,useCrudHook:(n,r)=>Bn({queryKey:e.tableName,service:{...t,getAll:async(e={})=>await t.getAll({...e})},entityName:e.entityName,additionalFilters:n,onSuccess:r})}},exports.crudPresets=ea,exports.debounce=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},exports.deriveEmailField=jn,exports.deriveNameField=Nn,exports.deriveUsernameField=Cn,exports.emailService=Bo,exports.errorService=Yt,exports.formatCurrency=e=>null==e?"R$ 0,00":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDatetime=e=>{if(!e)return"";const t=s.parseISO(e);if(!s.isValid(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"})}`},exports.generateCrudConfig=Yr,exports.getQualiexConfig=wn,exports.getSupabaseClient=an,exports.handleExternalLink=me,exports.isDevEnvironment=yn,exports.logoSrc=Eo,exports.placeService=wm,exports.qualiexApi=hn,exports.resolveFieldMappings=Sn,exports.setQualiexConfig=e=>{vn={...vn,...e}},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new g.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=Ao,exports.toast=gt,exports.toggleVariants=fo,exports.trimTextFields=he,exports.useActiveModules=So,exports.useAuth=zn,exports.useBaseForm=Er,exports.useCrud=Bn,exports.useDebounce=jo,exports.useFormField=Be,exports.useNavigation=ko,exports.useOpenAIChat=Uo,exports.usePageMetadata=function(t){const{setMetadata:n,clearMetadata:r}=ia();e.useEffect(()=>(n(t),()=>r()),[t.title,t.subtitle,n,r])},exports.usePageTitle=No,exports.usePermissionQuery=To,exports.useQualiexUsers=zr,exports.useRouteBreadcrumbs=function(){const e=x.useLocation();return(()=>{const t=e.pathname.split("/").filter(Boolean),n=[{label:"Exemplos",href:"/"}];let r="";return t.forEach((e,a)=>{r+=`/${e}`;const s=a===t.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");n.push({label:o,href:s?void 0:r,isCurrentPage:s})}),n})()},exports.useSidebar=hs,exports.useToast=xt,exports.withPreset=function(e,t,n={}){const r=ea[e];return Yr(r.title,t,{...r,...n})};
10
+ */function de(){return le||(le=1,"production"!==process.env.NODE_ENV&&function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=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"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=Symbol.iterator;var g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=g.ReactDebugCurrentFrame,a=r.getStackAddendum();""!==a&&(t+="%s",n=n.concat([a]));var s=n.map(function(e){return String(e)});s.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,s)}("error",e,n)}var b;function y(e){return e.displayName||"Context"}function v(e){if(null==e)return null;if("number"==typeof e.tag&&x("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 a:return"Fragment";case r:return"Portal";case o:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case d:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case l:return y(e)+".Consumer";case i:return y(e._context)+".Provider";case c:return function(e,t,n){var r=e.displayName;if(r)return r;var a=t.displayName||t.name||"";return""!==a?n+"("+a+")":n}(e,e.render,"ForwardRef");case f:var t=e.displayName||null;return null!==t?t:v(e.type)||"Memo";case m:var n=e,p=n._payload,h=n._init;try{return v(h(p))}catch(g){return null}}return null}b=Symbol.for("react.module.reference");var w,k,N,j,C,S,T,I=Object.assign,P=0;function E(){}E.__reactDisabledLog=!0;var A,D=g.ReactCurrentDispatcher;function R(e,t,n){if(void 0===A)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);A=r&&r[1]||""}return"\n"+A+e}var F,_=!1,L="function"==typeof WeakMap?WeakMap:Map;function M(e,t){if(!e||_)return"";var n,r=F.get(e);if(void 0!==r)return r;_=!0;var a,s=Error.prepareStackTrace;Error.prepareStackTrace=void 0,a=D.current,D.current=null,function(){if(0===P){w=console.log,k=console.info,N=console.warn,j=console.error,C=console.group,S=console.groupCollapsed,T=console.groupEnd;var e={configurable:!0,enumerable:!0,value:E,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}P++}();try{if(t){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(o,[])}catch(p){n=p}Reflect.construct(e,[],o)}else{try{o.call()}catch(p){n=p}e.call(o.prototype)}}else{try{throw Error()}catch(p){n=p}e()}}catch(h){if(h&&n&&"string"==typeof h.stack){for(var i=h.stack.split("\n"),l=n.stack.split("\n"),c=i.length-1,u=l.length-1;c>=1&&u>=0&&i[c]!==l[u];)u--;for(;c>=1&&u>=0;c--,u--)if(i[c]!==l[u]){if(1!==c||1!==u)do{if(c--,--u<0||i[c]!==l[u]){var d="\n"+i[c].replace(" at new "," at ");return e.displayName&&d.includes("<anonymous>")&&(d=d.replace("<anonymous>",e.displayName)),"function"==typeof e&&F.set(e,d),d}}while(c>=1&&u>=0);break}}}finally{_=!1,D.current=a,function(){if(0===--P){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:w}),info:I({},e,{value:k}),warn:I({},e,{value:N}),error:I({},e,{value:j}),group:I({},e,{value:C}),groupCollapsed:I({},e,{value:S}),groupEnd:I({},e,{value:T})})}P<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=s}var f=e?e.displayName||e.name:"",m=f?R(f):"";return"function"==typeof e&&F.set(e,m),m}function O(e,t,n){if(null==e)return"";if("function"==typeof e)return M(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return R(e);switch(e){case u:return R("Suspense");case d:return R("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case c:return M(e.render,!1);case f:return O(e.type,t,n);case m:var a=e,s=a._payload,o=a._init;try{return O(o(s),t,n)}catch(i){}}return""}F=new L;var z=Object.prototype.hasOwnProperty,B={},U=g.ReactDebugCurrentFrame;function $(e){if(e){var t=e._owner,n=O(e.type,e._source,t?t.type:null);U.setExtraStackFrame(n)}else U.setExtraStackFrame(null)}var V=Array.isArray;function q(e){return V(e)}function H(e){return""+e}function W(e){if(function(e){try{return H(e),!1}catch(t){return!0}}(e))return x("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)),H(e)}var Q,K,X=g.ReactCurrentOwner,G={key:!0,ref:!0,__self:!0,__source:!0};function Y(e,t,r,a,s){var o,i={},l=null,c=null;for(o in void 0!==r&&(W(r),l=""+r),function(e){if(z.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(W(t.key),l=""+t.key),function(e){if(z.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&&X.current}(t)),t)z.call(t,o)&&!G.hasOwnProperty(o)&&(i[o]=t[o]);if(e&&e.defaultProps){var u=e.defaultProps;for(o in u)void 0===i[o]&&(i[o]=u[o])}if(l||c){var d="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var n=function(){Q||(Q=!0,x("%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))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(i,d),c&&function(e,t){var n=function(){K||(K=!0,x("%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))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(i,d)}return function(e,t,r,a,s,o,i){var l={$$typeof:n,type:e,key:t,ref:r,props:i,_owner:o,_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:a}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:s}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,s,a,X.current,i)}var J,Z=g.ReactCurrentOwner,ee=g.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,n=O(e.type,e._source,t?t.type:null);ee.setExtraStackFrame(n)}else ee.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function re(){if(Z.current){var e=v(Z.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}J=!1;var ae={};function se(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=re();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!ae[n]){ae[n]=!0;var r="";e&&e._owner&&e._owner!==Z.current&&(r=" It was passed a child from "+v(e._owner.type)+"."),te(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),te(null)}}}function oe(e,t){if("object"==typeof e)if(q(e))for(var n=0;n<e.length;n++){var r=e[n];ne(r)&&se(r,t)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var a=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof a&&a!==e.entries)for(var s,o=a.call(e);!(s=o.next()).done;)ne(s.value)&&se(s.value,t)}}function ie(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==c&&n.$$typeof!==f)return;t=n.propTypes}if(t){var r=v(n);!function(e,t,n,r,a){var s=Function.call.bind(z);for(var o in e)if(s(e,o)){var i=void 0;try{if("function"!=typeof e[o]){var l=Error((r||"React class")+": "+n+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}i=e[o](t,o,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){i=c}!i||i instanceof Error||($(a),x("%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).",r||"React class",n,o,typeof i),$(null)),i instanceof Error&&!(i.message in B)&&(B[i.message]=!0,$(a),x("Failed %s type: %s",n,i.message),$(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!J){J=!0,x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",v(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}var le={};function ce(e,t,r,h,g,y){var w=function(e){return"string"==typeof e||"function"==typeof e||e===a||e===o||e===s||e===u||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===m||e.$$typeof===f||e.$$typeof===i||e.$$typeof===l||e.$$typeof===c||e.$$typeof===b||void 0!==e.getModuleId)}(e);if(!w){var k="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(k+=" 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 N;k+=re(),null===e?N="null":q(e)?N="array":void 0!==e&&e.$$typeof===n?(N="<"+(v(e.type)||"Unknown")+" />",k=" Did you accidentally export a JSX literal instead of a component?"):N=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",N,k)}var j=Y(e,t,r,g,y);if(null==j)return j;if(w){var C=t.children;if(void 0!==C)if(h)if(q(C)){for(var S=0;S<C.length;S++)oe(C[S],e);Object.freeze&&Object.freeze(C)}else x("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 oe(C,e)}if(z.call(t,"key")){var T=v(e),I=Object.keys(t).filter(function(e){return"key"!==e}),P=I.length>0?"{key: someKey, "+I.join(": ..., ")+": ...}":"{key: someKey}";if(!le[T+P])x('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} />',P,T,I.length>0?"{"+I.join(": ..., ")+": ...}":"{}",T),le[T+P]=!0}return e===a?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){te(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),te(null);break}}null!==e.ref&&(te(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(j):ie(j),j}var de=function(e,t,n){return ce(e,t,n,!1)},fe=function(e,t,n){return ce(e,t,n,!0)};ue.Fragment=a,ue.jsx=de,ue.jsxs=fe}()),ue}var fe=(ce||(ce=1,"production"===process.env.NODE_ENV?oe.exports=function(){if(se)return ie;se=1;var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function i(e,t,r){var i,l={},c=null,u=null;for(i in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(u=t.ref),t)a.call(t,i)&&!o.hasOwnProperty(i)&&(l[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===l[i]&&(l[i]=t[i]);return{$$typeof:n,type:e,key:c,ref:u,props:l,_owner:s.current}}return ie.Fragment=r,ie.jsx=i,ie.jsxs=i,ie}():oe.exports=de()),oe.exports);function me(e,t){t?.stopPropagation();window.open(e,"_blank","noopener,noreferrer")||navigator.clipboard.writeText(e).then(()=>{o.toast.info("Link copiado para a área de transferência")})}function pe(...e){return a.twMerge(r.clsx(e))}const he=e=>{if(null==e)return e;if("string"==typeof e)return e.trim();if(Array.isArray(e))return e.map(he);if("object"==typeof e&&e.constructor===Object){const t={};for(const[n,r]of Object.entries(e))t[n]=he(r);return t}return e},ge=n.cva("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",action:"bg-primary/10 text-primary hover:bg-primary/20 border border-primary/30","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"}}),xe=L.forwardRef(({className:e,variant:n,size:r,asChild:a=!1,...s},o)=>{const i=a?t.Slot:"button";return fe.jsx(i,{className:pe(ge({variant:n,size:r,className:e})),ref:o,...s})});xe.displayName="Button";const be=e.forwardRef(({variant:e="default",className:t,children:n,...r},a)=>fe.jsx(xe,{ref:a,variant:"action",size:"sm",className:pe("h-7 px-2 text-xs",t),...r,children:n||fe.jsx(i.EllipsisVertical,{size:12})}));be.displayName="ActionButton";const ye=L.forwardRef(({className:e,type:t,...n},r)=>fe.jsx("input",{type:t,className:pe("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:r,...n}));ye.displayName="Input";const ve=n.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),we=L.forwardRef(({className:e,...t},n)=>fe.jsx(M.Root,{ref:n,className:pe(ve(),e),...t}));we.displayName=M.Root.displayName;const ke=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));ke.displayName="Card";const Ne=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("flex flex-col space-y-1.5 p-6",e),...t}));Ne.displayName="CardHeader";const je=L.forwardRef(({className:e,...t},n)=>fe.jsx("h3",{ref:n,className:pe("text-2xl font-semibold leading-none tracking-tight",e),...t}));je.displayName="CardTitle";const Ce=L.forwardRef(({className:e,...t},n)=>fe.jsx("p",{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));Ce.displayName="CardDescription";const Se=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("p-6 pt-0",e),...t}));Se.displayName="CardContent";const Te=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("flex items-center p-6 pt-0",e),...t}));Te.displayName="CardFooter";const Ie=O.Root,Pe=O.Trigger,Ee=O.Portal,Ae=O.Close,De=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Overlay,{ref:n,className:pe("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}));De.displayName=O.Overlay.displayName;const Re=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(Ee,{children:[fe.jsx(De,{}),fe.jsxs(O.Content,{ref:r,className:pe("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),...n,children:[t,fe.jsxs(O.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:[fe.jsx(i.X,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Re.displayName=O.Content.displayName;const Fe=({className:e,...t})=>fe.jsx("div",{className:pe("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});Fe.displayName="DialogHeader";const _e=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});_e.displayName="DialogFooter";const Le=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Title,{ref:n,className:pe("text-lg font-semibold leading-none tracking-tight",e),...t}));Le.displayName=O.Title.displayName;const Me=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Description,{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));Me.displayName=O.Description.displayName;const Oe=u.FormProvider,ze=L.createContext({}),Be=()=>{const e=L.useContext(ze),t=L.useContext(Ue),{getFieldState:n,formState:r}=u.useFormContext(),a=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},Ue=L.createContext({}),$e=L.forwardRef(({className:e,...t},n)=>{const r=L.useId();return fe.jsx(Ue.Provider,{value:{id:r},children:fe.jsx("div",{ref:n,className:pe("space-y-2",e),...t})})});$e.displayName="FormItem";const Ve=L.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:a}=Be();return fe.jsx(we,{ref:n,className:pe(r&&"text-destructive",e),htmlFor:a,...t})});Ve.displayName="FormLabel";const qe=L.forwardRef(({...e},n)=>{const{error:r,formItemId:a,formDescriptionId:s,formMessageId:o}=Be();return fe.jsx(t.Slot,{ref:n,id:a,"aria-describedby":r?`${s} ${o}`:`${s}`,"aria-invalid":!!r,...e})});qe.displayName="FormControl";const He=L.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Be();return fe.jsx("p",{ref:n,id:r,className:pe("text-sm text-muted-foreground",e),...t})});He.displayName="FormDescription";const We=L.forwardRef(({className:e,children:t,...n},r)=>{const{error:a,formMessageId:s}=Be(),o=a?String(a?.message):t;return o?fe.jsx("p",{ref:r,id:s,className:pe("text-sm font-medium text-destructive",e),...n,children:o}):null});We.displayName="FormMessage";const Qe=z.Root,Ke=z.Group,Xe=z.Value,Ge=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(z.Trigger,{ref:r,className:pe("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),...n,children:[t,fe.jsx(z.Icon,{asChild:!0,children:fe.jsx(i.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));Ge.displayName=z.Trigger.displayName;const Ye=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.ScrollUpButton,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:fe.jsx(i.ChevronUp,{className:"h-4 w-4"})}));Ye.displayName=z.ScrollUpButton.displayName;const Je=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.ScrollDownButton,{ref:n,className:pe("flex cursor-default items-center justify-center py-1",e),...t,children:fe.jsx(i.ChevronDown,{className:"h-4 w-4"})}));Je.displayName=z.ScrollDownButton.displayName;const Ze=L.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>fe.jsx(z.Portal,{children:fe.jsxs(z.Content,{ref:a,className:pe("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"===n&&"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:n,...r,children:[fe.jsx(Ye,{}),fe.jsx(z.Viewport,{className:pe("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),fe.jsx(Je,{})]})}));Ze.displayName=z.Content.displayName;const et=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.Label,{ref:n,className:pe("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));et.displayName=z.Label.displayName;const tt=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(z.Item,{ref:r,className:pe("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),...n,children:[fe.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:fe.jsx(z.ItemIndicator,{children:fe.jsx(i.Check,{className:"h-4 w-4"})})}),fe.jsx(z.ItemText,{children:t})]}));tt.displayName=z.Item.displayName;const nt=L.forwardRef(({className:e,...t},n)=>fe.jsx(z.Separator,{ref:n,className:pe("-mx-1 my-1 h-px bg-muted",e),...t}));nt.displayName=z.Separator.displayName;const rt=L.forwardRef(({className:e,...t},n)=>fe.jsx(B.Root,{ref:n,className:pe("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:fe.jsx(B.Indicator,{className:pe("flex items-center justify-center text-current"),children:fe.jsx(i.Check,{className:"h-4 w-4"})})}));rt.displayName=B.Root.displayName;const at=L.forwardRef(({className:e,...t},n)=>fe.jsx("textarea",{className:pe("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:n,...t}));at.displayName="Textarea";const st=n.cva("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"}}),ot=L.forwardRef(({className:e,variant:t,...n},r)=>fe.jsx("div",{ref:r,className:pe(st({variant:t}),e),...n}));ot.displayName="Badge";const it={sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8"};function lt({size:e="md",className:t}){return fe.jsx(i.Loader2,{className:pe("animate-spin text-muted-foreground",it[e],t)})}let ct=0;const ut=new Map,dt=e=>{if(ut.has(e))return;const t=setTimeout(()=>{ut.delete(e),ht({type:"REMOVE_TOAST",toastId:e})},1e6);ut.set(e,t)},ft=(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:n}=t;return n?dt(n):e.toasts.forEach(e=>{dt(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||void 0===n?{...e,open:!1}:e)}}case"REMOVE_TOAST":return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},mt=[];let pt={toasts:[]};function ht(e){pt=ft(pt,e),mt.forEach(e=>{e(pt)})}function gt({...e}){const t=(ct=(ct+1)%Number.MAX_SAFE_INTEGER,ct.toString()),n=()=>ht({type:"DISMISS_TOAST",toastId:t});return ht({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||n()}}}),{id:t,dismiss:n,update:e=>ht({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function xt(){const[e,t]=L.useState(pt);return L.useEffect(()=>(mt.push(t),()=>{const e=mt.indexOf(t);e>-1&&mt.splice(e,1)}),[e]),{...e,toast:gt,dismiss:e=>ht({type:"DISMISS_TOAST",toastId:e})}}const bt=U.Provider,yt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Viewport,{ref:n,className:pe("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}));yt.displayName=U.Viewport.displayName;const vt=n.cva("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"}}),wt=L.forwardRef(({className:e,variant:t,...n},r)=>fe.jsx(U.Root,{ref:r,className:pe(vt({variant:t}),e),...n}));wt.displayName=U.Root.displayName;const kt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Action,{ref:n,className:pe("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}));kt.displayName=U.Action.displayName;const Nt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Close,{ref:n,className:pe("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:fe.jsx(i.X,{className:"h-4 w-4"})}));Nt.displayName=U.Close.displayName;const jt=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Title,{ref:n,className:pe("text-sm font-semibold",e),...t}));jt.displayName=U.Title.displayName;const Ct=L.forwardRef(({className:e,...t},n)=>fe.jsx(U.Description,{ref:n,className:pe("text-sm opacity-90",e),...t}));Ct.displayName=U.Description.displayName;const St=$.Root,Tt=$.Trigger,It=L.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>fe.jsx($.Portal,{children:fe.jsx($.Content,{ref:a,align:t,sideOffset:n,className:pe("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),...r})}));It.displayName=$.Content.displayName;const Pt=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Pt.displayName="Command";const Et=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:fe.jsx("input",{ref:n,className:pe("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})}));Et.displayName="CommandInput";const At=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));At.displayName="CommandList";const Dt=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("py-6 text-center text-sm text-muted-foreground",e),...t}));Dt.displayName="CommandEmpty";const Rt=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("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}));Rt.displayName="CommandGroup";const Ft=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("-mx-1 h-px bg-border",e),...t}));Ft.displayName="CommandSeparator";const _t=L.forwardRef(({className:e,disabled:t,onSelect:n,value:r,...a},s)=>fe.jsx("div",{ref:s,className:pe("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&&n?.(r||""),...a}));_t.displayName="CommandItem";const Lt=({className:e,...t})=>fe.jsx("span",{className:pe("ml-auto text-xs tracking-widest text-muted-foreground",e),...t});function Mt({className:e,...t}){return fe.jsx("div",{className:pe("animate-pulse rounded-md bg-muted",e),...t})}Lt.displayName="CommandShortcut";const Ot=e=>e.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase();var zt=Object.defineProperty;class Bt{static normalizeBase64Url(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");const n=(4-t.length%4)%4;return t+="=".repeat(n),t}static parseJwtPayload(e){try{const a=e.split(".");if(3!==a.length)return null;const s=a[1];s.length,this.LARGE_PAYLOAD_THRESHOLD;try{const e=this.normalizeBase64Url(s),t=atob(e),n=new Uint8Array(t.length);for(let a=0;a<t.length;a++)n[a]=t.charCodeAt(a);const r=new TextDecoder("utf-8").decode(n);return JSON.parse(r)}catch(t){try{const e=this.normalizeBase64Url(s),t=decodeURIComponent(atob(e).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(t)}catch(n){try{const e=this.normalizeBase64Url(s),t=atob(e);return JSON.parse(t)}catch(r){throw r}}}}catch(a){return null}}static validateTokens(e,t){const n=[],r=[];try{t.split(".")[1],e.split(".")[1];const a=this.parseJwtPayload(t),s=this.parseJwtPayload(e);if(!a){const e="ID token decode falhou - possível problema com base64url encoding";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:n,errors:r}}let o=!0;if(!s){const e="Access token decode falhou - será tentado novamente nas chamadas de API";n.push(e),o=!1}const i=Math.floor(Date.now()/1e3);if(s?.exp&&s.exp<i){const e="Access token expirado - pode precisar de refresh";n.push(e),o=!1}if(a.exp&&a.exp<i){const e="ID token expirado - autenticação inválida";return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:o,warnings:n,errors:r}}return{isValid:!0,idTokenValid:!0,accessTokenValid:o,warnings:n,errors:r}}catch(a){const e=`Erro na validação de tokens: ${a}`;return r.push(e),{isValid:!1,idTokenValid:!1,accessTokenValid:!1,warnings:n,errors:r}}}static isTokenExpired(e){const t=this.parseJwtPayload(e);return!t||!t.exp||1e3*t.exp<Date.now()}static extractTokenData(e){return this.parseJwtPayload(e)}}((e,t,n)=>{t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(Bt,"LARGE_PAYLOAD_THRESHOLD"+"",1e3);const Ut="qualiex_access_token",$t="qualiex_id_token",Vt="supabase_token",qt="oauth_state",Ht="oauth_nonce",Wt="selected_alias",Qt="manual_logout",Kt={setAccessToken:e=>localStorage.setItem(Ut,e),getAccessToken:()=>localStorage.getItem(Ut),setIdToken:e=>localStorage.setItem($t,e),getIdToken:()=>localStorage.getItem($t),getSupabaseToken:()=>localStorage.getItem(Vt),setOAuthState:e=>sessionStorage.setItem(qt,e),getOAuthState:()=>sessionStorage.getItem(qt),clearOAuthState:()=>sessionStorage.removeItem(qt),setOAuthNonce:e=>sessionStorage.setItem(Ht,e),getOAuthNonce:()=>sessionStorage.getItem(Ht),clearOAuthNonce:()=>sessionStorage.removeItem(Ht),setSelectedAlias:e=>localStorage.setItem(Wt,e),getSelectedAlias:()=>localStorage.getItem(Wt),clearSelectedAlias:()=>localStorage.removeItem(Wt),generateOAuthState:()=>"Lw==",generateOAuthNonce:()=>{const e=new Uint8Array(32);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e)).replace(/[+/=]/g,"")},hasAllTokens:()=>!(!Kt.getAccessToken()||!Kt.getIdToken()),setSupabaseToken:e=>{localStorage.setItem(Vt,e),Kt._clearValidationCache()},areAllTokensValid:()=>{const e=Kt.getAccessToken(),t=Kt.getIdToken();if(!e||!t)return!1;try{const n=Bt.validateTokens(e,t);return!!n.idTokenValid&&n.idTokenValid}catch(n){return!1}},clearExpiredTokens:()=>{let e=!1;const t=Kt.getAccessToken(),n=Kt.getIdToken(),r=Kt.getSupabaseToken();return t&&Kt.isTokenExpired(t)&&(localStorage.removeItem(Ut),e=!0),n&&Kt.isTokenExpired(n)&&(localStorage.removeItem($t),e=!0),r&&Kt.isTokenExpired(r)&&(localStorage.removeItem(Vt),e=!0),e},clearAll:()=>{localStorage.removeItem(Ut),localStorage.removeItem($t),localStorage.removeItem(Vt),localStorage.removeItem(Wt),localStorage.removeItem(Qt),sessionStorage.removeItem(qt),sessionStorage.removeItem(Ht)},setManualLogout:()=>localStorage.setItem(Qt,"true"),isManualLogout:()=>"true"===localStorage.getItem(Qt),clearManualLogout:()=>localStorage.removeItem(Qt),isTokenExpired:e=>{try{return Bt.isTokenExpired(e)}catch{return!0}},_validationCache:{isValid:!1,timestamp:0,cacheValidityMs:3e5},_clearValidationCache:()=>{Kt._validationCache.isValid=!1,Kt._validationCache.timestamp=0},isSupabaseTokenValid:()=>{const e=Kt.getSupabaseToken();if(!e)return!1;if(Kt.isTokenExpired(e))return Kt._clearValidationCache(),Kt._handleExpiredToken(),!1;const t=Date.now();return t-Kt._validationCache.timestamp<Kt._validationCache.cacheValidityMs?Kt._validationCache.isValid:(Kt._validationCache.isValid=!0,Kt._validationCache.timestamp=t,!0)},getValidSupabaseToken:()=>Kt.isSupabaseTokenValid()?Kt.getSupabaseToken():null,_handleExpiredToken:()=>{Kt.clearAll(),"undefined"!=typeof window&&(window.location.href="/")},extractTokenData:()=>{if(!Kt.isSupabaseTokenValid())return null;const e=Kt.getSupabaseToken();if(!e)return null;try{const t=Bt.parseJwtPayload(e);if(!t)return null;const n=t.alias||t.default||t.user_alias,r=t.place_id||null,a=t.place_name||null;let s=t.company_id;if(!s&&n)for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");if(e.length>7&&e[0]===n){s=e[7];break}}}return{alias:n,companyId:s,placeId:r,placeName:a,payload:t}}catch(t){return Kt._handleExpiredToken(),null}},getCompanyId:e=>{const t=Kt.getAccessToken();if(t)try{const n=Bt.parseJwtPayload(t);if(n)for(const t in n)if(t.startsWith("co")&&/^co\d+$/.test(t)){const r=n[t];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(a){}const n=Kt.extractTokenData();if(n?.companyId)return n.companyId;const r=Kt.getIdToken();if(r)try{const t=Bt.parseJwtPayload(r);if(t)for(const n in t)if(n.startsWith("co")&&/^co\d+$/.test(n)){const r=t[n];if(r&&"string"==typeof r){const t=r.split(";");if(e&&t.length>7&&t[0]===e)return t[7];if(!e&&t.length>7)return t[7]}}}catch(a){}return null},getCurrentCompanyId:()=>{const e=Kt.extractTokenData();return e?.companyId||null},getAllCompaniesData:()=>{const e=Kt.getIdToken();if(!e)return[];try{const t=Bt.parseJwtPayload(e);if(!t)return[];const n=[];for(const e in t)if(e.startsWith("co")&&/^co\d+$/.test(e)){const r=t[e];if(r&&"string"==typeof r){const e=r.split(";");e.length>=4&&n.push({id:e.length>7?e[7]:"",alias:e[0].trim(),name:e[3].trim(),payload:t})}}return n}catch{return[]}}};var Xt=Object.defineProperty,Gt=(e,t,n)=>((e,t,n)=>t in e?Xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const Yt=new class{constructor(){Gt(this,"errors",[]),Gt(this,"toastCount",0),Gt(this,"lastToastTime",0)}handleError(e,t=!0){const n="string"==typeof e?e:e.message;if(this.errors.push({id:Date.now().toString(),message:n,timestamp:Date.now(),count:1}),t&&this.shouldShowToast()){gt({title:this.getErrorTitle(n),description:n,variant:"destructive"})}}getErrorTitle(e){const t=e.toLowerCase();return t.includes("401")||t.includes("unauthorized")||t.includes("expirou")?"Sessão Expirada":t.includes("token")||t.includes("autenticação")?"Erro de Autenticação":t.includes("api")||t.includes("network")?"Erro de Conexão":"Erro"}success(e,t){gt({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 Jt=Object.defineProperty,Zt=(e,t,n)=>((e,t,n)=>t in e?Jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);const en=(void 0).VITE_SUPABASE_URL,tn=(void 0).VITE_SUPABASE_PUBLISHABLE_KEY,nn=class e{constructor(){Zt(this,"client"),Zt(this,"currentToken",null),Zt(this,"instanceCount",0),this.instanceCount++,this.client=this.createClientWithToken(null)}createClientWithToken(e){const t={apikey:tn};e&&this.isTokenValid(e)&&(t.Authorization=`Bearer ${e}`);return h.createClient(en,tn,{auth:{persistSession:!1,autoRefreshToken:!1,detectSessionInUrl:!1,storage:void 0},global:{headers:t,fetch:async(e,t)=>("string"==typeof e?e:e.url).includes("/auth/v1/user")?new Response(JSON.stringify({error:"blocked"}),{status:401,headers:{"Content-Type":"application/json"}}):fetch(e,t)}})}static getInstance(){return e.instance||(e.instance=new e),e.instance}getClient(){const e=Kt.getValidSupabaseToken();return e!==this.currentToken&&(this.client=this.createClientWithToken(e),this.currentToken=e),this.client}isTokenValid(e){try{const t=JSON.parse(atob(e.split(".")[1])),n=Math.floor(Date.now()/1e3);return t.exp>n}catch(t){return Yt.handleError(t instanceof Error?t:"❌ Supabase - Error validating token",!1),!1}}};Zt(nn,"instance");let rn=nn;function an(){return rn.getInstance().getClient()}class sn{static async generateToken(e,t,n,r=!1){try{if(!r){const e=Kt.getSupabaseToken();if(e&&Kt.isSupabaseTokenValid())return e}const a=an(),{data:s,error:o}=await a.functions.invoke("validate-token",{body:{access_token:e,alias:t}});return o&&(o.message?.includes("401")||o.message?.includes("Unauthorized"))?(n?.(),null):s?.access_token&&s.access_token?(Kt.setSupabaseToken(s.access_token),s.access_token):null}catch(a){return a instanceof Error&&(a.message.includes("401")||a.message.includes("Unauthorized"))&&n?.(),null}}}var on=Object.defineProperty,ln=(e,t,n)=>((e,t,n)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,"symbol"!=typeof t?t+"":t,n);class cn{static setLogoutCallback(e){this.onLogoutCallback=e}static async attemptRegeneration(){if(this.isRegenerating)return null;this.isRegenerating=!0;try{const e=Kt.getAccessToken(),t=Kt.getSelectedAlias();if(!e||!t)return null;const n=await sn.generateToken(e,t,this.onLogoutCallback||void 0,!1);return n?(Kt.setSupabaseToken(n),n):null}catch(e){return null}finally{this.isRegenerating=!1}}}ln(cn,"isRegenerating",!1),ln(cn,"onLogoutCallback",null);class un{static handleError(e){if(!e)return!1;const t=e.message||e.toString();return!!this.isAuthenticationError(e,t)&&(Kt.clearAll(),window.location.href="/",!0)}static isAuthenticationError(e,t){if(401===e.status||401===e.statusCode)return!0;const n=t.toLowerCase();return["401","unauthorized","token","expired","invalid","authentication","login","session"].some(e=>n.includes(e))}static async wrapAsync(e){try{return await e}catch(t){if(!this.handleError(t))throw t;throw new Error("Sua sessão expirou. Você será redirecionado para fazer login novamente.")}}}var dn=Object.defineProperty;class fn{static async handleApiError(e){if(!e||this.isRetrying)return!1;const t=e.status||e.statusCode,n=e.message||e.toString();if(401===t||n.includes("401")||n.includes("Unauthorized")){this.isRetrying=!0;try{return await cn.attemptRegeneration()?(this.isRetrying=!1,!0):(un.handleError(e),this.isRetrying=!1,!1)}catch(r){return un.handleError(e),this.isRetrying=!1,!1}}return!1}static validateToken(){const e=Kt.getAccessToken();return e?Kt.isTokenExpired(e)?{valid:!1,message:"Sua sessão expirou. Você será redirecionado para fazer login."}:{valid:!0}:{valid:!1,message:"Token OAuth não encontrado. Faça login novamente."}}}((e,t,n)=>{((e,t,n)=>{t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(e,t+"",n)})(fn,"isRetrying",!1);var mn=Object.defineProperty,pn=(e,t,n)=>((e,t,n)=>t in e?mn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n);const hn=new class{constructor(){pn(this,"baseUrl",(void 0).VITE_QUALIEX_API_URL)}async makeApiCall(e,t,n){const r=fn.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const a=Kt.getAccessToken();if(!a)throw new Error("Token Qualiex não encontrado");if(!n||""===n.trim())throw new Error("Alias da unidade é obrigatório para chamadas à API do Qualiex");const s=new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{s.searchParams.append(e,t)});const o=await fetch(s.toString(),{method:"GET",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json","un-alias":n}});if(!o.ok){const e=new Error(`API call failed: ${o.status} ${o.statusText}`);throw e.status=o.status,e.statusCode=o.status,e}return await o.json()}mapToQualiexUser(e){return{id:e.id||e.ID||"",userId:e.userId||String(e.ID),userName:e.userName||"Nome não disponível",userEmail:e.userEmail||"Email não disponível",placeId:null,placeName:e.placeName||null,roleId:e.roleId||void 0,roleName:e.roleName||void 0,companyId:e.companyId||void 0,companyName:e.companyName||void 0}}async fetchUsers(e,t){try{const n=await this.makeApiCall("/api/common/v1/companiesusers",{companyId:t,search:"",filterStatus:"active"},e);let r=n;if(n.data)r=n.data;else{if(!Array.isArray(n))return Yt.handleError("[QualiexApi] Formato de resposta inesperado",!1),[];r=n}if(!Array.isArray(r))return Yt.handleError("[QualiexApi] Resposta não é um array",!1),[];return r.map(this.mapToQualiexUser)}catch(n){if(await fn.handleApiError(n))try{const n=await this.makeApiCall("/api/common/v1/companiesusers",{companyId:t,search:"",filterStatus:"active"},e);let r=n;if(n.data)r=n.data;else{if(!Array.isArray(n))return Yt.handleError("[QualiexApi] Formato de resposta inesperado após retry",!1),[];r=n}return Array.isArray(r)?r.map(this.mapToQualiexUser):(Yt.handleError("[QualiexApi] Resposta não é um array após retry",!1),[])}catch(r){return Yt.handleError(r instanceof Error?r:"Erro ao buscar usuários após renovação de token",!0),[]}const a=n instanceof Error?n.message:"Erro ao buscar usuários da API Qualiex";return Yt.handleError(a,!0),[]}}async fetchUserById(e,t,n){try{return(await this.fetchUsers(t,n)).find(t=>t.userId===e)||null}catch(r){return Yt.handleError(r instanceof Error?r:"[QualiexApi] Error fetching user by ID"),null}}async fetchActiveUsersMap(e,t){const n=await this.fetchUsers(e,t),r=new Map;return n.forEach(e=>{r.set(e.userId,e)}),r}async getUsers(e){const t=Kt.extractTokenData();return t&&t.companyId?this.fetchUsers(e,t.companyId):[]}},gn={oauth:{authUrl:(void 0).VITE_OAUTH_AUTH_URL,clientId:(void 0).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"}},bn={debounceDelay:500},yn=()=>{const e=window.location.origin;return e.includes("localhost")||e.includes("127.0.0.1")||e.includes("id-preview")||e.includes("lovable.dev")||(void 0).DEV};let vn={enableUserEnrichment:!1,enableUsersApi:!1,userNameFieldSuffix:"_name",userEmailFieldSuffix:"_email",userUsernameFieldSuffix:"_username"};const wn=()=>vn,kn={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}`}};function Nn(e,t){const n=wn(),r=t||n.userNameFieldSuffix||"_name";return e.endsWith("_id")?e.replace(/_id$/,r):`${e}${r}`}function jn(e,t){const n=wn(),r=t||n.userEmailFieldSuffix||"_email";return e.endsWith("_id")?e.replace(/_id$/,r):`${e}${r}`}function Cn(e,t){const n=wn(),r=t||n.userUsernameFieldSuffix||"_username";return e.endsWith("_id")?e.replace(/_id$/,r):`${e}${r}`}function Sn(e,t){return t&&t.length>0?t.map(e=>({idField:e.idField,nameField:e.nameField||Nn(e.idField),emailField:e.emailField||jn(e.idField),usernameField:e.usernameField||Cn(e.idField)})):e&&e.length>0?e.map(e=>({idField:e,nameField:Nn(e),emailField:jn(e),usernameField:Cn(e)})):[{idField:"id_user",nameField:"responsible_name"}]}const Tn=new Map;class In{static async fetchQualiexUsers(e,t){const n=wn(),r=`${t}_${e}`,a=Tn.get(r);if(a&&Date.now()-a.timestamp<3e5)return a.users;let s;return s=n.fetchUsers?await n.fetchUsers(t,e):await hn.fetchUsers(e,t),Tn.set(r,{users:s,timestamp:Date.now()}),s}static extractUserIds(e,t){const n=new Set;for(const r of e)for(const e of t){const t=r[e.idField];t&&"string"==typeof t&&""!==t.trim()&&n.add(t)}return n}static indexUsers(e){const t=new Map;for(const n of e)n.id&&t.set(n.id,n),n.userId&&t.set(n.userId,n);return t}static enrichEntity(e,t,n){const r={...e};for(const a of t){const t=e[a.idField];if(!t)continue;const s=n.get(t);if(s){if(a.nameField){r[a.nameField]||(r[a.nameField]=s.userName||s.displayName||null)}if(a.emailField){r[a.emailField]||(r[a.emailField]=s.userEmail||null)}if(a.usernameField){r[a.usernameField]||(r[a.usernameField]=s.userName||null)}}}return r}static async enrichWithUserData(e,t){if(!Array.isArray(e)||0===e.length)return e;try{const n=wn();let r=null,a=null;if(n.getCompanyId){const e=n.getCompanyId();a=e instanceof Promise?await e:e}if(n.getAccessToken){const t=n.getAccessToken();if(!(t instanceof Promise?await t:t))return e}if(!r||!a){const t=Kt.extractTokenData();if(!t)return e;r=r||t.alias,a=a||t.companyId}if(!r||!a)return e;const s=Sn(t.userIdFields,t.userFieldsMapping);if(0===this.extractUserIds(e,s).size)return e;const o=await this.fetchQualiexUsers(r,a),i=this.indexUsers(o);return e.map(e=>this.enrichEntity(e,s,i))}catch(n){return Yt.handleError(n instanceof Error?n:new Error(`[QualiexEnrichment.${t.entityName}] Erro crítico`),!1),e}}static async enrichWithResponsibleNames(e,t){return this.enrichWithUserData(e,{entityName:t.entityName,userIdFields:["id_user"],userFieldsMapping:[{idField:"id_user",nameField:"responsible_name"}]})}}const Pn=["responsible_name"],En=e=>Pn.includes(e);function An(e,t,n){const r="string"==typeof e?{tableName:e,searchFields:t||[],schemaName:n||"common"}:{searchFields:e.searchFields||[],schemaName:e.schemaName||"common",...e},{tableName:a,searchFields:s,selectFields:o,schemaName:i,entityName:l,enableQualiexEnrichment:c=!1}=r,u=()=>{if(!Kt.getValidSupabaseToken())throw new Error("Token de autenticação expirado. Faça login novamente.");return an().schema(i).from(a)};return{async getAll(e={}){const{search:t="",sortField:n="updated_at",sortDirection:i="desc",page:d=1,limit:f=25,...m}=e;let p=u().select(o||"*",{count:"exact"});p=p.eq("is_removed",!1),Object.entries(m).forEach(([e,t])=>{void 0!==t&&""!==t&&(Array.isArray(t)?p=p.in(e,t):"object"==typeof t&&t&&"operator"in t?"not_null"===t.operator?p=p.not(e,"is",null):"is_null"===t.operator&&(p=p.is(e,null)):null!==t&&(p=p.eq(e,t)))}),p=((e,t)=>{if(t&&s.length>0){const n=s.map(e=>`${e}.ilike.%${t}%`).join(",");return e.or(n)}return e})(p,t);n.includes(".")||En(n)||(p=p.order(n,{ascending:"asc"===i})),p=((e,t,n)=>{const r=(t-1)*n,a=r+n-1;return e.range(r,a)})(p,d,f);const{data:h,error:g,count:x}=await p;if(g)throw new Error(`Error fetching ${a}: ${g.message}`);let b=((e,t,n,r)=>{const a=Math.ceil((t||0)/r);return{data:e,currentPage:n,totalPages:a,totalItems:t||0,itemsPerPage:r,hasNextPage:n<a,hasPreviousPage:n>1}})(h||[],x,d,f);const y=wn();if(c&&y.enableUserEnrichment&&l&&b.data.length>0){const t=Sn(r.userIdFields,r.userFieldsMapping);if(b.data.some(e=>t.some(t=>e[t.idField]))){const a=n&&n.includes("."),s=n&&En(n),o=n&&t.some(e=>e.nameField===n||e.emailField===n||e.usernameField===n);if(n&&(s||a||o)){const t={...e,page:1,limit:500,sortField:void 0,sortDirection:void 0},s=await this.getAll(t);if(!s?.data?.length)return s;const o=await In.enrichWithUserData(s.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});let c;c=a?o.sort((e,t)=>{const r=n.split(".").reduce((e,t)=>e?.[t],e)||"",a=n.split(".").reduce((e,t)=>e?.[t],t)||"",s=String(r).localeCompare(String(a),"pt-BR");return"asc"===i?s:-s}):((e,t,n)=>[...e].sort((e,r)=>{const a=e[t]||"",s=r[t]||"",o=a.localeCompare(s,"pt-BR",{sensitivity:"base"});return"asc"===n?o:-o}))(o,n,i);const u=((e,t=1,n=25)=>{const r=(t-1)*n,a=r+n,s=e.slice(r,a);return{data:s,pagination:{currentPage:t,totalPages:Math.ceil(e.length/n),totalItems:s.length,totalCount:e.length,itemsPerPage:n,hasNextPage:a<e.length,hasPreviousPage:t>1}}})(c,d,f);return{data:u.data,currentPage:u.pagination.currentPage,totalPages:u.pagination.totalPages,totalItems:u.pagination.totalCount,itemsPerPage:u.pagination.itemsPerPage,hasNextPage:u.pagination.hasNextPage,hasPreviousPage:u.pagination.hasPreviousPage}}const c=await In.enrichWithUserData(b.data,{entityName:l,userIdFields:r.userIdFields,userFieldsMapping:r.userFieldsMapping});b={...b,data:c}}}return b},async getById(e){const{data:t,error:n}=await u().select(o||"*").eq("id",e).maybeSingle();if(n)throw new Error(`Error fetching ${a}: ${n.message}`);return t},async create(e){const t=he(e),n=Object.entries(t).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),{}),{data:r,error:s}=await u().insert(n).select().single();if(s)throw new Error(`Error creating ${a}: ${s.message}`);if(!r)throw new Error(`No data returned from create ${a} operation`);return r},async update(e,t){const n={...he(t),updated_at:(new Date).toISOString()},{data:r,error:s}=await u().update(n).eq("id",e).select().single();if(s)throw new Error(`Error updating ${a}: ${s.message}`);if(!r)throw new Error(`No data returned from update ${a} operation`);return r},async delete(e){const t={is_removed:!0,updated_at:(new Date).toISOString()},{error:n}=await u().update(t).eq("id",e);if(n)throw new Error(`Error soft deleting ${a}: ${n.message}`)}}}const Dn=()=>{Kt.clearManualLogout()},Rn=e=>e?.placeId||null,Fn=e=>e?.placeName||null,_n=e=>({placeId:Rn(e),placeName:Fn(e)}),Ln=class{static async initialize(){try{if(!Kt.hasAllTokens()||!Kt.areAllTokensValid())return Kt.clearExpiredTokens(),{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null};const t=Kt.getAccessToken(),n=Kt.getIdToken();Dn();const r=this.extractUserFromIdToken(n),a=this.extractCompaniesFromIdToken(n),s=this.extractAliasFromAccessToken(t),o=Kt.extractTokenData(),i=o?.alias;let l=null;if(i&&a.some(e=>e.alias===i))l=i;else{const e=Kt.getSelectedAlias(),t=e&&a.some(t=>t.alias===e);l=t?e:s||a[0]?.alias||null}!Kt.isSupabaseTokenValid()&&l&&await cn.attemptRegeneration();let c=null;if(l){const e=Kt.getCompanyId(l),t=a.find(e=>e.alias===l);t&&(c={id:e||t.id,name:t.name,alias:t.alias})}let u=null,d=null;if(r?.id&&l){const t=Kt.getCompanyId(l);if(t)try{const e=(await hn.fetchActiveUsersMap(l,t)).get(r.id);if(e){const t=_n(e);u=t.placeId,d=t.placeName}}catch(e){}}return{isAuthenticated:!0,isLoading:!1,user:r,alias:l,companies:a,selectedUnit:c,userId:r?.id||null,userAlias:r?.id||null,placeId:u,placeName:d,activePlaceId:u,activePlaceName:d}}catch(e){return{isAuthenticated:!1,isLoading:!1,user:null,alias:null,companies:[],selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null}}}static async loginDev(){try{const e=an(),{data:t,error:n}=await e.functions.invoke("dev-tokens",{body:{environment:"development"}});if(n)return!1;if(!t?.access_token||!t?.id_token)return!1;const r=new URL("/callback",window.location.origin);return r.hash=`access_token=${t.access_token}&id_token=${t.id_token}&token_type=bearer`,window.location.href=r.toString(),!0}catch(e){return!1}}static loginProd(){const e=Kt.generateOAuthState();Kt.setOAuthState(e);const t=Kt.generateOAuthNonce();Kt.setOAuthNonce(t);const n=`${window.location.origin}/callback`,r=new URL(gn.oauth.authUrl);r.searchParams.set("client_id",gn.oauth.clientId),r.searchParams.set("response_type",gn.oauth.responseType),r.searchParams.set("scope",gn.oauth.scope),r.searchParams.set("redirect_uri",n),r.searchParams.set("state",e),r.searchParams.set("nonce",t),r.searchParams.set("response_mode","fragment"),yn(),window.location.href=r.toString()}static async processCallback(){try{if(Kt.hasAllTokens()){if(!Kt.getValidSupabaseToken()){Kt.getAccessToken();await cn.attemptRegeneration()}return!0}const e=new URLSearchParams(window.location.hash.startsWith("#")?window.location.hash.substring(1):window.location.hash),t=new URLSearchParams(window.location.search),n=n=>e.get(n)||t.get(n),r=n("access_token"),a=n("id_token"),s=n("error");if(s)throw new Error(`Erro OAuth: ${s}`);if(!r||!a)throw new Error("Tokens não encontrados na URL de callback");Kt.setAccessToken(r),Kt.setIdToken(a),Dn();const o=this.extractAliasFromAccessToken(r);if(o)Kt.setSelectedAlias(o);else{const e=this.extractCompaniesFromIdToken(a);if(0===e.length)throw new Error("Nenhuma empresa encontrada nos tokens");Kt.setSelectedAlias(e[0].alias)}if(!await cn.attemptRegeneration())throw new Error("Falha ao gerar token Supabase");return Kt.clearOAuthState(),Kt.clearOAuthNonce(),!0}catch(e){throw e}}static logout(){Kt.setManualLogout(),Kt.clearAll(),window.location.href="/login"}static decodeToken(e){return Bt.parseJwtPayload(e)}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 n=[];return Object.keys(t).forEach(e=>{if(e.match(/^co(\d+)$/)&&"string"==typeof t[e]){const r=t[e].split(";");if(r.length>=4)n.push({id:r.length>7?r[7].trim():"",alias:r[0].trim(),name:r[3].trim()});else{const[r,a]=t[e].split("|");r&&a&&n.push({id:"",alias:r.trim(),name:a.trim()})}}}),n}static extractAliasFromAccessToken(e){const t=this.decodeToken(e);return t?.default||null}};cn.setLogoutCallback(()=>{Ln.logout()});let Mn=Ln;const On=e.createContext(void 0),zn=()=>{const t=e.useContext(On);if(void 0===t)throw new Error("useAuth deve ser usado dentro de um AuthProvider");return t};function Bn({queryKey:t,service:n,entityName:r,searchFields:a,additionalFilters:s={},onSuccess:i}){const[l,c]=x.useSearchParams(),u=g.useQueryClient(),{alias:d,userId:f}=zn(),m=e.useCallback(e=>{const n=`${t}_${e}`,r=l.get(n);return r||(l.get(e)||"")},[l,t]),p=m("search"),h=m("sortField")||xn.sorting.defaultField,b=m("sortDirection")||xn.sorting.defaultDirection,y=parseInt(m("page")||"1"),v=parseInt(m("limit")||String(xn.pagination.defaultPageSize)),w=p,k=e.useMemo(()=>({search:w,sortField:h,sortDirection:b,page:y,limit:v,...s}),[w,h,b,y,v,s]),N=e.useCallback(()=>n.getAll(k),[n,k]),j=g.useQuery({queryKey:[t,d,f,k],queryFn:N});if(!j)throw new Error(`useCrud: Query initialization failed for "${r}". Ensure QueryClientProvider is configured in your app root.`);const C=g.useMutation({mutationFn:n.create,onSuccess:()=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(kn.success.created(r)),i?.()},onError:e=>{o.toast.error(`${kn.error.create(r)}: ${e.message}`)}}),S=g.useMutation({mutationFn:({id:e,data:t})=>n.update(e,t),onSuccess:()=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(kn.success.updated(r)),i?.()},onError:e=>{o.toast.error(`${kn.error.update(r)}: ${e.message}`)}}),T=g.useMutation({mutationFn:n.delete,onSuccess:()=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(kn.success.deleted(r))},onError:e=>{o.toast.error(`${kn.error.delete(r)}: ${e.message}`)}}),I=e.useCallback(e=>{const n={...Object.fromEntries(l)};Object.entries(e).forEach(([e,r])=>{const a=`${t}_${e}`;""===r||0===r?delete n[a]:n[a]=String(r)}),delete n.sortField,delete n.sortDirection,c(n)},[l,c,t]),P=e.useCallback(e=>{I({search:e,page:1})},[I]),E=e.useCallback(e=>{I({sortField:e,sortDirection:h===e&&"asc"===b?"desc":"asc",page:1})},[h,b,I]),A=e.useCallback(e=>{I({page:e})},[I]),D=e.useCallback(e=>{I({limit:e,page:1})},[I]),R=e.useCallback(()=>{const e=Object.fromEntries(l),n=`${t}_`,r=Object.fromEntries(Object.entries(e).filter(([e])=>!e.startsWith(n)));c(r)},[c,l,t]),[F,_]=e.useState([]),L=e.useCallback(e=>{_(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),M=e.useCallback(()=>{const e=j?.data?.data.map(e=>e.id)||[];_(t=>t.length===e.length?[]:e)},[j?.data?.data]),O=e.useCallback(()=>{_([])},[]),z=e.useMemo(()=>{const e=j?.data?.data.map(e=>e.id)||[];return e.length>0&&F.length===e.length},[F,j?.data?.data]),B=g.useMutation({mutationFn:async e=>{await Promise.all(e.map(e=>n.delete(e)))},onSuccess:(e,n)=>{u.invalidateQueries({queryKey:[t]}),o.toast.success(`${n.length} ${r}(s) deletado(s) com sucesso`),O()},onError:e=>{o.toast.error(`Erro ao deletar itens: ${e.message}`)}}),U=e.useCallback((e,t)=>{const n=t?t(e):e;e.id?S.mutate({id:e.id,data:n}):C.mutate({...n,alias:d})},[d,C,S]);return{entities:j?.data?.data||[],pagination:{currentPage:j?.data?.currentPage||1,totalPages:j?.data?.totalPages||1,totalItems:j?.data?.totalItems||0,itemsPerPage:j?.data?.itemsPerPage||xn.pagination.defaultPageSize,hasNextPage:j?.data?.hasNextPage||!1,hasPreviousPage:j?.data?.hasPreviousPage||!1},isLoading:j?.isLoading??!0,isCreating:C?.isPending??!1,isUpdating:S?.isPending??!1,isDeleting:T?.isPending??!1,error:j?.error||null,searchTerm:p,sortField:h,sortDirection:b,currentPage:y,itemsPerPage:v,queryKey:t,createEntity:C.mutate,updateEntity:(e,t)=>S.mutate({id:e,data:t}),deleteEntity:T.mutate,save:U,handleSearch:P,handleSort:E,handlePageChange:A,handleItemsPerPageChange:D,clearFilters:R,refetch:j.refetch,selectedIds:F,selectItem:L,selectAll:M,clearSelection:O,isAllSelected:z,bulkDelete:B.mutate,isBulkDeleting:B.isPending}}const Un=V.Root,$n=V.Trigger,Vn=V.Portal,qn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Overlay,{className:pe("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:n}));qn.displayName=V.Overlay.displayName;const Hn=L.forwardRef(({className:e,...t},n)=>fe.jsxs(Vn,{children:[fe.jsx(qn,{}),fe.jsx(V.Content,{ref:n,className:pe("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})]}));Hn.displayName=V.Content.displayName;const Wn=({className:e,...t})=>fe.jsx("div",{className:pe("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});Wn.displayName="AlertDialogHeader";const Qn=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qn.displayName="AlertDialogFooter";const Kn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Title,{ref:n,className:pe("text-lg font-semibold",e),...t}));Kn.displayName=V.Title.displayName;const Xn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Description,{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));Xn.displayName=V.Description.displayName;const Gn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Action,{ref:n,className:pe(ge(),e),...t}));Gn.displayName=V.Action.displayName;const Yn=L.forwardRef(({className:e,...t},n)=>fe.jsx(V.Cancel,{ref:n,className:pe(ge({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Yn.displayName=V.Cancel.displayName;const Jn=({open:t,onOpenChange:n,item:r,onConfirm:a,entityName:s="item",isDeleting:o=!1,isBulk:i=!1,bulkCount:l})=>{const[c,u]=e.useState("");e.useEffect(()=>{t||u("")},[t]);const d=()=>{u(""),n(!1)},f=i?c===l?.toString():c===r?.title;return r?fe.jsx(Un,{open:t,onOpenChange:d,children:fe.jsxs(Hn,{className:"sm:max-w-[500px]",children:[fe.jsx(Wn,{children:fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsx("div",{className:"flex-shrink-0 w-8 h-8 rounded-full bg-destructive/10 flex items-center justify-center",children:fe.jsx("span",{className:"text-destructive font-semibold text-sm",children:"!"})}),fe.jsx("div",{className:"flex-1",children:fe.jsx(Kn,{className:"text-lg font-semibold",children:"Confirmar Exclusão"})})]})}),fe.jsx(Xn,{asChild:!0,children:fe.jsxs("div",{className:"space-y-4",children:[fe.jsxs("div",{className:"text-sm text-muted-foreground",children:[fe.jsx("p",{className:"mb-2",children:i?fe.jsx(fe.Fragment,{children:"Você está prestes a excluir permanentemente:"}):fe.jsxs(fe.Fragment,{children:["Você está prestes a excluir permanentemente o ",s,":"]})}),fe.jsx("div",{className:"p-3 bg-muted rounded-md border-l-4 border-l-destructive",children:fe.jsx("p",{className:"font-medium text-foreground",children:i?`${r.title}`:r.title})})]}),fe.jsx("div",{className:"bg-orange-50 border border-orange-200 rounded-md p-3",children:fe.jsxs("div",{className:"flex items-start space-x-2",children:[fe.jsx("div",{className:"flex-shrink-0 w-5 h-5 rounded-full bg-orange-500 flex items-center justify-center mt-0.5",children:fe.jsx("span",{className:"text-white font-bold text-xs",children:"!"})}),fe.jsxs("div",{className:"text-sm text-orange-800",children:[fe.jsx("p",{className:"font-medium mb-1",children:"Atenção!"}),fe.jsx("p",{children:i?fe.jsx(fe.Fragment,{children:"Esta ação não pode ser desfeita. Os itens serão removidos permanentemente do sistema."}):fe.jsxs(fe.Fragment,{children:["Esta ação não pode ser desfeita. O ",s," será removido permanentemente do sistema."]})})]})]})}),fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(we,{htmlFor:"confirmation",className:"text-sm font-medium",children:i?fe.jsxs(fe.Fragment,{children:["Para confirmar, digite o número de itens que serão removidos: ",fe.jsx("strong",{children:l})]}):fe.jsxs(fe.Fragment,{children:["Para confirmar, digite ",fe.jsxs("strong",{children:['"',r.title,'"']})," abaixo:"]})}),fe.jsx(ye,{id:"confirmation",type:i?"number":"text",value:c,onChange:e=>u(e.target.value),placeholder:i?`Digite: ${l}`:`Digite: ${r.title}`,className:"w-full"})]})]})}),fe.jsxs(Qn,{children:[fe.jsx(Yn,{onClick:d,children:"Cancelar"}),fe.jsx(Gn,{onClick:()=>{if(!r)return;(i?c===l?.toString():c===r.title)&&(a(r),u(""),n(!1))},disabled:!f||o,className:"bg-destructive hover:bg-destructive/90 text-destructive-foreground",children:o?"Removendo...":`Excluir ${s}`})]})]})}):null},Zn=L.forwardRef(({className:e,...t},n)=>fe.jsx("table",{ref:n,className:pe("w-full caption-bottom text-sm",e),...t}));Zn.displayName="Table";const er=L.forwardRef(({className:e,...t},n)=>fe.jsx("thead",{ref:n,className:pe("[&_tr]:border-b sticky top-0 z-[1] bg-background",e),...t}));er.displayName="TableHeader";const tr=L.forwardRef(({className:e,...t},n)=>fe.jsx("tbody",{ref:n,className:pe("[&_tr:last-child]:border-0",e),...t}));tr.displayName="TableBody";const nr=L.forwardRef(({className:e,...t},n)=>fe.jsx("tfoot",{ref:n,className:pe("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));nr.displayName="TableFooter";const rr=L.forwardRef(({className:e,...t},n)=>fe.jsx("tr",{ref:n,className:pe("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted odd:bg-muted/50",e),...t}));rr.displayName="TableRow";const ar=L.forwardRef(({className:e,...t},n)=>fe.jsx("th",{ref:n,className:pe("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}));ar.displayName="TableHead";const sr=L.forwardRef(({className:e,...t},n)=>fe.jsx("td",{ref:n,className:pe("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));sr.displayName="TableCell";const or=L.forwardRef(({className:e,...t},n)=>fe.jsx("caption",{ref:n,className:pe("mt-4 text-sm text-muted-foreground",e),...t}));function ir({rows:e=5,columns:t=4}){return fe.jsx("div",{className:"w-full",children:fe.jsxs("div",{className:"rounded-md border",children:[fe.jsx("div",{className:"border-b bg-muted/50 px-4 py-3",children:fe.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>fe.jsx(Mt,{className:"h-4 w-24"},t))})}),fe.jsx("div",{children:Array.from({length:e}).map((e,n)=>fe.jsx("div",{className:"border-b px-4 py-3 last:border-0",children:fe.jsx("div",{className:"flex space-x-4",children:Array.from({length:t}).map((e,t)=>fe.jsx(Mt,{className:"h-4 w-20"},t))})},n))})]})})}function lr({count:e=3}){return fe.jsx("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>fe.jsxs(ke,{children:[fe.jsxs(Ne,{children:[fe.jsx(Mt,{className:"h-4 w-3/4"}),fe.jsx(Mt,{className:"h-3 w-1/2"})]}),fe.jsx(Se,{children:fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(Mt,{className:"h-3 w-full"}),fe.jsx(Mt,{className:"h-3 w-2/3"})]})})]},t))})}or.displayName="TableCaption";const cr={default:i.FileX,search:i.Search,error:i.AlertCircle};function ur({icon:e,title:t,description:n,action:r,className:a,variant:s="default"}){const o=e?()=>e:cr[s];return fe.jsxs("div",{className:pe("flex flex-col items-center justify-center py-12 px-4 text-center",a),children:[fe.jsx("div",{className:"flex items-center justify-center w-16 h-16 rounded-full bg-muted mb-4",children:fe.jsx(o,{className:"h-8 w-8 text-muted-foreground"})}),fe.jsx("h3",{className:"text-lg font-semibold mb-2",children:t}),n&&fe.jsx("p",{className:"text-muted-foreground mb-6 max-w-sm",children:n}),r&&fe.jsx(xe,{onClick:r.onClick,variant:"outline",children:r.label})]})}const dr=q.Root,fr=q.Trigger,mr=q.Group,pr=q.Portal,hr=q.Sub,gr=q.RadioGroup,xr=L.forwardRef(({className:e,inset:t,children:n,...r},a)=>fe.jsxs(q.SubTrigger,{ref:a,className:pe("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),...r,children:[n,fe.jsx(i.ChevronRight,{className:"ml-auto h-4 w-4"})]}));xr.displayName=q.SubTrigger.displayName;const br=L.forwardRef(({className:e,...t},n)=>fe.jsx(q.SubContent,{ref:n,className:pe("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}));br.displayName=q.SubContent.displayName;const yr=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>fe.jsx(q.Portal,{children:fe.jsx(q.Content,{ref:r,sideOffset:t,className:pe("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),...n})}));yr.displayName=q.Content.displayName;const vr=L.forwardRef(({className:e,inset:t,...n},r)=>fe.jsx(q.Item,{ref:r,className:pe("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),...n}));vr.displayName=q.Item.displayName;const wr=L.forwardRef(({className:e,children:t,checked:n,...r},a)=>fe.jsxs(q.CheckboxItem,{ref:a,className:pe("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:n,...r,children:[fe.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:fe.jsx(q.ItemIndicator,{children:fe.jsx(i.Check,{className:"h-4 w-4"})})}),t]}));wr.displayName=q.CheckboxItem.displayName;const kr=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(q.RadioItem,{ref:r,className:pe("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),...n,children:[fe.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:fe.jsx(q.ItemIndicator,{children:fe.jsx(i.Circle,{className:"h-2 w-2 fill-current"})})}),t]}));kr.displayName=q.RadioItem.displayName;const Nr=L.forwardRef(({className:e,inset:t,...n},r)=>fe.jsx(q.Label,{ref:r,className:pe("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Nr.displayName=q.Label.displayName;const jr=L.forwardRef(({className:e,...t},n)=>fe.jsx(q.Separator,{ref:n,className:pe("-mx-1 my-1 h-px bg-muted",e),...t}));jr.displayName=q.Separator.displayName;const Cr=({className:e,...t})=>fe.jsx("span",{className:pe("ml-auto text-xs tracking-widest opacity-60",e),...t});Cr.displayName="DropdownMenuShortcut";const Sr=({onEdit:e,onDelete:t,onToggleStatus:n,isActive:r=!0,canDelete:a=!0,customActions:s=[],renderAs:o})=>{const l=[];if(e){const t={icon:i.Edit,label:"Editar",onClick:e};l.push(t)}if(s.forEach(e=>{l.push(e)}),n){const e={icon:r?i.PowerOff:i.Power,label:r?"Inativar":"Ativar",onClick:n};l.push(e)}if(a&&t){const e={icon:i.Trash2,label:"Remover",onClick:t,destructive:!0};l.push(e)}return"dropdown"===o?fe.jsx(fe.Fragment,{children:l.map((e,t)=>fe.jsxs(vr,{onClick:e.onClick,className:e.destructive?"text-destructive":"",children:[fe.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},t))}):fe.jsx(fe.Fragment,{children:l.map((e,t)=>fe.jsxs(xe,{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:[fe.jsx(e.icon,{className:"h-4 w-4 mr-2"}),e.label]},t))})},Tr=({onEdit:e,onDelete:t,canDelete:n=!0,onToggleStatus:r,isActive:a=!0,customActions:s=[]})=>fe.jsxs(dr,{children:[fe.jsx(fr,{asChild:!0,children:fe.jsx(xe,{variant:"action",size:"sm",className:"h-7 px-2 text-xs",children:fe.jsx(i.EllipsisVertical,{size:12})})}),fe.jsx(yr,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:fe.jsx(Sr,{onEdit:t=>{t?.stopPropagation(),e?.()},onDelete:e=>{e?.stopPropagation(),t?.()},onToggleStatus:e=>{e?.stopPropagation(),r?.()},isActive:a,canDelete:n,customActions:s,renderAs:"dropdown"})})]}),Ir=e.memo(({checked:e,onCheckedChange:t})=>fe.jsx(rt,{checked:e,onCheckedChange:t}),(e,t)=>e.checked===t.checked),Pr=({manager:t,columns:n,onEdit:r,onView:a,onToggleStatus:s,onDelete:o,renderActions:l,customRowActions:c,enableBulkActions:u=!1})=>{const[d,f]=e.useState(!1),[m,p]=e.useState(null);e.useEffect(()=>{const e=()=>f(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e.useEffect(()=>{const e=()=>p(null);if(m)return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[m]);const h=(()=>{n.length;let e=0;const t=n.map(t=>{if(t.width)return e+=t.width,{...t,calculatedWidth:t.width,isFixed:!0};{const n=t.minWidth||120,r=t.weight||1;return e+=n,{...t,calculatedWidth:n,weight:r,isFixed:!1}}});return e+=50,t.map(e=>e.isFixed?{...e,style:{width:`${e.calculatedWidth}px`}}:{...e,style:{minWidth:`${e.calculatedWidth}px`,width:`${e.calculatedWidth}px`}})})();return d?t.isLoading?fe.jsx(lr,{count:3}):0===t.entities.length?fe.jsx(ur,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"}):fe.jsxs("div",{className:"space-y-4",children:[t.entities.map(e=>fe.jsx(ke,{className:pe("overflow-hidden cursor-pointer hover:bg-muted/50",u&&t.selectedIds.includes(e.id)&&"bg-muted"),onClick:n=>{n.stopPropagation(),u?t.selectItem(e.id):r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),p({x:t.clientX,y:t.clientY,item:e})},children:fe.jsx(Se,{className:"p-4",children:fe.jsxs("div",{className:"flex items-start gap-3",children:[u&&fe.jsx("div",{className:"pt-0.5",onClick:e=>e.stopPropagation(),children:fe.jsx(Ir,{checked:t.selectedIds.includes(e.id),onCheckedChange:()=>t.selectItem(e.id)})}),fe.jsxs("div",{className:"flex-1",children:[n.map(t=>fe.jsxs("div",{className:"flex justify-between items-start mb-2 last:mb-0",children:[fe.jsxs("span",{className:"text-sm font-medium text-muted-foreground min-w-0 mr-2",children:[t.header,":"]}),fe.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||a||l)&&fe.jsx("div",{className:"mt-3 pt-3 border-t flex justify-end",onClick:e=>e.stopPropagation(),children:l?l(e):fe.jsx(Tr,{onEdit:r?()=>{r(e)}:void 0,onDelete:o?()=>o(e):void 0,onToggleStatus:s?()=>s(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]})]})})},e.id)),m&&fe.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:m.x,top:m.y},onClick:e=>e.stopPropagation(),children:fe.jsx(Sr,{onEdit:r?()=>{r(m.item),p(null)}:void 0,onDelete:o?()=>{o(m.item),p(null)}:void 0,onToggleStatus:s?()=>{s(m.item),p(null)}:void 0,isActive:m.item.is_actived,canDelete:!!o,customActions:c?c(m.item):[],renderAs:"context"})})]}):fe.jsxs("div",{className:"flex flex-col h-full",children:[t.isLoading?fe.jsx(ir,{rows:5,columns:n.length}):fe.jsx("div",{className:"flex flex-col h-full overflow-hidden",children:fe.jsx("div",{className:"flex-1 overflow-auto",children:fe.jsxs(Zn,{className:"table-auto",children:[fe.jsxs("colgroup",{children:[u&&fe.jsx("col",{style:{width:"50px"}}),h.map((e,t)=>fe.jsx("col",{style:e.style},t)),fe.jsx("col",{style:{width:"50px"}})]}),fe.jsx(er,{children:fe.jsxs(rr,{children:[u&&fe.jsx(ar,{className:"w-[50px]",children:fe.jsx(Ir,{checked:t.isAllSelected,onCheckedChange:t.selectAll})}),n.map(e=>{return fe.jsx(ar,{className:`${e.className||""} ${e.sortable?"cursor-pointer hover:bg-muted/50":""}`,onClick:e.sortable?()=>t.handleSort(String(e.key)):void 0,children:fe.jsxs("div",{className:"flex items-center "+(e.className?.includes("text-center")?"justify-center":""),children:[e.header,e.sortable&&(n=String(e.key),t.sortField!==n?fe.jsx(i.ArrowUpDown,{size:14,className:"ml-1 opacity-50"}):"asc"===t.sortDirection?fe.jsx(i.ArrowUp,{size:14,className:"ml-1"}):fe.jsx(i.ArrowDown,{size:14,className:"ml-1"}))]})},String(e.key));var n}),fe.jsx(ar,{className:"w-[50px] text-center",children:"Ações"})]})}),fe.jsx(tr,{children:0===t.entities.length?fe.jsx(rr,{children:fe.jsx(sr,{colSpan:u?n.length+2:n.length+1,className:"h-32",children:fe.jsx(ur,{title:"Nenhum item encontrado",description:"Não há dados para exibir no momento.",variant:"search"})})}):t.entities.map(e=>fe.jsxs(rr,{className:pe("cursor-pointer hover:bg-muted/50",u&&t.selectedIds.includes(e.id)&&"bg-muted"),onClick:n=>{n.stopPropagation(),u?t.selectItem(e.id):r?.(e)},onContextMenu:t=>{t.preventDefault(),t.stopPropagation(),p({x:t.clientX,y:t.clientY,item:e})},children:[u&&fe.jsx(sr,{onClick:e=>e.stopPropagation(),children:fe.jsx(Ir,{checked:t.selectedIds.includes(e.id),onCheckedChange:()=>t.selectItem(e.id)})}),n.map(t=>fe.jsx(sr,{className:t.className,children:t.render?t.render(e):e[t.key]},String(t.key))),fe.jsx(sr,{className:"text-center",children:l?l(e):fe.jsx(Tr,{onEdit:r?()=>r(e):void 0,onDelete:o?()=>o(e):void 0,onToggleStatus:s?()=>s(e):void 0,isActive:e.is_actived,customActions:c?c(e):[]})})]},e.id))})]})})}),m&&fe.jsx("div",{className:"fixed bg-background border border-border rounded-md shadow-lg py-1 z-50 min-w-[120px]",style:{left:m.x,top:m.y},onClick:e=>e.stopPropagation(),children:fe.jsx(Sr,{onEdit:r?()=>{r(m.item),p(null)}:void 0,onDelete:o?()=>{o(m.item),p(null)}:void 0,onToggleStatus:s?()=>{s(m.item),p(null)}:void 0,isActive:m.item.is_actived,canDelete:!!o,customActions:c?c(m.item):[],renderAs:"context"})})]})};function Er(t,n,r,a){const[s,o]=e.useState({}),[i,l]=e.useState({}),c=e.useMemo(()=>t,[t]),u=e=>e instanceof Date&&!isNaN(e.getTime()),d=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{}}},f=(e,t)=>{if(e.computedValue&&"function"==typeof e.computedValue)try{return e.computedValue(t)}catch(n){return d(e)}},m=(e,t,n)=>{if(e.required&&(""===t||null==t||Array.isArray(t)&&0===t.length))return`${e.label} é obrigatório`;if(e.validation){let a;if("function"==typeof e.validation?a=e.validation:e.validation.custom&&"function"==typeof e.validation.custom&&(a=e.validation.custom),a)try{const e=a(t,n);if(e)return e}catch(r){}}};e.useEffect(()=>{if(!a)return;const e=t=>{const n=[];return t.forEach(t=>{n.push(t),t.fields&&n.push(...e(t.fields))}),n},t=e(c),s={};t.forEach(e=>{let t;if(n&&void 0!==n[e.name]){if(t=n[e.name],null==t&&(t=""),"date"===e.type&&t)if("string"==typeof t){const e=new Date(t);u(e)&&(t=e.toISOString().split("T")[0])}else u(t)&&(t=t.toISOString().split("T")[0])}else t=d(e);s[e.name]=t}),t.forEach(e=>{const t=f(e,s);void 0!==t&&(s[e.name]=t)}),n&&Object.keys(n).forEach(e=>{t.find(t=>t.name===e)||void 0===n[e]||(s[e]=n[e])}),o(s),l({}),r&&r(s)},[c,n,r,a]);const p=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...p(e.fields))}),t},h=()=>{const e=p(c),t={};return e.forEach(e=>{const n=m(e,s[e.name],s);n&&(t[e.name]=n)}),l(t),0===Object.keys(t).length};return{formData:s,errors:i,updateField:(e,t)=>{o(n=>{const a={...n,[e]:t},s=((e,t)=>{let n={...t};const r=e=>{const t=[];return e.forEach(e=>{t.push(e),e.fields&&t.push(...r(e.fields))}),t};return r(c).filter(t=>t.dependsOn===e).forEach(e=>{const t=f(e,n);void 0!==t&&(n={...n,[e.name]:t})}),n})(e,a);return r&&r(s),s}),i[e]&&l(t=>{const n={...t};return delete n[e],n});const n=p(c).find(t=>t.name===e);if(n){const r=m(n,t,s);r&&l(t=>({...t,[e]:r}))}},validateForm:h,handleSubmit:e=>t=>{t&&(t.preventDefault(),t.stopPropagation()),h()&&e(s)}}}const Ar=["#3b82f6","#ef4444","#10b981","#f59e0b","#8b5cf6","#06b6d4","#84cc16","#f97316","#ec4899","#6b7280"],Dr=({value:e="#3b82f6",onChange:t,label:n})=>fe.jsxs("div",{className:"space-y-2",children:[n&&fe.jsx(we,{children:n}),fe.jsxs(St,{children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[fe.jsx("div",{className:"h-4 w-4 rounded border mr-2",style:{backgroundColor:e}}),e]})}),fe.jsx(It,{className:"w-64",children:fe.jsxs("div",{className:"space-y-3",children:[fe.jsxs("div",{children:[fe.jsx(we,{htmlFor:"color-input",children:"Cor personalizada"}),fe.jsx(ye,{id:"color-input",type:"color",value:e,onChange:e=>t?.(e.target.value),className:"h-10 w-full"})]}),fe.jsxs("div",{children:[fe.jsx(we,{children:"Cores predefinidas"}),fe.jsx("div",{className:"grid grid-cols-5 gap-2 mt-2",children:Ar.map(e=>fe.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))})]})]})})]})]}),Rr=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsxs(H.Root,{ref:r,className:pe("relative overflow-hidden",e),...n,children:[fe.jsx(H.Viewport,{className:"h-full w-full rounded-[inherit]",children:t}),fe.jsx(Fr,{}),fe.jsx(H.Corner,{})]}));Rr.displayName=H.Root.displayName;const Fr=L.forwardRef(({className:e,orientation:t="vertical",...n},r)=>fe.jsx(H.ScrollAreaScrollbar,{ref:r,orientation:t,className:pe("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),...n,children:fe.jsx(H.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Fr.displayName=H.ScrollAreaScrollbar.displayName;const _r={Star:i.Star,Heart:i.Heart,Home:i.Home,User:i.User,Settings:i.Settings,Mail:i.Mail,Phone:i.Phone,Calendar:i.Calendar,MapPin:i.MapPin,Camera:i.Camera,Image:i.Image,Music:i.Music,Video:i.Video,Book:i.Book,Bookmark:i.Bookmark,Search:i.Search,Filter:i.Filter,Edit:i.Edit,Trash2:i.Trash2,Plus:i.Plus,Minus:i.Minus,Check:i.Check,X:i.X,ChevronDown:i.ChevronDown,ChevronUp:i.ChevronUp,ChevronLeft:i.ChevronLeft,ChevronRight:i.ChevronRight,ArrowUp:i.ArrowUp,ArrowDown:i.ArrowDown,ArrowLeft:i.ArrowLeft,ArrowRight:i.ArrowRight,Clock:i.Clock,Bell:i.Bell,AlertCircle:i.AlertCircle,Info:i.Info,HelpCircle:i.HelpCircle,Download:i.Download,Upload:i.Upload,Share:i.Share,Copy:i.Copy,Save:i.Save,FileText:i.FileText,Folder:i.Folder,FolderOpen:i.FolderOpen,Archive:i.Archive,Lock:i.Lock,Unlock:i.Unlock,Eye:i.Eye,EyeOff:i.EyeOff,Shield:i.Shield,Key:i.Key,Zap:i.Zap,Flame:i.Flame,Sparkles:i.Sparkles,Award:i.Award,Trophy:i.Trophy,Target:i.Target},Lr=({value:t="Star",onChange:n,label:r})=>{const[a,s]=e.useState(""),o=Object.entries(_r).filter(([e])=>e.toLowerCase().includes(a.toLowerCase())),l=_r[t]||i.Star;return fe.jsxs("div",{className:"space-y-2",children:[r&&fe.jsx(we,{children:r}),fe.jsxs(St,{children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",className:"w-full justify-start text-left font-normal",children:[fe.jsx(l,{className:"h-4 w-4 mr-2"}),t]})}),fe.jsx(It,{className:"w-80",children:fe.jsxs("div",{className:"space-y-3",children:[fe.jsxs("div",{children:[fe.jsx(we,{htmlFor:"icon-search",children:"Buscar ícone"}),fe.jsx(ye,{id:"icon-search",placeholder:"Digite o nome do ícone...",value:a,onChange:e=>s(e.target.value)})]}),fe.jsx(Rr,{className:"h-48",children:fe.jsx("div",{className:"grid grid-cols-6 gap-2",children:o.map(([e,r])=>fe.jsx("button",{className:"p-2 rounded border-2 hover:border-primary "+(t===e?"border-primary bg-primary/10":"border-border"),onClick:()=>n?.(e),title:e,children:fe.jsx(r,{className:"h-4 w-4"})},e))})})]})})]})]})};function Mr({options:e,value:t,onChange:n,onCreate:r,placeholder:a="Selecionar...",searchPlaceholder:s="Buscar...",createLabel:o=e=>`Criar "${e}"`,emptyMessage:l="Nenhum item encontrado.",disabled:c=!1,error:u,isLoading:d=!1,className:f,mode:m="single"}){const[p,h]=L.useState(!1),[g,x]=L.useState(""),[b,y]=L.useState(!1),v=L.useMemo(()=>t?Array.isArray(t)?t:[t]:[],[t]),w=L.useMemo(()=>v.map(t=>e.find(e=>e.value===t)?.label).filter(Boolean),[v,e]),k=L.useMemo(()=>g?e.filter(e=>e.label.toLowerCase().includes(g.toLowerCase())):e,[e,g]),N=L.useMemo(()=>!(!g||!r)&&!e.some(e=>e.label.toLowerCase()===g.toLowerCase()),[g,e,r]),j=L.useMemo(()=>0===w.length?a:"single"===m?w[0]:null,[w,a,m]);return fe.jsxs(St,{open:p,onOpenChange:h,children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",role:"combobox","aria-expanded":p,disabled:c||d,className:pe("w-full justify-between",!t&&"text-muted-foreground",u&&"border-destructive",f),children:[fe.jsx("div",{className:"flex flex-wrap gap-1 flex-1 overflow-hidden",children:"multiple"===m&&w.length>0?w.map((e,t)=>fe.jsxs(ot,{variant:"secondary",className:"mr-1",children:[e,fe.jsx("button",{className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onMouseDown:e=>((e,t)=>{t.stopPropagation();const r=v.filter(t=>t!==e);n("single"===m?"":r)})(v[t],e),children:"✕"})]},v[t])):fe.jsx("span",{className:"truncate",children:j})}),fe.jsx(i.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),fe.jsx(It,{className:"w-full p-0",align:"start",children:fe.jsxs(Pt,{children:[fe.jsx("div",{className:"flex items-center border-b px-3",children:fe.jsx("input",{placeholder:s,value:g,onChange:e=>x(e.target.value),className:"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"})}),fe.jsxs(At,{children:[0===k.length&&!N&&fe.jsx(Dt,{children:l}),N&&fe.jsx(Rt,{children:fe.jsxs(_t,{onSelect:async()=>{if(r&&g){y(!0);try{const e=await r(g);e&&("single"===m?(n(e),h(!1)):n([...v,e])),x("")}catch(e){}finally{y(!1)}}},className:"cursor-pointer",disabled:b,children:[fe.jsx(i.Plus,{className:"mr-2 h-4 w-4 text-primary"}),fe.jsx("span",{className:"text-primary font-medium",children:o(g)})]})}),k.length>0&&fe.jsx(Rt,{children:k.map(e=>fe.jsxs(_t,{value:e.value,onSelect:()=>(e=>{if("single"===m)n(e),h(!1),x("");else{const t=v.includes(e)?v.filter(t=>t!==e):[...v,e];n(t)}})(e.value),className:"cursor-pointer",children:[fe.jsx(i.Check,{className:pe("mr-2 h-4 w-4",v.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},e.value))})]})]})})]})}function Or({value:t,onChange:n,items:r,isLoading:a=!1,error:s=null,getItemValue:o,getItemLabel:l,searchPlaceholder:c="Buscar...",emptyMessage:u="Nenhum item disponível",noResultsMessage:d="Nenhum resultado encontrado",sortItems:f,placeholder:m="Selecionar...",disabled:p=!1,className:h}){const[g,x]=e.useState(""),b=e.useMemo(()=>{const e=f?[...r].sort(f):[...r].sort((e,t)=>l(e).localeCompare(l(t),"pt-BR"));if(!g.trim())return e;const t=g.toLowerCase();return e.filter(e=>l(e).toLowerCase().includes(t))},[r,g,f,l]);return a?fe.jsx(Mt,{className:pe("h-10 w-full",h)}):s?fe.jsxs("div",{className:pe("flex items-center gap-2 p-2 border border-destructive/20 rounded-md",h),children:[fe.jsx(i.AlertCircle,{className:"h-4 w-4 text-destructive"}),fe.jsx("span",{className:"text-sm text-destructive",children:s.message||"Erro ao carregar dados"})]}):fe.jsxs(Qe,{value:t,onValueChange:n,disabled:p||0===r.length,children:[fe.jsx(Ge,{className:h,children:fe.jsx(Xe,{placeholder:m})}),fe.jsxs(Ze,{children:[fe.jsx("div",{className:"px-2 pb-2",children:fe.jsxs("div",{className:"relative",children:[fe.jsx(i.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),fe.jsx(ye,{placeholder:c,value:g,onChange:e=>x(e.target.value),onKeyDown:e=>e.stopPropagation(),className:"pl-8 h-9"})]})}),0===b.length?fe.jsx(tt,{value:"no-items",disabled:!0,children:g?d:u}):b.map(e=>fe.jsx(tt,{value:o(e),children:l(e)},o(e)))]})]})}const zr=(e={})=>{const{user:t,alias:n}=zn(),r=wn(),{enabled:a=r.enableUsersApi}=e;return g.useQuery({queryKey:["qualiex-users",n],queryFn:()=>hn.getUsers(n),enabled:a&&!!n&&!!t,retry:2,retryDelay:1e3})},Br=({value:e="",onChange:t,placeholder:n="Selecionar usuário",disabled:r,className:a,enabled:s})=>{const{data:o=[],isLoading:i,error:l}=zr({enabled:s});return fe.jsx(Or,{value:e,onChange:t,items:o,isLoading:i,error:l,getItemValue:e=>e.userId,getItemLabel:e=>e.userName,placeholder:n,searchPlaceholder:"Buscar usuário...",emptyMessage:"Nenhum usuário disponível",noResultsMessage:"Nenhum usuário encontrado",disabled:r,className:a})};function Ur({title:t,sections:n,initialData:r,onSubmit:a,onCancel:s,open:o,submitButtonText:i="Salvar",isLoading:l=!1,usersData:c}){const[u,d]=e.useState(n?.[0]?.id||""),f=e.useMemo(()=>n&&Array.isArray(n)?n.flatMap(e=>e.fields.flatMap(e=>"group"===e.type?e.fields||[]:e)):[],[n]),{formData:m,errors:p,updateField:h,handleSubmit:g}=Er(f,r,void 0,o),x=e.useMemo(()=>n&&Array.isArray(n)?n.map(e=>({...e,disabled:e.condition?!e.condition(m):e.disabled||!1})):[],[n,m]),b=e.useMemo(()=>{const e=x.find(e=>e.id===u);if(e&&!e.disabled)return u;const t=x.find(e=>!e.disabled);return t?.id||u},[x,u]);e.useEffect(()=>{b!==u&&d(b)},[b,u]);const y=x.find(e=>e.id===b),v=e=>{const t=(e.computedValue,m[e.name]),n=void 0!==t?t:"",r=p[e.name];switch(e.type){case"group":return fe.jsxs("div",{className:"space-y-2",children:[e.label,fe.jsx("div",{className:e.className||("horizontal"===e.layout?"flex gap-3":"space-y-3"),children:e.fields?.map(e=>v(e))})]},e.name);case"user-select":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(Br,{value:n||"",onChange:t=>h(e.name,t),placeholder:e.placeholder,disabled:e.disabled,className:r?"border-red-500":""}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"textarea":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(at,{id:e.name,value:n||"",onChange:t=>{h(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"select":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsxs(Qe,{value:String(n),onValueChange:t=>{h(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,children:[fe.jsx(Ge,{className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,children:fe.jsx(Xe,{placeholder:e.placeholder})}),fe.jsx(Ze,{children:e.options?.map(e=>fe.jsx(tt,{value:e.value,children:e.label},e.value))})]}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"date":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(ye,{id:e.name,type:"date",value:String(n),onChange:t=>h(e.name,t.target.value),placeholder:e.placeholder,disabled:e.disabled,className:pe("w-full",r?"border-red-500":"",e.disabled?"bg-gray-100 cursor-not-allowed":"")}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"color":return fe.jsxs("div",{children:[fe.jsxs(we,{htmlFor:e.name,children:[e.label," ",e.required&&fe.jsx("span",{className:"text-destructive",children:"*"})]}),fe.jsx(ye,{id:e.name,type:"color",value:n||e.defaultValue||"#000000",onChange:t=>h(e.name,t.target.value),className:"h-10"}),r&&fe.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"color-picker":return fe.jsxs("div",{children:[fe.jsx(Dr,{label:`${e.label} ${e.required?"*":""}`,value:n||e.defaultValue||"#3b82f6",onChange:t=>h(e.name,t)}),r&&fe.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"icon-picker":return fe.jsxs("div",{children:[fe.jsx(Lr,{label:`${e.label} ${e.required?"*":""}`,value:n||e.defaultValue||"Star",onChange:t=>h(e.name,t)}),r&&fe.jsx("p",{className:"text-sm text-destructive mt-1",children:r})]},e.name);case"custom":if(!e.component)return null;const t=e.component;return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[e.label&&fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(t,{value:n,onChange:t=>{h(e.name,t),e.onValueChange&&e.onValueChange(t)},disabled:e.disabled,error:r,...e.componentProps||{}}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"creatable-select":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsxs(we,{htmlFor:e.name,children:[e.label,e.required&&fe.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),fe.jsx(Mr,{options:e.options||[],value:n,onChange:t=>{h(e.name,t),e.onValueChange&&e.onValueChange(t)},onCreate:e.onCreate,placeholder:e.placeholder,searchPlaceholder:e.searchPlaceholder,createLabel:e.createLabel,emptyMessage:e.emptyMessage,disabled:e.disabled,error:r,mode:e.mode||"single"}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);case"number":return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(ye,{id:e.name,type:"number",value:null!=n?String(n):"",onChange:t=>{const n=t.target.value,r=""===n?null:Number(n);h(e.name,r)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,min:e.min,step:e.step||"1"}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name);default:return fe.jsxs("div",{className:`space-y-2 ${e.className||""}`,children:[fe.jsx(we,{htmlFor:e.name,children:e.label}),fe.jsx(ye,{id:e.name,type:"text",value:n||"",onChange:t=>{h(e.name,t.target.value)},placeholder:e.placeholder,disabled:e.disabled,className:`${r?"border-red-500":""} ${e.disabled?"bg-gray-100 cursor-not-allowed":""}`,readOnly:e.disabled}),r&&fe.jsx("p",{className:"text-sm text-red-500",children:r})]},e.name)}},w=e.useCallback(()=>{if(!y)return null;if(y.disabled)return fe.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[fe.jsx("div",{className:"rounded-full bg-muted p-3 mb-4",children:fe.jsx("svg",{className:"h-6 w-6 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:fe.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m0 0v2m0-2h2m-2 0H9m3-8V9m0-4V3"})})}),fe.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Seção não disponível"}),fe.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(y.component){const e=y.component;return fe.jsx(e,{formData:m,updateField:h,errors:p,users:c,disabled:y.disabled})}return fe.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:y.fields.map(v)})},[y,m,h,p,c,v]),k=fe.jsxs("div",{className:"flex flex-col max-h-[80vh]",children:[x.length>1&&fe.jsx("div",{className:"flex-shrink-0 p-4 border-b",children:fe.jsx("div",{className:"flex space-x-2",children:x.map(e=>fe.jsx(xe,{variant:b===e.id?"action-primary":"action-secondary",size:"sm",onClick:()=>(e=>{const t=x.find(t=>t.id===e);t&&!t.disabled&&d(e)})(e.id),disabled:e.disabled,className:e.disabled?"opacity-50 cursor-not-allowed":"",children:e.title},e.id))})}),fe.jsx("div",{className:"flex-1 overflow-y-auto px-2 md:px-4 pt-0 pb-2 md:pb-4",children:l?fe.jsx("div",{className:"flex items-center justify-center py-12",children:fe.jsx("div",{className:"text-muted-foreground",children:"Carregando dados..."})}):fe.jsxs("form",{onSubmit:g(a),className:"space-y-3 md:space-y-4",children:[w(),fe.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[fe.jsx(xe,{type:"button",variant:"outline",onClick:s,children:"Cancelar"}),fe.jsx(xe,{type:"submit",disabled:l,children:i})]})]})})]});return fe.jsx(Ie,{open:o,onOpenChange:e=>{!1===e&&!0===o&&s()},children:fe.jsxs(Re,{className:"max-w-4xl max-h-[90vh] overflow-hidden",children:[fe.jsxs(Fe,{className:"bg-primary text-primary-foreground px-6 py-4 -mx-6 -mt-6 mb-4",children:[fe.jsx(Le,{className:"text-white",children:t}),fe.jsx(Me,{className:"sr-only",children:"Formulário para preenchimento de dados"})]}),k]})})}function $r({currentPage:e,totalPages:t,totalItems:n,itemsPerPage:r,onPageChange:a,onItemsPerPageChange:s,variant:o="full"}){const l=(e-1)*r+1,c=Math.min(e*r,n);return fe.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-4",children:[fe.jsx("div",{className:"flex items-center gap-2",children:"full"===o&&fe.jsxs(fe.Fragment,{children:[fe.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Itens por página"}),fe.jsxs(Qe,{value:String(r),onValueChange:e=>s(Number(e)),children:[fe.jsx(Ge,{className:"h-8 w-[70px]",children:fe.jsx(Xe,{})}),fe.jsxs(Ze,{children:[fe.jsx(tt,{value:"10",children:"10"}),fe.jsx(tt,{value:"25",children:"25"}),fe.jsx(tt,{value:"50",children:"50"}),fe.jsx(tt,{value:"100",children:"100"})]})]})]})}),fe.jsxs("div",{className:"text-sm text-muted-foreground text-center hidden sm:block",children:[l,"-",c," de ",n," itens"]}),fe.jsxs("div",{className:"flex items-center gap-1",children:[fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(1),disabled:1===e,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronsLeft,{size:16})}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(e-1),disabled:1===e,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronLeft,{size:16})}),fe.jsxs("div",{className:"flex items-center gap-1 px-2",children:[fe.jsx("span",{className:"text-sm font-medium",children:e}),fe.jsx("span",{className:"text-sm text-muted-foreground",children:"de"}),fe.jsx("span",{className:"text-sm font-medium",children:t})]}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(e+1),disabled:e===t,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronRight,{size:16})}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:()=>a(t),disabled:e===t,className:"h-8 w-8 p-0",children:fe.jsx(i.ChevronsRight,{size:16})})]})]})}function Vr({manager:e}){return fe.jsx($r,{currentPage:e.pagination.currentPage,totalPages:e.pagination.totalPages,totalItems:e.pagination.totalItems,itemsPerPage:e.pagination.itemsPerPage,onPageChange:e.handlePageChange,onItemsPerPageChange:e.handleItemsPerPageChange,variant:"full"})}const qr=({selectedCount:e,onClearSelection:t,onBulkDelete:n,customActions:r=[],isLoading:a=!1})=>fe.jsxs("div",{className:"flex-shrink-0 flex items-center justify-between px-4 py-2 bg-primary/10 border-b border-primary/20",children:[fe.jsxs("div",{className:"flex items-center gap-3",children:[fe.jsxs("span",{className:"text-sm font-medium",children:[e," ",1===e?"item selecionado":"itens selecionados"]}),fe.jsxs(xe,{variant:"ghost",size:"sm",onClick:t,className:"h-7 px-2",children:[fe.jsx(i.X,{size:14,className:"mr-1"}),"Limpar"]})]}),fe.jsxs("div",{className:"flex items-center gap-2",children:[r.map((e,t)=>{const n=e.icon;return fe.jsxs(xe,{variant:e.variant||"outline",size:"sm",onClick:()=>e.action([]),disabled:a,className:"h-7",children:[n&&fe.jsx(n,{size:14,className:"mr-1"}),e.label]},t)}),n&&fe.jsxs(xe,{variant:"destructive",size:"sm",onClick:n,disabled:a,className:"h-7",children:[fe.jsx(i.Trash2,{size:14,className:"mr-1"}),"Remover"]})]})]}),Hr={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"},Wr={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"},Qr={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around",evenly:"justify-evenly"};function Kr({children:e,direction:t="column",gap:n="md",align:r="stretch",justify:a="start",wrap:s=!1,className:o}){return fe.jsx("div",{className:pe("flex","column"===t?"flex-col":"flex-row",Hr[n],Wr[r],Qr[a],s&&"flex-wrap",o),children:e})}function Xr({manager:e,filters:t,inline:n=!1}){const{isSearchVisible:r}=zn(),a=e.searchTerm,s=fe.jsxs(fe.Fragment,{children:[t.some(e=>"search"===e.type)&&!r&&fe.jsxs("div",{className:"relative flex-1",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),fe.jsx(ye,{placeholder:"Buscar...",value:e.searchTerm,onChange:t=>e.handleSearch(t.target.value),className:"pl-10"})]}),t.filter(e=>"select"===e.type&&e.options).map((e,t)=>fe.jsxs("select",{value:e.value||"",onChange:t=>e.onChange?.(t.target.value),className:"h-10 px-3 rounded-md border border-input bg-background text-sm 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",children:[e.placeholder&&fe.jsx("option",{value:"",children:e.placeholder}),e.options.map(e=>fe.jsx("option",{value:e.value,children:e.label},e.value))]},`select-${t}`)),t.filter(e=>"custom"===e.type&&e.component).map((e,t)=>{const r=e.component;return fe.jsx("div",{className:n?"":"w-full sm:w-auto",children:fe.jsx(r,{...e.props})},`custom-${t}`)}),a&&fe.jsxs(xe,{variant:"outline",onClick:e.clearFilters,className:"whitespace-nowrap",children:[fe.jsx(i.X,{className:"h-4 w-4 mr-2"}),"Limpar Filtros"]})]});return n?fe.jsx("div",{className:"flex items-center gap-2",children:s}):fe.jsx(Kr,{direction:"column",gap:"md",className:"mb-6",children:fe.jsx(Kr,{direction:"row",gap:"md",wrap:!0,className:"flex-col sm:flex-row",children:s})})}function Gr({manager:t,config:n,formSections:r,onSave:a,onToggleStatus:s,defaultSort:o}){t&&t.queryKey;const{setSearchVisible:l}=zn(),[c,u]=x.useSearchParams(),[d,f]=e.useState(!1),[m,p]=e.useState(null),[h,g]=e.useState({isOpen:!1,entityId:null,entityName:""}),[b,y]=e.useState({isOpen:!1,count:0});e.useEffect(()=>(l(!0),()=>{l(!1)}),[l]),e.useEffect(()=>{if(o&&t){const e=`${t.queryKey}_sortField`,n=`${t.queryKey}_sortDirection`;c.has(e)||c.has(n)||(t.handleSort(o.column),"desc"===o.direction&&setTimeout(()=>t.handleSort(o.column),0))}},[]);return fe.jsxs("div",{className:"flex-1 flex flex-col h-full",children:[n.enableBulkActions&&t.selectedIds.length>0&&fe.jsx(qr,{selectedCount:t.selectedIds.length,onClearSelection:t.clearSelection,onBulkDelete:n.bulkActions&&n.bulkActions.length>0?void 0:()=>{y({isOpen:!0,count:t.selectedIds.length})},customActions:n.bulkActions,isLoading:t.isBulkDeleting}),fe.jsxs("div",{className:"flex-shrink-0 flex justify-between items-center px-4 py-1.5 bg-muted/50 border-b gap-4",children:[fe.jsxs("div",{className:"flex items-center gap-2",children:[fe.jsxs(xe,{onClick:()=>{n.onNew?n.onNew():(p(null),f(!0))},children:[fe.jsx(i.Plus,{size:16,className:"mr-2"}),"Novo"]}),n.customActions?.map((e,t)=>fe.jsxs(xe,{onClick:e.action,variant:e.variant||"outline",children:[e.icon&&fe.jsx(e.icon,{size:16,className:"mr-2"}),e.label]},t))]}),n.filters&&n.filters.length>0&&fe.jsx("div",{className:"flex items-center gap-2 flex-1 justify-end",children:fe.jsx(Xr,{manager:t,filters:n.filters,inline:!0})})]}),fe.jsx("div",{className:"flex-1 flex flex-col overflow-hidden",children:n.customListView?fe.jsx("div",{className:"flex-1 overflow-auto p-4",children:n.customListView(t.entities,t)}):fe.jsx(Pr,{manager:t,columns:n.columns,onEdit:e=>{n.onEdit?n.onEdit(e):(p(e),f(!0))},onDelete:e=>{g({isOpen:!0,entityId:e.id,entityName:e.title||e.name||"Item"})},onToggleStatus:s,enableBulkActions:n.enableBulkActions,customRowActions:n.customRowActions})}),fe.jsx("div",{className:"flex-shrink-0 border-t bg-background",children:fe.jsx(Vr,{manager:t})}),!n.useCustomRouting&&fe.jsx(Ur,{open:d,title:m?`Editar ${n.entityName}`:`Novo ${n.entityName}`,sections:r,initialData:m||void 0,onSubmit:e=>{a(e),f(!1),p(null)},onCancel:()=>{f(!1),p(null)},isLoading:t.isLoading,submitButtonText:m?"Atualizar":"Criar"}),fe.jsx(Jn,{open:h.isOpen,onOpenChange:()=>{g({isOpen:!1,entityId:null,entityName:""})},onConfirm:e=>{h.entityId&&(t.deleteEntity(h.entityId),g({isOpen:!1,entityId:null,entityName:""}))},item:h.entityId?{id:h.entityId,title:h.entityName}:void 0,entityName:n.entityName,isDeleting:t.isDeleting}),fe.jsx(Jn,{open:b.isOpen,onOpenChange:()=>y({isOpen:!1,count:0}),onConfirm:()=>(t.bulkDelete?.(t.selectedIds),void y({isOpen:!1,count:0})),item:{id:"bulk",title:`${b.count} ${1===b.count?n.entityName:n.entityNamePlural}`},entityName:n.entityNamePlural,isDeleting:t.isBulkDeleting,isBulk:!0,bulkCount:b.count})]})}function Yr(e,t,n={}){const r=[];return Object.keys(t).forEach(e=>{if("id"!==e&&!e.endsWith("_at")){const n=t[e],a={key:e,header:Zr(e),label:Zr(e),...Jr(e,n),sortable:!0,searchable:"string"==typeof n};r.push(a)}}),{title:e,columns:r,searchPlaceholder:`Buscar ${e.toLowerCase()}...`,itemsPerPage:10,enableCreate:!0,enableEdit:!0,enableDelete:!0,enableSearch:!0,enableFilters:!1,...n}}function Jr(e,t){const n=e.toLowerCase();return n.includes("email")?{type:"email",required:!0}:n.includes("phone")||n.includes("tel")?{type:"tel"}:n.includes("description")||n.includes("content")||n.includes("notes")?{type:"textarea"}:n.includes("status")||n.includes("type")||n.includes("category")?{type:"select",options:[]}:"boolean"==typeof t?{type:"boolean"}:"number"==typeof t?{type:"number"}:t instanceof Date?{type:"date"}:{type:"text"}}function Zr(e){return e.replace(/([A-Z])/g," $1").replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}const ea={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}};const ta=n.cva("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"}}),na=L.forwardRef(({className:e,variant:t,...n},r)=>fe.jsx("div",{ref:r,role:"alert",className:pe(ta({variant:t}),e),...n}));na.displayName="Alert";const ra=L.forwardRef(({className:e,...t},n)=>fe.jsx("h5",{ref:n,className:pe("mb-1 font-medium leading-none tracking-tight",e),...t}));ra.displayName="AlertTitle";const aa=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,className:pe("text-sm [&_p]:leading-relaxed",e),...t}));aa.displayName="AlertDescription";const sa=e.createContext(void 0);function oa({children:t}){const[n,r]=e.useState({});return fe.jsx(sa.Provider,{value:{metadata:n,setMetadata:r,clearMetadata:()=>r({})},children:t})}function ia(){const t=e.useContext(sa);if(!t)throw new Error("usePageMetadataContext must be used within PageMetadataProvider");return t}const la=W.Root,ca=L.forwardRef(({className:e,...t},n)=>fe.jsx(W.Item,{ref:n,className:pe("border-b",e),...t}));ca.displayName="AccordionItem";const ua=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsx(W.Header,{className:"flex",children:fe.jsxs(W.Trigger,{ref:r,className:pe("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,fe.jsx(i.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));ua.displayName=W.Trigger.displayName;const da=L.forwardRef(({className:e,children:t,...n},r)=>fe.jsx(W.Content,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:fe.jsx("div",{className:pe("pb-4 pt-0",e),children:t})}));da.displayName=W.Content.displayName;const fa=Q.Root,ma=L.forwardRef(({className:e,...t},n)=>fe.jsx(K.Root,{ref:n,className:pe("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));ma.displayName=K.Root.displayName;const pa=L.forwardRef(({className:e,...t},n)=>fe.jsx(K.Image,{ref:n,className:pe("aspect-square h-full w-full",e),...t}));pa.displayName=K.Image.displayName;const ha=L.forwardRef(({className:e,...t},n)=>fe.jsx(K.Fallback,{ref:n,className:pe("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));ha.displayName=K.Fallback.displayName;const ga=L.forwardRef(({...e},t)=>fe.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));ga.displayName="Breadcrumb";const xa=L.forwardRef(({className:e,...t},n)=>fe.jsx("ol",{ref:n,className:pe("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 ba=L.forwardRef(({className:e,...t},n)=>fe.jsx("li",{ref:n,className:pe("inline-flex items-center gap-1.5",e),...t}));ba.displayName="BreadcrumbItem";const ya=L.forwardRef(({asChild:e,className:t,...n},r)=>{const a=e?L.Fragment:"a";return fe.jsx(a,{ref:r,className:pe("transition-colors hover:text-foreground",t),...n})});ya.displayName="BreadcrumbLink";const va=L.forwardRef(({className:e,...t},n)=>fe.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:pe("font-normal text-foreground",e),...t}));va.displayName="BreadcrumbPage";const wa=({children:e,className:t,...n})=>fe.jsx("li",{role:"presentation","aria-hidden":"true",className:pe("[&>svg]:size-3.5",t),...n,children:e??fe.jsx(i.ChevronRight,{})});wa.displayName="BreadcrumbSeparator";const ka=({className:e,...t})=>fe.jsxs("span",{role:"presentation","aria-hidden":"true",className:pe("flex h-9 w-9 items-center justify-center",e),...t,children:[fe.jsx(i.MoreHorizontal,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"More"})]});function Na(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}function ja(e){return(t,n)=>{let r;if("formatting"===(n?.context?String(n.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,a=n?.width?String(n.width):t;r=e.formattingValues[a]||e.formattingValues[t]}else{const t=e.defaultWidth,a=n?.width?String(n.width):e.defaultWidth;r=e.values[a]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function Ca(e){return(t,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(a);if(!s)return null;const o=s[0],i=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(i)?function(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n;return}(i,e=>e.test(o)):function(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n;return}(i,e=>e.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;return{value:c,rest:t.slice(o.length)}}}ka.displayName="BreadcrumbEllipsis";const Sa={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:Na({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:Na({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:Na({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Ia={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"},Pa={ordinalNumber:(e,t)=>{const n=Number(e);return"week"===t?.unit?n+"ª":n+"º"},era:ja({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","depois de cristo"]},defaultWidth:"wide"}),quarter:ja({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:ja({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:ja({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:ja({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"})},Ea={ordinalNumber:(Aa={matchPattern:/^(\d+)[ºªo]?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,t={})=>{const n=e.match(Aa.matchPattern);if(!n)return null;const r=n[0],a=e.match(Aa.parsePattern);if(!a)return null;let s=Aa.valueCallback?Aa.valueCallback(a[0]):a[0];return s=t.valueCallback?t.valueCallback(s):s,{value:s,rest:e.slice(r.length)}}),era:Ca({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:Ca({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:Ca({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:Ca({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:Ca({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"})};var Aa;const Da={code:"pt-BR",formatDistance:(e,t,n)=>{let r;const a=Sa[e];return r="string"==typeof a?a:1===t?a.one:a.other.replace("{{count}}",String(t)),n?.addSuffix?n.comparison&&n.comparison>0?"em "+r:"há "+r:r},formatLong:Ta,formatRelative:(e,t,n,r)=>{const a=Ia[e];return"function"==typeof a?a(t):a},localize:Pa,match:Ea,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ra({className:e,classNames:t,showOutsideDays:n=!0,...r}){return fe.jsx(j.DayPicker,{showOutsideDays:n,className:pe("p-3",e),locale:Da,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:pe(ge({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:pe(ge({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})=>fe.jsx(i.ChevronLeft,{className:"h-4 w-4"}),IconRight:({...e})=>fe.jsx(i.ChevronRight,{className:"h-4 w-4"})},...r})}Ra.displayName="Calendar";const Fa=X.Root,_a=X.CollapsibleTrigger,La=X.CollapsibleContent;const Ma={Root:function({children:e,className:t}){return fe.jsx("div",{className:pe("space-y-4",t),children:e})},Item:function({children:e,onClick:t,className:n}){return fe.jsx(ke,{className:pe("transition-colors",t&&"cursor-pointer hover:bg-muted/50",n),onClick:t,children:fe.jsx(Se,{className:"p-4",children:e})})},Field:function({label:e,value:t,className:n}){return fe.jsxs("div",{className:pe("flex justify-between items-center text-sm",n),children:[fe.jsxs("span",{className:"text-muted-foreground font-medium",children:[e,":"]}),fe.jsx("span",{className:"text-foreground",children:t})]})}};const Oa={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))]"},za={xs:"gap-1",sm:"gap-2",md:"gap-4",lg:"gap-6",xl:"gap-8"};function Ba({children:e,cols:t="auto-fit",gap:n="md",className:r}){return fe.jsx("div",{className:pe("grid",Oa[t],za[n],r),children:e})}const Ua=({className:e,...t})=>fe.jsx("nav",{role:"navigation","aria-label":"pagination",className:pe("mx-auto flex w-full justify-center",e),...t});Ua.displayName="Pagination";const $a=L.forwardRef(({className:e,...t},n)=>fe.jsx("ul",{ref:n,className:pe("flex flex-row items-center gap-1",e),...t}));$a.displayName="PaginationContent";const Va=L.forwardRef(({className:e,...t},n)=>fe.jsx("li",{ref:n,className:pe("",e),...t}));Va.displayName="PaginationItem";const qa=({className:e,isActive:t,size:n="icon",...r})=>fe.jsx("a",{"aria-current":t?"page":void 0,className:pe(ge({variant:t?"outline":"ghost",size:n}),e),...r});qa.displayName="PaginationLink";const Ha=({className:e,...t})=>fe.jsxs(qa,{"aria-label":"Go to previous page",size:"default",className:pe("gap-1 pl-2.5",e),...t,children:[fe.jsx(i.ChevronLeft,{className:"h-4 w-4"}),fe.jsx("span",{children:"Previous"})]});Ha.displayName="PaginationPrevious";const Wa=({className:e,...t})=>fe.jsxs(qa,{"aria-label":"Go to next page",size:"default",className:pe("gap-1 pr-2.5",e),...t,children:[fe.jsx("span",{children:"Next"}),fe.jsx(i.ChevronRight,{className:"h-4 w-4"})]});Wa.displayName="PaginationNext";const Qa=({className:e,...t})=>fe.jsxs("span",{"aria-hidden":!0,className:pe("flex h-9 w-9 items-center justify-center",e),...t,children:[fe.jsx(i.MoreHorizontal,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"More pages"})]});Qa.displayName="PaginationEllipsis";const Ka=L.forwardRef(({className:e,value:t,...n},r)=>fe.jsx(G.Root,{ref:r,className:pe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",e),...n,children:fe.jsx(G.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Ka.displayName=G.Root.displayName;const Xa=L.forwardRef(({className:e,...t},n)=>fe.jsx(Y.Root,{className:pe("grid gap-2",e),...t,ref:n}));Xa.displayName=Y.Root.displayName;const Ga=L.forwardRef(({className:e,...t},n)=>fe.jsx(Y.Item,{ref:n,className:pe("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:fe.jsx(Y.Indicator,{className:"flex items-center justify-center",children:fe.jsx(i.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ga.displayName=Y.Item.displayName;const Ya=L.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},a)=>fe.jsx(J.Root,{ref:a,decorative:n,orientation:t,className:pe("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Ya.displayName=J.Root.displayName;const Ja=O.Root,Za=O.Trigger,es=O.Close,ts=O.Portal,ns=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Overlay,{className:pe("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:n}));ns.displayName=O.Overlay.displayName;const rs=n.cva("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"}}),as=L.forwardRef(({side:e="right",className:t,children:n,...r},a)=>fe.jsxs(ts,{children:[fe.jsx(ns,{}),fe.jsxs(O.Content,{ref:a,className:pe(rs({side:e}),t),...r,children:[n,fe.jsxs(O.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:[fe.jsx(i.X,{className:"h-4 w-4"}),fe.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));as.displayName=O.Content.displayName;const ss=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col space-y-2 text-center sm:text-left",e),...t});ss.displayName="SheetHeader";const os=({className:e,...t})=>fe.jsx("div",{className:pe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});os.displayName="SheetFooter";const is=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Title,{ref:n,className:pe("text-lg font-semibold text-foreground",e),...t}));is.displayName=O.Title.displayName;const ls=L.forwardRef(({className:e,...t},n)=>fe.jsx(O.Description,{ref:n,className:pe("text-sm text-muted-foreground",e),...t}));ls.displayName=O.Description.displayName;const cs=Z.Provider,us=Z.Root,ds=Z.Trigger,fs=L.forwardRef(({className:e,sideOffset:t=4,...n},r)=>fe.jsx(Z.Content,{ref:r,sideOffset:t,className:pe("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),...n}));fs.displayName=Z.Content.displayName;const ms="sidebar:state",ps=L.createContext(null);function hs(){const e=L.useContext(ps);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const gs=L.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:a,children:s,...o},i)=>{const[l,c]=L.useState(!1);L.useEffect(()=>{const e=()=>c(window.innerWidth<768);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const[u,d]=L.useState(!1),[f,m]=L.useState(()=>{if("undefined"!=typeof window){const t=localStorage.getItem(ms);return null!==t?"true"===t:e}return e}),p=t??f,h=L.useCallback(e=>{const t="function"==typeof e?e(p):e;n?n(t):m(t),"undefined"!=typeof window&&localStorage.setItem(ms,String(t))},[n,p]),g=L.useCallback(()=>l?d(e=>!e):h(e=>!e),[l,h,d]);L.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 x=p?"expanded":"collapsed",b=L.useMemo(()=>({state:x,open:p,setOpen:h,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:g}),[x,p,h,l,u,d,g]);return fe.jsx(ps.Provider,{value:b,children:fe.jsx(cs,{delayDuration:0,children:fe.jsx("div",{className:pe("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar sidebar-container",r),style:{"--sidebar-width":"16rem","--sidebar-width-icon":"4.5rem",...a},ref:i,...o,children:s})})})});gs.displayName="SidebarProvider";const xs=L.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:a,...s},o)=>{const{isMobile:i,state:l,openMobile:c,setOpenMobile:u}=hs();return"none"===n?fe.jsx("div",{className:pe("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:o,...s,children:a}):i?fe.jsx(Ja,{open:c,onOpenChange:u,...s,children:fe.jsxs(as,{"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:[fe.jsx(is,{className:"sr-only",children:"Menu de Navegação"}),fe.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):fe.jsxs("div",{ref:o,className:"group peer hidden md:block text-sidebar-foreground","data-state":l,"data-collapsible":"collapsed"===l?n:"","data-variant":t,"data-side":e,children:[fe.jsx("div",{className:pe("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]")}),fe.jsx("div",{className:pe("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",r),...s,children:fe.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:a})})]})});xs.displayName="Sidebar";const bs=L.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:a}=hs();return fe.jsxs(xe,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:pe("h-7 w-7",e),onClick:e=>{t?.(e),a()},...n,children:[fe.jsx(i.PanelLeft,{}),fe.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});bs.displayName="SidebarTrigger";const ys=L.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=hs();return fe.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:pe("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})});ys.displayName="SidebarRail";const vs=L.forwardRef(({className:e,...t},n)=>fe.jsx("main",{ref:n,className:pe("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}));vs.displayName="SidebarInset";const ws=L.forwardRef(({className:e,...t},n)=>fe.jsx(ye,{ref:n,"data-sidebar":"input",className:pe("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));ws.displayName="SidebarInput";const ks=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"header",className:pe("flex flex-col gap-2 p-2",e),...t}));ks.displayName="SidebarHeader";const Ns=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"footer",className:pe("flex flex-col gap-2 p-2",e),...t}));Ns.displayName="SidebarFooter";const js=L.forwardRef(({className:e,...t},n)=>fe.jsx(Ya,{ref:n,"data-sidebar":"separator",className:pe("mx-2 w-auto bg-sidebar-border",e),...t}));js.displayName="SidebarSeparator";const Cs=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"content",className:pe("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));Cs.displayName="SidebarContent";const Ss=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"group",className:pe("relative flex w-full min-w-0 flex-col p-2",e),...t}));Ss.displayName="SidebarGroup";const Ts=L.forwardRef(({className:e,asChild:n=!1,...r},a)=>{const s=n?t.Slot:"div";return fe.jsx(s,{ref:a,"data-sidebar":"group-label",className:pe("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})});Ts.displayName="SidebarGroupLabel";const Is=L.forwardRef(({className:e,asChild:n=!1,...r},a)=>{const s=n?t.Slot:"button";return fe.jsx(s,{ref:a,"data-sidebar":"group-action",className:pe("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})});Is.displayName="SidebarGroupAction";const Ps=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"group-content",className:pe("w-full text-sm",e),...t}));Ps.displayName="SidebarGroupContent";const Es=L.forwardRef(({className:e,...t},n)=>fe.jsx("ul",{ref:n,"data-sidebar":"menu",className:pe("flex w-full min-w-0 flex-col gap-1",e),...t}));Es.displayName="SidebarMenu";const As=L.forwardRef(({className:e,...t},n)=>fe.jsx("li",{ref:n,"data-sidebar":"menu-item",className:pe("group/menu-item relative",e),...t}));As.displayName="SidebarMenuItem";const Ds=n.cva("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"}}),Rs=L.forwardRef(({asChild:e=!1,isActive:n=!1,variant:r="default",size:a="default",tooltip:s,className:o,...i},l)=>{const c=e?t.Slot:"button",{isMobile:u,state:d}=hs(),f=fe.jsx(c,{ref:l,"data-sidebar":"menu-button","data-size":a,"data-active":n,className:pe(Ds({variant:r,size:a}),o),...i});return s?("string"==typeof s&&(s={children:s}),fe.jsxs(us,{children:[fe.jsx(ds,{asChild:!0,children:f}),fe.jsx(fs,{side:"right",align:"center",hidden:"collapsed"!==d||u,...s})]})):f});Rs.displayName="SidebarMenuButton";const Fs=L.forwardRef(({className:e,asChild:n=!1,showOnHover:r=!1,...a},s)=>{const o=n?t.Slot:"button";return fe.jsx(o,{ref:s,"data-sidebar":"menu-action",className:pe("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),...a})});Fs.displayName="SidebarMenuAction";const _s=L.forwardRef(({className:e,...t},n)=>fe.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:pe("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}));_s.displayName="SidebarMenuBadge";const Ls=L.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const a=L.useMemo(()=>`${Math.floor(40*Math.random())+50}%`,[]);return fe.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:pe("rounded-md h-8 flex gap-2 px-2 items-center",e),...n,children:[t&&fe.jsx("div",{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),fe.jsx("div",{className:"h-4 flex-1 max-w-[--skeleton-width] skeleton-width","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":a}})]})});Ls.displayName="SidebarMenuSkeleton";const Ms=L.forwardRef(({className:e,...t},n)=>fe.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:pe("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}));Ms.displayName="SidebarMenuSub";const Os=L.forwardRef(({...e},t)=>fe.jsx("li",{ref:t,...e}));Os.displayName="SidebarMenuSubItem";const zs=L.forwardRef(({asChild:e=!1,size:n="md",isActive:r,className:a,...s},o)=>{const i=e?t.Slot:"a";return fe.jsx(i,{ref:o,"data-sidebar":"menu-sub-button","data-size":n,"data-active":r,className:pe("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"===n&&"text-xs","md"===n&&"text-sm","group-data-[collapsible=icon]:hidden",a),...s})});zs.displayName="SidebarMenuSubButton";const Bs=L.forwardRef(({className:e,...t},n)=>fe.jsxs(ee.Root,{ref:n,className:pe("relative flex w-full touch-none select-none items-center",e),...t,children:[fe.jsx(ee.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:fe.jsx(ee.Range,{className:"absolute h-full bg-primary"})}),fe.jsx(ee.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"})]}));Bs.displayName=ee.Root.displayName;function Us(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r.defaultPrevented)return t?.(r)}}function $s(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function Vs(...e){return L.useCallback(function(...e){return t=>{let n=!1;const r=e.map(e=>{const r=$s(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){const n=r[t];"function"==typeof n?n():$s(e[t],null)}}}}(...e),e)}function qs(...e){const t=e[0];if(1===e.length)return t;const n=()=>{const n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){const r=n.reduce((t,{useScope:n,scopeName:r})=>({...t,...n(e)[`__scope${r}`]}),{});return L.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var Hs=globalThis?.document?L.useLayoutEffect:()=>{},Ws=L[" useInsertionEffect ".trim().toString()]||Hs;function Qs({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[a,s,o]=function({defaultProp:e,onChange:t}){const[n,r]=L.useState(e),a=L.useRef(n),s=L.useRef(t);return Ws(()=>{s.current=t},[t]),L.useEffect(()=>{a.current!==n&&(s.current?.(n),a.current=n)},[n,a]),[n,r,s]}({defaultProp:t,onChange:n}),i=void 0!==e,l=i?e:a;{const t=L.useRef(void 0!==e);L.useEffect(()=>{const e=t.current;if(e!==i){}t.current=i},[i,r])}const c=L.useCallback(t=>{if(i){const n=function(e){return"function"==typeof e}(t)?t(e):t;n!==e&&o.current?.(n)}else s(t)},[i,e,s,o]);return[l,c]}var Ks=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{const r=t.createSlot(`Primitive.${n}`),a=L.forwardRef((e,t)=>{const{asChild:a,...s}=e,o=a?r:n;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),fe.jsx(o,{...s,ref:t})});return a.displayName=`Primitive.${n}`,{...e,[n]:a}},{}),Xs="Switch",[Gs]=function(e,t=[]){let n=[];const r=()=>{const t=n.map(e=>L.createContext(e));return function(n){const r=n?.[e]||t;return L.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){const a=L.createContext(r),s=n.length;n=[...n,r];const o=t=>{const{scope:n,children:r,...o}=t,i=n?.[e]?.[s]||a,l=L.useMemo(()=>o,Object.values(o));return fe.jsx(i.Provider,{value:l,children:r})};return o.displayName=t+"Provider",[o,function(n,o){const i=o?.[e]?.[s]||a,l=L.useContext(i);if(l)return l;if(void 0!==r)return r;throw new Error(`\`${n}\` must be used within \`${t}\``)}]},qs(r,...t)]}(Xs),[Ys,Js]=Gs(Xs),Zs=L.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:s,required:o,disabled:i,value:l="on",onCheckedChange:c,form:u,...d}=e,[f,m]=L.useState(null),p=Vs(t,e=>m(e)),h=L.useRef(!1),g=!f||(u||!!f.closest("form")),[x,b]=Qs({prop:a,defaultProp:s??!1,onChange:c,caller:Xs});return fe.jsxs(Ys,{scope:n,checked:x,disabled:i,children:[fe.jsx(Ks.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":ro(x),"data-disabled":i?"":void 0,disabled:i,value:l,...d,ref:p,onClick:Us(e.onClick,e=>{b(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&fe.jsx(no,{control:f,bubbles:!h.current,name:r,value:l,checked:x,required:o,disabled:i,form:u,style:{transform:"translateX(-100%)"}})]})});Zs.displayName=Xs;var eo="SwitchThumb",to=L.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=Js(eo,n);return fe.jsx(Ks.span,{"data-state":ro(a.checked),"data-disabled":a.disabled?"":void 0,...r,ref:t})});to.displayName=eo;var no=L.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...a},s)=>{const o=L.useRef(null),i=Vs(o,s),l=function(e){const t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}(n),c=function(e){const[t,n]=L.useState(void 0);return Hs(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(t=>{if(!Array.isArray(t))return;if(!t.length)return;const r=t[0];let a,s;if("borderBoxSize"in r){const e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;a=t.inlineSize,s=t.blockSize}else a=e.offsetWidth,s=e.offsetHeight;n({width:a,height:s})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(t);return L.useEffect(()=>{const e=o.current;if(!e)return;const t=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(t,"checked").set;if(l!==n&&a){const t=new Event("click",{bubbles:r});a.call(e,n),e.dispatchEvent(t)}},[l,n,r]),fe.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ro(e){return e?"checked":"unchecked"}no.displayName="SwitchBubbleInput";var ao=Zs,so=to;const oo=L.forwardRef(({className:e,...t},n)=>fe.jsx(ao,{className:pe("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:n,children:fe.jsx(so,{className:pe("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")})}));oo.displayName=ao.displayName;const io=te.Root,lo=L.forwardRef(({className:e,...t},n)=>fe.jsx(te.List,{ref:n,className:pe("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));lo.displayName=te.List.displayName;const co=L.forwardRef(({className:e,...t},n)=>fe.jsx(te.Trigger,{ref:n,className:pe("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}));co.displayName=te.Trigger.displayName;const uo=L.forwardRef(({className:e,...t},n)=>fe.jsx(te.Content,{ref:n,className:pe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));uo.displayName=te.Content.displayName;const fo=n.cva("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"}}),mo=L.forwardRef(({className:e,variant:t,size:n,...r},a)=>fe.jsx(ne.Root,{ref:a,className:pe(fo({variant:t,size:n,className:e})),...r}));mo.displayName=ne.Root.displayName;const po=L.createContext({size:"default",variant:"default"}),ho=L.forwardRef(({className:e,variant:t,size:n,children:r,...a},s)=>fe.jsx(re.Root,{ref:s,className:pe("flex items-center justify-center gap-1",e),...a,children:fe.jsx(po.Provider,{value:{variant:t,size:n},children:r})}));ho.displayName=re.Root.displayName;const go=L.forwardRef(({className:e,children:t,variant:n,size:r,...a},s)=>{const o=L.useContext(po);return fe.jsx(re.Item,{ref:s,className:pe(fo({variant:o.variant||n,size:o.size||r}),e),...a,children:t})});function xo({onEdit:e,onDelete:t,onToggleStatus:n,isActive:r=!0,canEdit:a=!0,canDelete:s=!0,customActions:o=[],renderAs:l="dropdown",variant:c="default"}){const u=[];return e&&a&&u.push({icon:i.Edit,label:"Editar",onClick:e,variant:"default"}),n&&u.push({icon:r?i.PowerOff:i.Power,label:r?"Inativar":"Ativar",onClick:n,variant:"default"}),o.forEach(e=>{!1!==e.show&&u.push({icon:e.icon,label:e.label,onClick:e.onClick,variant:e.variant||"default"})}),t&&s&&u.push({icon:i.Trash2,label:"Remover",onClick:t,variant:"destructive"}),0===u.length?null:"dropdown"===l?fe.jsxs(dr,{children:[fe.jsx(fr,{asChild:!0,children:fe.jsx(xe,{variant:"ghost",size:"compact"===c?"sm":"default",className:"compact"===c?"h-7 px-2":"",children:fe.jsx(i.EllipsisVertical,{size:"compact"===c?14:16})})}),fe.jsx(yr,{align:"end",className:"bg-background border border-border shadow-lg min-w-[120px]",children:u.map((e,t)=>fe.jsxs(vr,{onClick:e.onClick,className:"destructive"===e.variant?"text-destructive":"",children:[e.icon&&fe.jsx(e.icon,{className:"mr-2 h-4 w-4"}),e.label]},t))})]}):fe.jsx("div",{className:"flex items-center gap-1",children:u.map((e,t)=>fe.jsxs(xe,{variant:"destructive"===e.variant?"destructive":"ghost",size:"compact"===c?"sm":"default",onClick:e.onClick,className:"compact"===c?"h-7 px-2":"",children:[e.icon&&fe.jsx(e.icon,{size:"compact"===c?14:16}),"compact"!==c&&fe.jsx("span",{className:"ml-1",children:e.label})]},t))})}function bo(e){const t=x.useNavigate();return{onNew:()=>{const n=e.newPath||`${e.basePath}/new`;t(n)},onEdit:n=>{const r=e.editPath?e.editPath.replace(":id",n.id):`${e.basePath}/${n.id}/edit`;t(r)}}}go.displayName=re.Item.displayName;const yo=e.memo(({variant:t="card",className:n="",selectedUnit:r,onUnitChange:a})=>{const{user:s,companies:o,alias:l,isAuthenticated:c,logout:u,switchUnit:d}=zn(),f=o?.[0]||null,m=l?o?.find(e=>e.alias===l):f,p=o||[],h=r||m||f||f,g=e.useCallback(e=>{a?a(e):d(e)},[a,d]),x=e.useMemo(()=>{if(!p?.length)return[];const e=new Map;p.forEach(t=>{e.set(t.alias,t)});const t=Array.from(e.values()),n=t.find(e=>e.alias===h?.alias),r=t.filter(e=>e.alias!==h?.alias);return r.sort((e,t)=>(e.name||"").localeCompare(t.name||"","pt-BR",{sensitivity:"base"})),n?[n,...r]:r},[p,h?.alias]);if(!c||!s)return null;const b=()=>fe.jsxs(fe.Fragment,{children:[fe.jsxs("div",{className:"flex items-center space-x-3",children:[fe.jsx("div",{className:"flex-shrink-0",children:fe.jsx("div",{className:"w-10 h-10 bg-primary rounded-full flex items-center justify-center",children:fe.jsx(i.User,{className:"h-5 w-5 text-primary-foreground"})})}),fe.jsxs("div",{className:"flex-1 min-w-0",children:[fe.jsx("p",{className:"text-sm font-medium truncate",children:s.name}),fe.jsxs("p",{className:"text-xs text-muted-foreground",children:["Unidade: ",h?.name||"N/A"]})]})]}),h&&fe.jsx("div",{className:"mt-3",children:fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsx(i.Building2,{className:"h-4 w-4 text-muted-foreground"}),fe.jsx("span",{className:"text-sm font-medium",children:h.name})]})}),x.length>1&&fe.jsxs("div",{className:"mt-2",children:[fe.jsxs("p",{className:"text-xs text-muted-foreground mb-1",children:["Unidades disponíveis: ",x.length]}),fe.jsxs("div",{className:"flex flex-wrap gap-1",children:[x.slice(0,3).map(e=>fe.jsx(ot,{variant:e.alias===h?.alias?"default":"secondary",className:"text-xs cursor-pointer",onClick:()=>g(e),children:e.name},e.alias)),x.length>3&&fe.jsxs(ot,{variant:"outline",className:"text-xs",children:["+",x.length-3]})]})]})]});return"dropdown"===t?fe.jsxs(dr,{children:[fe.jsx(fr,{asChild:!0,children:fe.jsx(xe,{variant:"ghost",className:`h-auto p-2 ${n}`,children:fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsxs("div",{className:"hidden md:block text-left",children:[fe.jsx("p",{className:"text-sm font-medium",children:s.name}),fe.jsx("p",{className:"text-xs text-muted-foreground",children:h?.name||"N/A"})]}),fe.jsx("div",{className:"w-8 h-8 bg-primary rounded-full flex items-center justify-center",children:fe.jsx(i.User,{className:"h-4 w-4 text-primary-foreground"})}),fe.jsx(i.ChevronDown,{className:"h-4 w-4"})]})})}),fe.jsxs(yr,{className:"w-56 bg-background border border-border shadow-lg z-50",align:"end",children:[fe.jsxs(hr,{children:[fe.jsxs(xr,{children:[fe.jsx(i.RefreshCw,{className:"mr-2 h-4 w-4"}),"Alterar Unidade"]}),fe.jsx(br,{children:x.map(e=>fe.jsxs(vr,{onClick:()=>g(e),className:e.alias===h?.alias?"bg-muted":"",children:[fe.jsx(i.Building2,{className:"mr-2 h-4 w-4"}),e.name,e.alias===h?.alias&&fe.jsx(ot,{variant:"outline",className:"ml-2 text-xs",children:"Atual"})]},e.alias))})]}),fe.jsx(jr,{}),fe.jsxs(vr,{onClick:u,children:[fe.jsx(i.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]}):fe.jsxs(ke,{className:n,children:[fe.jsx(Ne,{children:fe.jsx(je,{className:"text-lg",children:"Informações do Usuário"})}),fe.jsxs(Se,{className:"space-y-4",children:[fe.jsx(b,{}),fe.jsx(Ya,{}),fe.jsxs(xe,{variant:"outline",onClick:u,size:"sm",className:"w-full",children:[fe.jsx(i.LogOut,{className:"mr-2 h-4 w-4"}),"Sair"]})]})]})}),vo=e.createContext({});function wo({children:t,config:n}){const r=e.useMemo(()=>({navigation:n?.navigation,appName:n?.appName}),[n?.navigation,n?.appName]);return fe.jsx(vo.Provider,{value:r,children:t})}function ko(){return e.useContext(vo)}function No(){const e=x.useLocation(),{navigation:t}=ko();if(!t)return"Página";const n=t.find(t=>t.path===e.pathname);if(n)return n.label;const r=t.find(t=>e.pathname.startsWith(t.path+"/"));return r?.label||"Página"}function jo(t,n){const[r,a]=e.useState(t),s=e.useRef(),o=e.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=void 0)},[]);return e.useEffect(()=>(o(),s.current=setTimeout(()=>{a(t)},n),o),[t,n,o]),[r,o]}const Co=e.memo(function({actions:t}){const n=x.useLocation(),r=No(),{navigation:a,appName:s}=ko(),{metadata:o}=ia(),{companies:l,alias:c,isSearchVisible:u,clearSearch:d,refreshData:f,switchUnit:m}=zn(),p=c?l?.find(e=>e.alias===c)||l?.[0]||null:l?.[0]||null,[h,g]=x.useSearchParams(),[b,y]=e.useState(()=>h.get("search")||""),[v,w]=jo(b,bn.debounceDelay);e.useEffect(()=>{if(!u)return;const e=new URLSearchParams(h);v?(e.set("search",v),e.set("page","1")):e.delete("search"),g(e)},[v,g,u]);const k=a?.find(e=>e.path===n.pathname)||a?.find(e=>n.pathname.startsWith(e.path+"/")),N=o.title||r,j=o.subtitle||k?.complementaryText||"Detalhes do item";return fe.jsx("header",{className:"bg-white border-b border-gray-200 px-2 md:px-4 py-2",children:fe.jsxs("div",{className:"flex items-center gap-4",children:[fe.jsxs("div",{className:"flex-shrink-0",children:[fe.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[fe.jsx("h1",{className:"text-lg font-semibold text-foreground truncate",children:N}),fe.jsx(ot,{variant:"default",className:"bg-primary hover:bg-primary/90 text-primary-foreground text-xs px-2 py-1",children:s||"Módulo"})]}),fe.jsx("p",{className:"text-sm text-muted-foreground truncate",children:j})]}),u&&fe.jsxs("div",{className:"flex items-center gap-2 flex-1 max-w-2xl",children:[fe.jsxs("div",{className:"relative flex-1",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),fe.jsx(ye,{placeholder:"/wiki"===n.pathname?"Buscar artigos...":"Buscar...",value:b,onChange:e=>(e=>{y(e)})(e.target.value),className:"w-full pl-10 pr-8"}),b&&fe.jsx(xe,{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:()=>{w(),y("");const e=new URLSearchParams(h);e.delete("search"),e.delete("page"),g(e)},title:"Limpar busca",children:fe.jsx(i.X,{size:14})})]}),fe.jsx(xe,{variant:"outline",size:"sm",onClick:f,className:"flex-shrink-0 h-10 w-10 p-0",title:"Atualizar dados",children:fe.jsx(i.RefreshCw,{size:14})})]}),fe.jsxs("div",{className:"flex-shrink-0 ml-auto flex items-center gap-3",children:[t&&fe.jsx("div",{className:"flex items-center gap-2",children:t}),(void 0).VITE_WIKI_URL&&fe.jsx(xe,{variant:"secondary",size:"sm",className:"h-8 px-3",onClick:e=>me((void 0).VITE_WIKI_URL,e),title:"Abrir Wiki",children:"Wiki"}),fe.jsx("div",{className:"text-sm",children:fe.jsx(yo,{variant:"dropdown",selectedUnit:p,onUnitChange:m})})]})]})})}),So=({key:e,enabled:t,checkFn:n,staleTime:r=3e5,gcTime:a=6e5})=>g.useQuery({queryKey:["permission",e],queryFn:n,enabled:t,staleTime:r,gcTime:a,retry:0,refetchOnWindowFocus:!1}),To=(e={})=>{const{enabled:t=!0}=e,{alias:n}=zn();return g.useQuery({queryKey:["active-modules",n],queryFn:async()=>{if(!n)return[];const e=an(),{data:t,error:r}=await e.schema("central").from("modules").select("\n id, name, url,\n modules_alias!inner(alias)\n ").eq("modules_alias.alias",n).eq("status","active").order("name");if(r){if(!un.handleError(r))throw r;return[]}return t||[]},enabled:t&&!!n})},Io="forlogic-sidebar-pinned",Po=()=>{try{const e=localStorage.getItem(Io);return!!e&&JSON.parse(e)}catch{return!1}},Eo=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]},Ao=(void 0).VITE_SUPABASE_PROJECT_ID,Do={logo:`https://${Ao}.supabase.co/storage/v1/object/public/library-assets/logo.svg`,smallLogo:`https://${Ao}.supabase.co/storage/v1/object/public/library-assets/small.svg`},Ro=Do.logo,Fo=Do.smallLogo;function _o({appName:e,isPinned:t,onPinToggle:n,open:r,dropdownOpen:a,onDropdownChange:s}){const{data:o,isLoading:l,error:c}=To({enabled:a}),u=e=>{((e,t)=>{const n=e?.find(e=>e.url===t);n?.url&&window.open(n.url,"_blank")})(o,e)};return fe.jsxs(ks,{className:"p-0 gap-0",children:[fe.jsx("div",{className:"flex items-center justify-between h-[34px]",children:r?fe.jsxs(fe.Fragment,{children:[fe.jsx("div",{className:"flex items-center pl-[12px]",children:fe.jsx("img",{src:Do.logo,alt:"Logo",className:"h-6 max-w-full object-contain"})}),fe.jsx("button",{onClick:n,className:"h-8 w-8 flex items-center justify-center rounded-md transition-colors duration-200 "+(t?"bg-primary text-primary-foreground":"hover:bg-muted text-muted-foreground"),children:fe.jsx(i.PanelLeft,{className:"h-4 w-4"})})]}):fe.jsx("div",{className:"flex items-center justify-center w-full h-[34px]",children:fe.jsx("img",{src:Do.smallLogo,alt:"Logo",className:"h-[34px] w-[34px] object-contain"})})}),fe.jsx("div",{className:"mt-2 pt-0",children:fe.jsxs(dr,{onOpenChange:s,children:[fe.jsx(fr,{asChild:!0,children:r?fe.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:[fe.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[fe.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"}),fe.jsx("span",{className:"truncate group-data-[collapsible=icon]:hidden",children:e})]}),fe.jsx(i.ChevronDown,{className:"h-6 w-6 flex-shrink-0 text-muted-foreground"})]}):fe.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:fe.jsx(i.ChevronDown,{className:"h-6 w-6 text-muted-foreground"})})}),fe.jsx(yr,{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:l?fe.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-muted-foreground",children:[fe.jsx(i.Loader2,{className:"h-4 w-4 animate-spin"}),fe.jsx("span",{className:"text-sm",children:"Carregando módulos..."})]}):c?fe.jsxs("div",{className:"flex items-center space-x-2 py-3 px-3 text-destructive",children:[fe.jsx(i.AlertCircle,{className:"h-4 w-4"}),fe.jsx("span",{className:"text-sm",children:"Erro ao carregar módulos"})]}):o&&0!==o.length?fe.jsx("div",{className:"space-y-2",children:o.map((e,t)=>fe.jsx("div",{onClick:()=>u(e.url||""),className:`\n bg-muted/50 hover:bg-muted rounded-md p-3 cursor-pointer \n border-l-4 ${Eo(t)} transition-colors duration-200\n `,children:fe.jsxs("div",{className:"flex items-center justify-between",children:[fe.jsx("span",{className:"font-medium text-foreground text-sm",children:e.name}),e.url&&fe.jsx(i.ExternalLink,{className:"h-4 w-4 text-muted-foreground"})]})},e.id))}):fe.jsx("div",{className:"py-3 px-3 text-muted-foreground text-sm",children:"Nenhum módulo disponível"})})]})})]})}function Lo({config:t,customContent:n}={}){const{open:r,setOpen:a}=hs(),s=x.useLocation(),{alias:o,user:l}=zn(),[c,u]=e.useState(!1),[d,f]=e.useState(Po),[m,p]=e.useState(!1);e.useEffect(()=>{a(!!d||!(!m&&!c))},[d,m,c,a]);const h=e=>s.pathname===e||s.pathname.startsWith(e+"/");return fe.jsxs(xs,{collapsible:"icon",onMouseEnter:()=>{d||p(!0)},onMouseLeave:()=>{d||p(!1)},className:"app-sidebar transition-all duration-300 ease-in-out bg-white border-r border-gray-200 py-6 px-3",children:[fe.jsx(_o,{appName:t?.appName||"Título do módulo",isPinned:d,onPinToggle:()=>{const e=!d;f(e),(e=>{try{localStorage.setItem(Io,JSON.stringify(e))}catch{}})(e)},open:r,dropdownOpen:c,onDropdownChange:u}),fe.jsx(Cs,{children:n||fe.jsx(Ss,{className:"p-0 mt-6",children:fe.jsx(Ps,{children:fe.jsx(Es,{className:"space-y-2",children:fe.jsx(cs,{children:t?.navigation?.map((e,t)=>{const n=({item:e,index:t})=>{const r=`${e.path}-${t}-${o??"noalias"}-${l?.id??"nouser"}`,{data:a=!0,isLoading:s}=So({key:r,enabled:Boolean(e.permissionCheck&&o&&l?.id),checkFn:e.permissionCheck||(()=>Promise.resolve(!0))}),c=e.permissionCheck&&!a,u=s?i.Loader2:c?i.Lock:e.icon;c||e.complementaryText;return e.children&&e.children.length>0?fe.jsx(Fa,{defaultOpen:!0,className:"group/collapsible",children:fe.jsxs(As,{children:[fe.jsx(_a,{asChild:!0,children:fe.jsx(Rs,{size:"lg",className:"h-10",children:fe.jsxs("div",{className:"flex w-full items-center gap-3",children:[fe.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:fe.jsx(u,{className:"h-5 w-4"})}),fe.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label}),fe.jsx(i.ChevronRight,{className:"ml-auto h-4 w-4 transition-transform group-data-[state=open]/collapsible:rotate-90 group-data-[collapsible=icon]:hidden"})]})})}),fe.jsx(La,{children:fe.jsx(Ms,{children:e.children.map((e,t)=>fe.jsx(n,{item:e,index:t},e.path))})})]})},e.path):fe.jsx(As,{children:c||s?fe.jsxs(us,{children:[fe.jsx(ds,{asChild:!0,children:fe.jsx(Rs,{size:"lg",className:"h-10 opacity-50 cursor-not-allowed",onClick:e=>e.preventDefault(),children:fe.jsxs("div",{className:"flex w-full items-center gap-3",children:[fe.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:fe.jsx(u,{className:"h-4 w-4 "+(s?"animate-spin":"")})}),fe.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label})]})})}),fe.jsx(fs,{children:fe.jsx("p",{children:s?"Verificando acesso...":"Acesso restrito"})})]}):fe.jsx(Rs,{asChild:!0,isActive:h(e.path),size:"lg",className:"h-10",children:fe.jsxs(x.Link,{to:e.path,className:"flex w-full items-center gap-3",children:[fe.jsx("span",{className:"grid place-items-center h-[34px] w-[34px] p-[5px]",children:fe.jsx(u,{className:"h-5 w-4"})}),fe.jsx("span",{className:"font-medium sidebar-text group-data-[collapsible=icon]:hidden",children:e.label})]})})},e.path)};return fe.jsx(n,{item:e,index:t},e.path)})})})})})})]})}const Mo=e.memo(function({children:t,sidebar:n,sidebarConfig:r,showHeader:a=!0}){const s=e.useMemo(()=>n||fe.jsx(Lo,{config:r}),[n,r]),o=e.useMemo(()=>({"--sidebar-width":"240px","--sidebar-width-icon":"58px"}),[]);return fe.jsx(wo,{config:r,children:fe.jsx(oa,{children:fe.jsx(gs,{defaultOpen:!1,style:o,children:fe.jsxs("div",{className:"min-h-screen flex w-full",children:[s,fe.jsxs("main",{className:"flex-1 flex flex-col h-screen overflow-hidden",children:[a&&fe.jsx("div",{className:"flex-shrink-0 sticky top-0 z-10 bg-background",children:fe.jsx(Co,{})}),fe.jsx("div",{className:"flex-1 overflow-y-auto bg-gray-50",children:t})]})]})})})})});var Oo=Object.defineProperty,zo=(e,t,n)=>((e,t,n)=>t in e?Oo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n);class Bo extends e.Component{constructor(e){super(e),zo(this,"copyErrorDetails",()=>{const e=Yt.getErrors().slice(0,2),t=`\n=== ERRO ATUAL ===\n${this.state.error?.message||"Erro desconhecido"}\n\nStack Trace:\n${this.state.error?.stack||"Não disponível"}\n\n=== ÚLTIMOS ERROS ===\n${e.map((e,t)=>`${t+1}. [${new Date(e.timestamp).toLocaleTimeString()}] ${e.message}`).join("\n")||"Nenhum erro registrado"}\n `.trim();navigator.clipboard.writeText(t),gt({title:"Detalhes copiados!",description:"Os detalhes do erro foram copiados para a área de transferência."})}),this.state={hasError:!1,showDetails:!1}}static getDerivedStateFromError(e){if((void 0).DEV)throw e;return{hasError:!0,error:e}}componentDidCatch(e,t){if((void 0).DEV)throw e;Yt.handleError(e,!1),this.setState({errorInfo:t})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const e=Yt.getErrors().slice(0,2);return fe.jsx("div",{className:"flex items-center justify-center min-h-screen p-4",children:fe.jsxs(ke,{className:"w-full max-w-2xl",children:[fe.jsxs(Ne,{className:"text-center",children:[fe.jsx("div",{className:"flex justify-center mb-4",children:fe.jsx(i.AlertTriangle,{className:"h-12 w-12 text-destructive"})}),fe.jsx(je,{children:"Algo deu errado"})]}),fe.jsxs(Se,{className:"space-y-4",children:[fe.jsx("p",{className:"text-center text-muted-foreground",children:"Ocorreu um erro inesperado. Tente recarregar a página."}),fe.jsxs(Fa,{open:this.state.showDetails,onOpenChange:e=>this.setState({showDetails:e}),children:[fe.jsx(_a,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",className:"w-full flex items-center justify-center gap-2",children:[fe.jsx(i.ChevronDown,{className:"h-4 w-4 transition-transform "+(this.state.showDetails?"rotate-180":"")}),"Ver Detalhes Técnicos"]})}),fe.jsxs(La,{className:"mt-4 space-y-4",children:[fe.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[fe.jsxs("div",{children:[fe.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📋 Erro Atual"}),fe.jsxs("div",{className:"text-sm space-y-2",children:[fe.jsx("p",{className:"font-medium text-destructive",children:this.state.error?.message||"Erro desconhecido"}),this.state.error?.stack&&fe.jsx(Rr,{className:"h-32 w-full rounded border bg-muted p-2",children:fe.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:this.state.error.stack})})]})]}),e.length>0&&fe.jsxs("div",{className:"pt-3 border-t",children:[fe.jsx("h4",{className:"font-semibold text-sm mb-2 flex items-center gap-2",children:"📜 Últimos Erros"}),fe.jsx("div",{className:"space-y-2",children:e.map((e,t)=>fe.jsx("div",{className:"text-sm p-2 rounded bg-muted/50",children:fe.jsxs("div",{className:"flex items-start gap-2",children:[fe.jsxs("span",{className:"font-medium text-muted-foreground shrink-0",children:[t+1,"."]}),fe.jsxs("div",{className:"flex-1 min-w-0",children:[fe.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:fe.jsxs("span",{className:"text-xs text-muted-foreground",children:["[",new Date(e.timestamp).toLocaleTimeString(),"]"]})}),fe.jsx("p",{className:"text-sm break-words",children:e.message})]})]})},e.id))})]})]}),fe.jsxs(xe,{variant:"outline",onClick:this.copyErrorDetails,className:"w-full flex items-center justify-center gap-2",children:[fe.jsx(i.Copy,{className:"h-4 w-4"}),"Copiar Detalhes"]})]})]}),fe.jsx(xe,{onClick:()=>window.location.reload(),className:"w-full",children:"Recarregar Página"})]})]})})}return this.props.children}}class Uo{static async sendEmail(e){const t=an(),{data:n,error:r}=await t.functions.invoke("send-email",{body:{template_code:e.templateCode,to:e.to,variables:e.variables,cc:e.cc,bcc:e.bcc,replyTo:e.replyTo}});if(r)throw r;return n}}const $o=Uo;function Vo(){const[t,n]=e.useState([]),[r,a]=e.useState(!1),[s,i]=e.useState(null),[l,c]=e.useState(null);e.useEffect(()=>{u()},[]);const u=async()=>{try{const e=an(),{data:t,error:r}=await e.functions.invoke("openai-chat",{body:{action:"createThread"}});if(r)throw r;i(t.threadId),n([{id:"initial",role:"assistant",content:"Olá! Como posso ajudá-lo hoje?",timestamp:new Date}])}catch(e){c("Erro ao inicializar conversa"),o.toast.error("Erro ao inicializar conversa")}},d=e.useCallback(async e=>{if(!s||!e.trim())return;const t={id:`user-${Date.now()}`,role:"user",content:e,timestamp:new Date};n(e=>[...e,t]),a(!0),c(null);try{const t=an(),{data:r,error:a}=await t.functions.invoke("openai-chat",{body:{action:"sendMessage",threadId:s,message:e}});if(a)throw a;const{runId:o}=r,i=await(async e=>{if(!s)return!1;for(let n=0;n<60;n++)try{const t=an(),{data:n,error:r}=await t.functions.invoke("openai-chat",{body:{action:"checkRunStatus",threadId:s,runId:e}});if(r)throw r;const{status:a}=n;if("completed"===a)return!0;if("failed"===a||"cancelled"===a)throw new Error("O assistente encontrou um erro");await new Promise(e=>setTimeout(e,1e3))}catch(t){throw t}throw new Error("Tempo limite excedido")})(o);i&&await(async()=>{if(s)try{const e=an(),{data:t,error:r}=await e.functions.invoke("openai-chat",{body:{action:"getMessages",threadId:s}});if(r)throw r;const a=t.messages.map(e=>({id:e.id,role:e.role,content:e.content,timestamp:new Date(1e3*e.created_at)}));n(a)}catch(e){throw e}})()}catch(r){const e=r instanceof Error?r.message:"Erro ao enviar mensagem";c(e),o.toast.error(e),n(e=>e.filter(e=>e.id!==t.id))}finally{a(!1)}},[s]);return{messages:t,isLoading:r,error:l,sendMessage:d,threadId:s}}function qo(){}function Ho(){}const Wo=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qo=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Ko={};function Xo(e,t){return(Ko.jsx?Qo:Wo).test(e)}const Go=/[ \t\n\f\r]/g;function Yo(e){return""===e.replace(Go,"")}class Jo{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Zo(e,t){const n={},r={};for(const a of e)Object.assign(n,a.property),Object.assign(r,a.normal);return new Jo(n,r,t)}function ei(e){return e.toLowerCase()}Jo.prototype.normal={},Jo.prototype.property={},Jo.prototype.space=void 0;class ti{constructor(e,t){this.attribute=t,this.property=e}}ti.prototype.attribute="",ti.prototype.booleanish=!1,ti.prototype.boolean=!1,ti.prototype.commaOrSpaceSeparated=!1,ti.prototype.commaSeparated=!1,ti.prototype.defined=!1,ti.prototype.mustUseProperty=!1,ti.prototype.number=!1,ti.prototype.overloadedBoolean=!1,ti.prototype.property="",ti.prototype.spaceSeparated=!1,ti.prototype.space=void 0;let ni=0;const ri=ui(),ai=ui(),si=ui(),oi=ui(),ii=ui(),li=ui(),ci=ui();function ui(){return 2**++ni}var di=Object.freeze({__proto__:null,boolean:ri,booleanish:ai,commaOrSpaceSeparated:ci,commaSeparated:li,number:oi,overloadedBoolean:si,spaceSeparated:ii});const fi=Object.keys(di);class mi extends ti{constructor(e,t,n,r){let a=-1;if(super(e,t),pi(this,"space",r),"number"==typeof n)for(;++a<fi.length;){const e=fi[a];pi(this,fi[a],(n&di[e])===di[e])}}}function pi(e,t,n){n&&(e[t]=n)}function hi(e){const t={},n={};for(const[r,a]of Object.entries(e.properties)){const s=new mi(r,e.transform(e.attributes||{},r),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[ei(r)]=r,n[ei(s.attribute)]=r}return new Jo(t,n,e.space)}mi.prototype.defined=!0;const gi=hi({properties:{ariaActiveDescendant:null,ariaAtomic:ai,ariaAutoComplete:null,ariaBusy:ai,ariaChecked:ai,ariaColCount:oi,ariaColIndex:oi,ariaColSpan:oi,ariaControls:ii,ariaCurrent:null,ariaDescribedBy:ii,ariaDetails:null,ariaDisabled:ai,ariaDropEffect:ii,ariaErrorMessage:null,ariaExpanded:ai,ariaFlowTo:ii,ariaGrabbed:ai,ariaHasPopup:null,ariaHidden:ai,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ii,ariaLevel:oi,ariaLive:null,ariaModal:ai,ariaMultiLine:ai,ariaMultiSelectable:ai,ariaOrientation:null,ariaOwns:ii,ariaPlaceholder:null,ariaPosInSet:oi,ariaPressed:ai,ariaReadOnly:ai,ariaRelevant:null,ariaRequired:ai,ariaRoleDescription:ii,ariaRowCount:oi,ariaRowIndex:oi,ariaRowSpan:oi,ariaSelected:ai,ariaSetSize:oi,ariaSort:null,ariaValueMax:oi,ariaValueMin:oi,ariaValueNow:oi,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function xi(e,t){return t in e?e[t]:t}function bi(e,t){return xi(e,t.toLowerCase())}const yi=hi({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:li,acceptCharset:ii,accessKey:ii,action:null,allow:null,allowFullScreen:ri,allowPaymentRequest:ri,allowUserMedia:ri,alt:null,as:null,async:ri,autoCapitalize:null,autoComplete:ii,autoFocus:ri,autoPlay:ri,blocking:ii,capture:null,charSet:null,checked:ri,cite:null,className:ii,cols:oi,colSpan:null,content:null,contentEditable:ai,controls:ri,controlsList:ii,coords:oi|li,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ri,defer:ri,dir:null,dirName:null,disabled:ri,download:si,draggable:ai,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ri,formTarget:null,headers:ii,height:oi,hidden:si,high:oi,href:null,hrefLang:null,htmlFor:ii,httpEquiv:ii,id:null,imageSizes:null,imageSrcSet:null,inert:ri,inputMode:null,integrity:null,is:null,isMap:ri,itemId:null,itemProp:ii,itemRef:ii,itemScope:ri,itemType:ii,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ri,low:oi,manifest:null,max:null,maxLength:oi,media:null,method:null,min:null,minLength:oi,multiple:ri,muted:ri,name:null,nonce:null,noModule:ri,noValidate:ri,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ri,optimum:oi,pattern:null,ping:ii,placeholder:null,playsInline:ri,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ri,referrerPolicy:null,rel:ii,required:ri,reversed:ri,rows:oi,rowSpan:oi,sandbox:ii,scope:null,scoped:ri,seamless:ri,selected:ri,shadowRootClonable:ri,shadowRootDelegatesFocus:ri,shadowRootMode:null,shape:null,size:oi,sizes:null,slot:null,span:oi,spellCheck:ai,src:null,srcDoc:null,srcLang:null,srcSet:null,start:oi,step:null,style:null,tabIndex:oi,target:null,title:null,translate:null,type:null,typeMustMatch:ri,useMap:null,value:ai,width:oi,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ii,axis:null,background:null,bgColor:null,border:oi,borderColor:null,bottomMargin:oi,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ri,declare:ri,event:null,face:null,frame:null,frameBorder:null,hSpace:oi,leftMargin:oi,link:null,longDesc:null,lowSrc:null,marginHeight:oi,marginWidth:oi,noResize:ri,noHref:ri,noShade:ri,noWrap:ri,object:null,profile:null,prompt:null,rev:null,rightMargin:oi,rules:null,scheme:null,scrolling:ai,standby:null,summary:null,text:null,topMargin:oi,valueType:null,version:null,vAlign:null,vLink:null,vSpace:oi,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ri,disableRemotePlayback:ri,prefix:null,property:null,results:oi,security:null,unselectable:null},space:"html",transform:bi}),vi=hi({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:ci,accentHeight:oi,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:oi,amplitude:oi,arabicForm:null,ascent:oi,attributeName:null,attributeType:null,azimuth:oi,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:oi,by:null,calcMode:null,capHeight:oi,className:ii,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:oi,diffuseConstant:oi,direction:null,display:null,dur:null,divisor:oi,dominantBaseline:null,download:ri,dx:null,dy:null,edgeMode:null,editable:null,elevation:oi,enableBackground:null,end:null,event:null,exponent:oi,externalResourcesRequired:null,fill:null,fillOpacity:oi,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:li,g2:li,glyphName:li,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:oi,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:oi,horizOriginX:oi,horizOriginY:oi,id:null,ideographic:oi,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:oi,k:oi,k1:oi,k2:oi,k3:oi,k4:oi,kernelMatrix:ci,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:oi,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:oi,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:oi,overlineThickness:oi,paintOrder:null,panose1:null,path:null,pathLength:oi,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ii,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:oi,pointsAtY:oi,pointsAtZ:oi,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ci,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ci,rev:ci,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ci,requiredFeatures:ci,requiredFonts:ci,requiredFormats:ci,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:oi,specularExponent:oi,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:oi,strikethroughThickness:oi,string:null,stroke:null,strokeDashArray:ci,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:oi,strokeOpacity:oi,strokeWidth:null,style:null,surfaceScale:oi,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ci,tabIndex:oi,tableValues:null,target:null,targetX:oi,targetY:oi,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ci,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:oi,underlineThickness:oi,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:oi,values:null,vAlphabetic:oi,vMathematical:oi,vectorEffect:null,vHanging:oi,vIdeographic:oi,version:null,vertAdvY:oi,vertOriginX:oi,vertOriginY:oi,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:oi,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:xi}),wi=hi({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),ki=hi({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:bi}),Ni=hi({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),ji={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Ci=/[A-Z]/g,Si=/-[a-z]/g,Ti=/^data[-\w.:]+$/i;function Ii(e){return"-"+e.toLowerCase()}function Pi(e){return e.charAt(1).toUpperCase()}const Ei=Zo([gi,yi,wi,ki,Ni],"html"),Ai=Zo([gi,vi,wi,ki,Ni],"svg");var Di,Ri,Fi,_i={};function Li(){if(Fi)return _i;Fi=1;var e=_i&&_i.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(_i,"__esModule",{value:!0}),_i.default=function(e,n){var r=null;if(!e||"string"!=typeof e)return r;var a=(0,t.default)(e),s="function"==typeof n;return a.forEach(function(e){if("declaration"===e.type){var t=e.property,a=e.value;s?n(t,a,e):a&&((r=r||{})[t]=a)}}),r};var t=e(function(){if(Ri)return Di;Ri=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,i=/^\s+|\s+$/g,l="";function c(e){return e?e.replace(i,l):l}return Di=function(i,u){if("string"!=typeof i)throw new TypeError("First argument must be a string");if(!i)return[];u=u||{};var d=1,f=1;function m(e){var n=e.match(t);n&&(d+=n.length);var r=e.lastIndexOf("\n");f=~r?e.length-r:f+e.length}function p(){var e={line:d,column:f};return function(t){return t.position=new h(e),b(),t}}function h(e){this.start=e,this.end={line:d,column:f},this.source=u.source}function g(e){var t=new Error(u.source+":"+d+":"+f+": "+e);if(t.reason=e,t.filename=u.source,t.line=d,t.column=f,t.source=i,!u.silent)throw t}function x(e){var t=e.exec(i);if(t){var n=t[0];return m(n),i=i.slice(n.length),t}}function b(){x(n)}function y(e){var t;for(e=e||[];t=v();)!1!==t&&e.push(t);return e}function v(){var e=p();if("/"==i.charAt(0)&&"*"==i.charAt(1)){for(var t=2;l!=i.charAt(t)&&("*"!=i.charAt(t)||"/"!=i.charAt(t+1));)++t;if(t+=2,l===i.charAt(t-1))return g("End of comment missing");var n=i.slice(2,t-2);return f+=2,m(n),i=i.slice(t),f+=2,e({type:"comment",comment:n})}}function w(){var t=p(),n=x(r);if(n){if(v(),!x(a))return g("property missing ':'");var i=x(s),u=t({type:"declaration",property:c(n[0].replace(e,l)),value:i?c(i[0].replace(e,l)):l});return x(o),u}}return h.prototype.content=i,b(),function(){var e,t=[];for(y(t);e=w();)!1!==e&&(t.push(e),y(t));return t}()},Di}());return _i}var Mi,Oi,zi,Bi={};function Ui(){if(Mi)return Bi;Mi=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,s=function(e,t){return t.toUpperCase()},o=function(e,t){return"".concat(t,"-")};return Bi.camelCase=function(i,l){return void 0===l&&(l={}),function(t){return!t||n.test(t)||e.test(t)}(i)?i:(i=i.toLowerCase(),(i=l.reactCompat?i.replace(a,o):i.replace(r,o)).replace(t,s))},Bi}var $i=function(){if(zi)return Oi;zi=1;var e=(Oi&&Oi.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Li()),t=Ui();function n(n,r){var a={};return n&&"string"==typeof n?((0,e.default)(n,function(e,n){e&&n&&(a[(0,t.camelCase)(e,r)]=n)}),a):a}return n.default=n,Oi=n}(),Vi=ae($i);const qi=Wi("end"),Hi=Wi("start");function Wi(e){return function(t){const n=t&&t.position&&t.position[e]||{};if("number"==typeof n.line&&n.line>0&&"number"==typeof n.column&&n.column>0)return{line:n.line,column:n.column,offset:"number"==typeof n.offset&&n.offset>-1?n.offset:void 0}}}function Qi(e){return e&&"object"==typeof e?"position"in e||"type"in e?Xi(e.position):"start"in e||"end"in e?Xi(e):"line"in e||"column"in e?Ki(e):"":""}function Ki(e){return Gi(e&&e.line)+":"+Gi(e&&e.column)}function Xi(e){return Ki(e&&e.start)+"-"+Ki(e&&e.end)}function Gi(e){return e&&"number"==typeof e?e:1}class Yi extends Error{constructor(e,t,n){super(),"string"==typeof t&&(n=t,t=void 0);let r="",a={},s=!1;if(t&&(a="line"in t&&"column"in t||"start"in t&&"end"in t?{place:t}:"type"in t?{ancestors:[t],place:t.position}:{...t}),"string"==typeof e?r=e:!a.cause&&e&&(s=!0,r=e.message,a.cause=e),!a.ruleId&&!a.source&&"string"==typeof n){const e=n.indexOf(":");-1===e?a.ruleId=n:(a.source=n.slice(0,e),a.ruleId=n.slice(e+1))}if(!a.place&&a.ancestors&&a.ancestors){const e=a.ancestors[a.ancestors.length-1];e&&(a.place=e.position)}const o=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=r,this.line=o?o.line:void 0,this.name=Qi(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=s&&a.cause&&"string"==typeof a.cause.stack?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yi.prototype.file="",Yi.prototype.name="",Yi.prototype.reason="",Yi.prototype.message="",Yi.prototype.stack="",Yi.prototype.column=void 0,Yi.prototype.line=void 0,Yi.prototype.ancestors=void 0,Yi.prototype.cause=void 0,Yi.prototype.fatal=void 0,Yi.prototype.place=void 0,Yi.prototype.ruleId=void 0,Yi.prototype.source=void 0;const Ji={}.hasOwnProperty,Zi=new Map,el=/[A-Z]/g,tl=new Set(["table","tbody","thead","tfoot","tr"]),nl=new Set(["td","th"]),rl="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function al(e,t){if(!t||void 0===t.Fragment)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if("function"!=typeof t.jsxDEV)throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=function(e,t){return n;function n(n,r,a,s){const o=Array.isArray(a.children),i=Hi(n);return t(r,a,s,o,{columnNumber:i?i.column-1:void 0,fileName:e,lineNumber:i?i.line:void 0},void 0)}}(n,t.jsxDEV)}else{if("function"!=typeof t.jsx)throw new TypeError("Expected `jsx` in production options");if("function"!=typeof t.jsxs)throw new TypeError("Expected `jsxs` in production options");r=function(e,t,n){return r;function r(e,r,a,s){const o=Array.isArray(a.children)?n:t;return s?o(r,a,s):o(r,a)}}(0,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:!1!==t.passKeys,passNode:t.passNode||!1,schema:"svg"===t.space?Ai:Ei,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:!1!==t.tableCellAlignToStyle},s=sl(a,e,void 0);return s&&"string"!=typeof s?s:a.create(e,a.Fragment,{children:s||void 0},void 0)}function sl(e,t,n){return"element"===t.type?function(e,t,n){const r=e.schema;let a=r;"svg"===t.tagName.toLowerCase()&&"html"===r.space&&(a=Ai,e.schema=a);e.ancestors.push(t);const s=ul(e,t.tagName,!1),o=function(e,t){const n={};let r,a;for(a in t.properties)if("children"!==a&&Ji.call(t.properties,a)){const s=cl(e,a,t.properties[a]);if(s){const[a,o]=s;e.tableCellAlignToStyle&&"align"===a&&"string"==typeof o&&nl.has(t.tagName)?r=o:n[a]=o}}if(r){(n.style||(n.style={}))["css"===e.stylePropertyNameCase?"text-align":"textAlign"]=r}return n}(e,t);let i=ll(e,t);tl.has(t.tagName)&&(i=i.filter(function(e){return"string"!=typeof e||!("object"==typeof(t=e)?"text"===t.type&&Yo(t.value):Yo(t));var t}));return ol(e,o,s,t),il(o,i),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}(e,t,n):"mdxFlowExpression"===t.type||"mdxTextExpression"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}dl(e,t.position)}(e,t):"mdxJsxFlowElement"===t.type||"mdxJsxTextElement"===t.type?function(e,t,n){const r=e.schema;let a=r;"svg"===t.name&&"html"===r.space&&(a=Ai,e.schema=a);e.ancestors.push(t);const s=null===t.name?e.Fragment:ul(e,t.name,!0),o=function(e,t){const n={};for(const r of t.attributes)if("mdxJsxExpressionAttribute"===r.type)if(r.data&&r.data.estree&&e.evaluater){const t=r.data.estree.body[0];qo(t.type);const a=t.expression;qo(a.type);const s=a.properties[0];qo(s.type),Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else dl(e,t.position);else{const a=r.name;let s;if(r.value&&"object"==typeof r.value)if(r.value.data&&r.value.data.estree&&e.evaluater){const t=r.value.data.estree.body[0];qo(t.type),s=e.evaluater.evaluateExpression(t.expression)}else dl(e,t.position);else s=null===r.value||r.value;n[a]=s}return n}(e,t),i=ll(e,t);return ol(e,o,s,t),il(o,i),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}(e,t,n):"mdxjsEsm"===t.type?function(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);dl(e,t.position)}(e,t):"root"===t.type?function(e,t,n){const r={};return il(r,ll(e,t)),e.create(t,e.Fragment,r,n)}(e,t,n):"text"===t.type?function(e,t){return t.value}(0,t):void 0}function ol(e,t,n,r){"string"!=typeof n&&n!==e.Fragment&&e.passNode&&(t.node=r)}function il(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function ll(e,t){const n=[];let r=-1;const a=e.passKeys?new Map:Zi;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const e="element"===s.type?s.tagName:"mdxJsxFlowElement"===s.type||"mdxJsxTextElement"===s.type?s.name:void 0;if(e){const t=a.get(e)||0;o=e+"-"+t,a.set(e,t+1)}}const i=sl(e,s,o);void 0!==i&&n.push(i)}return n}function cl(e,t,n){const r=function(e,t){const n=ei(t);let r=t,a=ti;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Ti.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Si,Pi);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Si.test(e)){let n=e.replace(Ci,Ii);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}a=mi}return new a(r,t)}(e.schema,t);if(!(null==n||"number"==typeof n&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?function(e){const t={};return(""===e[e.length-1]?[...e,""]:e).join((t.padRight?" ":"")+","+(!1===t.padLeft?"":" ")).trim()}(n):n.join(" ").trim()),"style"===r.property){let t="object"==typeof n?n:function(e,t){try{return Vi(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const t=n,r=new Yi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:t,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=rl+"#cannot-parse-style-attribute",r}}(e,String(n));return"css"===e.stylePropertyNameCase&&(t=function(e){const t={};let n;for(n in e)Ji.call(e,n)&&(t[fl(n)]=e[n]);return t}(t)),["style",t]}return["react"===e.elementAttributeNameCase&&r.space?ji[r.property]||r.property:r.attribute,n]}}function ul(e,t,n){let r;if(n)if(t.includes(".")){const e=t.split(".");let n,a=-1;for(;++a<e.length;){const t=Xo(e[a])?{type:"Identifier",name:e[a]}:{type:"Literal",value:e[a]};n=n?{type:"MemberExpression",object:n,property:t,computed:Boolean(a&&"Literal"===t.type),optional:!1}:t}r=n}else r=Xo(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};else r={type:"Literal",value:t};if("Literal"===r.type){const t=r.value;return Ji.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);dl(e)}function dl(e,t){const n=new Yi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=rl+"#cannot-handle-mdx-estrees-without-createevaluater",n}function fl(e){let t=e.replace(el,ml);return"ms-"===t.slice(0,3)&&(t="-"+t),t}function ml(e){return"-"+e.toLowerCase()}const pl={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},hl={};function gl(e,t){return xl(e,"boolean"!=typeof hl.includeImageAlt||hl.includeImageAlt,"boolean"!=typeof hl.includeHtml||hl.includeHtml)}function xl(e,t,n){if(function(e){return Boolean(e&&"object"==typeof e)}(e)){if("value"in e)return"html"!==e.type||n?e.value:"";if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return bl(e.children,t,n)}return Array.isArray(e)?bl(e,t,n):""}function bl(e,t,n){const r=[];let a=-1;for(;++a<e.length;)r[a]=xl(e[a],t,n);return r.join("")}const yl=document.createElement("i");function vl(e){const t="&"+e+";";yl.innerHTML=t;const n=yl.textContent;return(59!==n.charCodeAt(n.length-1)||"semi"===e)&&(n!==t&&n)}function wl(e,t,n,r){const a=e.length;let s,o=0;if(t=t<0?-t>a?0:a+t:t>a?a:t,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(t,n),e.splice(...s);else for(n&&e.splice(t,n);o<r.length;)s=r.slice(o,o+1e4),s.unshift(t,0),e.splice(...s),o+=1e4,t+=1e4}function kl(e,t){return e.length>0?(wl(e,e.length,0,t),e):t}const Nl={}.hasOwnProperty;function jl(e){const t={};let n=-1;for(;++n<e.length;)Cl(t,e[n]);return t}function Cl(e,t){let n;for(n in t){const r=(Nl.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let s;if(a)for(s in a){Nl.call(r,s)||(r[s]=[]);const e=a[s];Sl(r[s],Array.isArray(e)?e:e?[e]:[])}}}function Sl(e,t){let n=-1;const r=[];for(;++n<t.length;)("after"===t[n].add?e:r).push(t[n]);wl(e,0,0,r)}function Tl(e,t){const n=Number.parseInt(e,t);return n<9||11===n||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||!(65535&~n)||65534==(65535&n)||n>1114111?"�":String.fromCodePoint(n)}function Il(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Pl=Ul(/[A-Za-z]/),El=Ul(/[\dA-Za-z]/),Al=Ul(/[#-'*+\--9=?A-Z^-~]/);function Dl(e){return null!==e&&(e<32||127===e)}const Rl=Ul(/\d/),Fl=Ul(/[\dA-Fa-f]/),_l=Ul(/[!-/:-@[-`{-~]/);function Ll(e){return null!==e&&e<-2}function Ml(e){return null!==e&&(e<0||32===e)}function Ol(e){return-2===e||-1===e||32===e}const zl=Ul(/\p{P}|\p{S}/u),Bl=Ul(/\s/);function Ul(e){return function(t){return null!==t&&t>-1&&e.test(String.fromCharCode(t))}}function $l(e){const t=[];let n=-1,r=0,a=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(37===s&&El(e.charCodeAt(n+1))&&El(e.charCodeAt(n+2)))a=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const t=e.charCodeAt(n+1);s<56320&&t>56319&&t<57344?(o=String.fromCharCode(s,t),a=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+a+1,o=""),a&&(n+=a,a=0)}return t.join("")+e.slice(r)}function Vl(e,t,n,r){const a=r?r-1:Number.POSITIVE_INFINITY;let s=0;return function(r){if(Ol(r))return e.enter(n),o(r);return t(r)};function o(r){return Ol(r)&&s++<a?(e.consume(r),o):(e.exit(n),t(r))}}const ql={tokenize:function(e){const t=e.attempt(this.parser.constructs.contentInitial,function(n){if(null===n)return void e.consume(n);return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Vl(e,t,"linePrefix")},function(t){return e.enter("paragraph"),r(t)});let n;return t;function r(t){const r=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=r),n=r,a(t)}function a(t){return null===t?(e.exit("chunkText"),e.exit("paragraph"),void e.consume(t)):Ll(t)?(e.consume(t),e.exit("chunkText"),r):(e.consume(t),a)}}};const Hl={tokenize:function(e){const t=this,n=[];let r,a,s,o=0;return i;function i(r){if(o<n.length){const a=n[o];return t.containerState=a[1],e.attempt(a[0].continuation,l,c)(r)}return c(r)}function l(e){if(o++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,r&&b();const n=t.events.length;let a,s=n;for(;s--;)if("exit"===t.events[s][0]&&"chunkFlow"===t.events[s][1].type){a=t.events[s][1].end;break}x(o);let i=n;for(;i<t.events.length;)t.events[i][1].end={...a},i++;return wl(t.events,s+1,0,t.events.slice(n)),t.events.length=i,c(e)}return i(e)}function c(a){if(o===n.length){if(!r)return f(a);if(r.currentConstruct&&r.currentConstruct.concrete)return p(a);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Wl,u,d)(a)}function u(e){return r&&b(),x(o),f(e)}function d(e){return t.parser.lazy[t.now().line]=o!==n.length,s=t.now().offset,p(e)}function f(n){return t.containerState={},e.attempt(Wl,m,p)(n)}function m(e){return o++,n.push([t.currentConstruct,t.containerState]),f(e)}function p(n){return null===n?(r&&b(),x(0),void e.consume(n)):(r=r||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:r,contentType:"flow",previous:a}),h(n))}function h(n){return null===n?(g(e.exit("chunkFlow"),!0),x(0),void e.consume(n)):Ll(n)?(e.consume(n),g(e.exit("chunkFlow")),o=0,t.interrupt=void 0,i):(e.consume(n),h)}function g(e,n){const i=t.sliceStream(e);if(n&&i.push(null),e.previous=a,a&&(a.next=e),a=e,r.defineSkip(e.start),r.write(i),t.parser.lazy[e.start.line]){let e=r.events.length;for(;e--;)if(r.events[e][1].start.offset<s&&(!r.events[e][1].end||r.events[e][1].end.offset>s))return;const n=t.events.length;let a,i,l=n;for(;l--;)if("exit"===t.events[l][0]&&"chunkFlow"===t.events[l][1].type){if(a){i=t.events[l][1].end;break}a=!0}for(x(o),e=n;e<t.events.length;)t.events[e][1].end={...i},e++;wl(t.events,l+1,0,t.events.slice(n)),t.events.length=e}}function x(r){let a=n.length;for(;a-- >r;){const r=n[a];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function b(){r.write([null]),a=void 0,r=void 0,t.containerState._closeFlow=void 0}}},Wl={tokenize:function(e,t,n){return Vl(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}};function Ql(e){return null===e||Ml(e)||Bl(e)?1:zl(e)?2:void 0}function Kl(e,t,n){const r=[];let a=-1;for(;++a<e.length;){const s=e[a].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Xl={name:"attention",resolveAll:function(e,t){let n,r,a,s,o,i,l,c,u=-1;for(;++u<e.length;)if("enter"===e[u][0]&&"attentionSequence"===e[u][1].type&&e[u][1]._close)for(n=u;n--;)if("exit"===e[n][0]&&"attentionSequence"===e[n][1].type&&e[n][1]._open&&t.sliceSerialize(e[n][1]).charCodeAt(0)===t.sliceSerialize(e[u][1]).charCodeAt(0)){if((e[n][1]._close||e[u][1]._open)&&(e[u][1].end.offset-e[u][1].start.offset)%3&&!((e[n][1].end.offset-e[n][1].start.offset+e[u][1].end.offset-e[u][1].start.offset)%3))continue;i=e[n][1].end.offset-e[n][1].start.offset>1&&e[u][1].end.offset-e[u][1].start.offset>1?2:1;const d={...e[n][1].end},f={...e[u][1].start};Gl(d,-i),Gl(f,i),s={type:i>1?"strongSequence":"emphasisSequence",start:d,end:{...e[n][1].end}},o={type:i>1?"strongSequence":"emphasisSequence",start:{...e[u][1].start},end:f},a={type:i>1?"strongText":"emphasisText",start:{...e[n][1].end},end:{...e[u][1].start}},r={type:i>1?"strong":"emphasis",start:{...s.start},end:{...o.end}},e[n][1].end={...s.start},e[u][1].start={...o.end},l=[],e[n][1].end.offset-e[n][1].start.offset&&(l=kl(l,[["enter",e[n][1],t],["exit",e[n][1],t]])),l=kl(l,[["enter",r,t],["enter",s,t],["exit",s,t],["enter",a,t]]),l=kl(l,Kl(t.parser.constructs.insideSpan.null,e.slice(n+1,u),t)),l=kl(l,[["exit",a,t],["enter",o,t],["exit",o,t],["exit",r,t]]),e[u][1].end.offset-e[u][1].start.offset?(c=2,l=kl(l,[["enter",e[u][1],t],["exit",e[u][1],t]])):c=0,wl(e,n-1,u-n+3,l),u=n+l.length-c-2;break}u=-1;for(;++u<e.length;)"attentionSequence"===e[u][1].type&&(e[u][1].type="data");return e},tokenize:function(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,a=Ql(r);let s;return function(t){return s=t,e.enter("attentionSequence"),o(t)};function o(i){if(i===s)return e.consume(i),o;const l=e.exit("attentionSequence"),c=Ql(i),u=!c||2===c&&a||n.includes(i),d=!a||2===a&&c||n.includes(r);return l._open=Boolean(42===s?u:u&&(a||!d)),l._close=Boolean(42===s?d:d&&(c||!u)),t(i)}}};function Gl(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Yl={name:"autolink",tokenize:function(e,t,n){let r=0;return function(t){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(t),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a};function a(t){return Pl(t)?(e.consume(t),s):64===t?n(t):l(t)}function s(e){return 43===e||45===e||46===e||El(e)?(r=1,o(e)):l(e)}function o(t){return 58===t?(e.consume(t),r=0,i):(43===t||45===t||46===t||El(t))&&r++<32?(e.consume(t),o):(r=0,l(t))}function i(r){return 62===r?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(r),e.exit("autolinkMarker"),e.exit("autolink"),t):null===r||32===r||60===r||Dl(r)?n(r):(e.consume(r),i)}function l(t){return 64===t?(e.consume(t),c):Al(t)?(e.consume(t),l):n(t)}function c(e){return El(e)?u(e):n(e)}function u(n){return 46===n?(e.consume(n),r=0,c):62===n?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(n),e.exit("autolinkMarker"),e.exit("autolink"),t):d(n)}function d(t){if((45===t||El(t))&&r++<63){const n=45===t?d:u;return e.consume(t),n}return n(t)}}};const Jl={partial:!0,tokenize:function(e,t,n){return function(t){return Ol(t)?Vl(e,r,"linePrefix")(t):r(t)};function r(e){return null===e||Ll(e)?t(e):n(e)}}};const Zl={continuation:{tokenize:function(e,t,n){const r=this;return function(t){if(Ol(t))return Vl(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t);return a(t)};function a(r){return e.attempt(Zl,t,n)(r)}}},exit:function(e){e.exit("blockQuote")},name:"blockQuote",tokenize:function(e,t,n){const r=this;return function(t){if(62===t){const n=r.containerState;return n.open||(e.enter("blockQuote",{_container:!0}),n.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(t),e.exit("blockQuoteMarker"),a}return n(t)};function a(n){return Ol(n)?(e.enter("blockQuotePrefixWhitespace"),e.consume(n),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(n))}}};const ec={name:"characterEscape",tokenize:function(e,t,n){return function(t){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(t),e.exit("escapeMarker"),r};function r(r){return _l(r)?(e.enter("characterEscapeValue"),e.consume(r),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(r)}}};const tc={name:"characterReference",tokenize:function(e,t,n){const r=this;let a,s,o=0;return function(t){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(t),e.exit("characterReferenceMarker"),i};function i(t){return 35===t?(e.enter("characterReferenceMarkerNumeric"),e.consume(t),e.exit("characterReferenceMarkerNumeric"),l):(e.enter("characterReferenceValue"),a=31,s=El,c(t))}function l(t){return 88===t||120===t?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(t),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,s=Fl,c):(e.enter("characterReferenceValue"),a=7,s=Rl,c(t))}function c(i){if(59===i&&o){const a=e.exit("characterReferenceValue");return s!==El||vl(r.sliceSerialize(a))?(e.enter("characterReferenceMarker"),e.consume(i),e.exit("characterReferenceMarker"),e.exit("characterReference"),t):n(i)}return s(i)&&o++<a?(e.consume(i),c):n(i)}}};const nc={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(null===t)return n(t);return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a};function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}},rc={concrete:!0,name:"codeFenced",tokenize:function(e,t,n){const r=this,a={partial:!0,tokenize:function(e,t,n){let a=0;return o;function o(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),l}function l(t){return e.enter("codeFencedFence"),Ol(t)?Vl(e,c,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):c(t)}function c(t){return t===s?(e.enter("codeFencedFenceSequence"),u(t)):n(t)}function u(t){return t===s?(a++,e.consume(t),u):a>=i?(e.exit("codeFencedFenceSequence"),Ol(t)?Vl(e,d,"whitespace")(t):d(t)):n(t)}function d(r){return null===r||Ll(r)?(e.exit("codeFencedFence"),t(r)):n(r)}}};let s,o=0,i=0;return function(t){return function(t){const n=r.events[r.events.length-1];return o=n&&"linePrefix"===n[1].type?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),l(t)}(t)};function l(t){return t===s?(i++,e.consume(t),l):i<3?n(t):(e.exit("codeFencedFenceSequence"),Ol(t)?Vl(e,c,"whitespace")(t):c(t))}function c(n){return null===n||Ll(n)?(e.exit("codeFencedFence"),r.interrupt?t(n):e.check(nc,m,b)(n)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),u(n))}function u(t){return null===t||Ll(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),c(t)):Ol(t)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Vl(e,d,"whitespace")(t)):96===t&&t===s?n(t):(e.consume(t),u)}function d(t){return null===t||Ll(t)?c(t):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),f(t))}function f(t){return null===t||Ll(t)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),c(t)):96===t&&t===s?n(t):(e.consume(t),f)}function m(t){return e.attempt(a,b,p)(t)}function p(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),h}function h(t){return o>0&&Ol(t)?Vl(e,g,"linePrefix",o+1)(t):g(t)}function g(t){return null===t||Ll(t)?e.check(nc,m,b)(t):(e.enter("codeFlowValue"),x(t))}function x(t){return null===t||Ll(t)?(e.exit("codeFlowValue"),g(t)):(e.consume(t),x)}function b(n){return e.exit("codeFenced"),t(n)}}};const ac={name:"codeIndented",tokenize:function(e,t,n){const r=this;return function(t){return e.enter("codeIndented"),Vl(e,a,"linePrefix",5)(t)};function a(e){const t=r.events[r.events.length-1];return t&&"linePrefix"===t[1].type&&t[2].sliceSerialize(t[1],!0).length>=4?s(e):n(e)}function s(t){return null===t?i(t):Ll(t)?e.attempt(sc,s,i)(t):(e.enter("codeFlowValue"),o(t))}function o(t){return null===t||Ll(t)?(e.exit("codeFlowValue"),s(t)):(e.consume(t),o)}function i(n){return e.exit("codeIndented"),t(n)}}},sc={partial:!0,tokenize:function(e,t,n){const r=this;return a;function a(t){return r.parser.lazy[r.now().line]?n(t):Ll(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a):Vl(e,s,"linePrefix",5)(t)}function s(e){const s=r.events[r.events.length-1];return s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(e):Ll(e)?a(e):n(e)}}};const oc={name:"codeText",previous:function(e){return 96!==e||"characterEscape"===this.events[this.events.length-1][1].type},resolve:function(e){let t,n,r=e.length-4,a=3;if(!("lineEnding"!==e[a][1].type&&"space"!==e[a][1].type||"lineEnding"!==e[r][1].type&&"space"!==e[r][1].type))for(t=a;++t<r;)if("codeTextData"===e[t][1].type){e[a][1].type="codeTextPadding",e[r][1].type="codeTextPadding",a+=2,r-=2;break}t=a-1,r++;for(;++t<=r;)void 0===n?t!==r&&"lineEnding"!==e[t][1].type&&(n=t):t!==r&&"lineEnding"!==e[t][1].type||(e[n][1].type="codeTextData",t!==n+2&&(e[n][1].end=e[t-1][1].end,e.splice(n+2,t-n-2),r-=t-n-2,t=n+2),n=void 0);return e},tokenize:function(e,t,n){let r,a,s=0;return function(t){return e.enter("codeText"),e.enter("codeTextSequence"),o(t)};function o(t){return 96===t?(e.consume(t),s++,o):(e.exit("codeTextSequence"),i(t))}function i(t){return null===t?n(t):32===t?(e.enter("space"),e.consume(t),e.exit("space"),i):96===t?(a=e.enter("codeTextSequence"),r=0,c(t)):Ll(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),i):(e.enter("codeTextData"),l(t))}function l(t){return null===t||32===t||96===t||Ll(t)?(e.exit("codeTextData"),i(t)):(e.consume(t),l)}function c(n){return 96===n?(e.consume(n),r++,c):r===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(n)):(a.type="codeTextData",l(n))}}};class ic{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){const n=null==t?Number.POSITIVE_INFINITY:t;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){const r=t||0;this.setCursor(Math.trunc(e));const a=this.right.splice(this.right.length-r,Number.POSITIVE_INFINITY);return n&&lc(this.left,n),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),lc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),lc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&0===this.right.length||e<0&&0===this.left.length))if(e<this.left.length){const t=this.left.splice(e,Number.POSITIVE_INFINITY);lc(this.right,t.reverse())}else{const t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);lc(this.left,t.reverse())}}}function lc(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cc(e){const t={};let n,r,a,s,o,i,l,c=-1;const u=new ic(e);for(;++c<u.length;){for(;c in t;)c=t[c];if(n=u.get(c),c&&"chunkFlow"===n[1].type&&"listItemPrefix"===u.get(c-1)[1].type&&(i=n[1]._tokenizer.events,a=0,a<i.length&&"lineEndingBlank"===i[a][1].type&&(a+=2),a<i.length&&"content"===i[a][1].type))for(;++a<i.length&&"content"!==i[a][1].type;)"chunkText"===i[a][1].type&&(i[a][1]._isInFirstContentOfListItem=!0,a++);if("enter"===n[0])n[1].contentType&&(Object.assign(t,uc(u,c)),c=t[c],l=!0);else if(n[1]._container){for(a=c,r=void 0;a--;)if(s=u.get(a),"lineEnding"===s[1].type||"lineEndingBlank"===s[1].type)"enter"===s[0]&&(r&&(u.get(r)[1].type="lineEndingBlank"),s[1].type="lineEnding",r=a);else if("linePrefix"!==s[1].type&&"listItemIndent"!==s[1].type)break;r&&(n[1].end={...u.get(r)[1].start},o=u.slice(r,c),o.unshift(n),u.splice(r,c-r+1,o))}}return wl(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!l}function uc(e,t){const n=e.get(t)[1],r=e.get(t)[2];let a=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const i=o.events,l=[],c={};let u,d,f=-1,m=n,p=0,h=0;const g=[h];for(;m;){for(;e.get(++a)[1]!==m;);s.push(a),m._tokenizer||(u=r.sliceStream(m),m.next||u.push(null),d&&o.defineSkip(m.start),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),m._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=m,m=m.next}for(m=n;++f<i.length;)"exit"===i[f][0]&&"enter"===i[f-1][0]&&i[f][1].type===i[f-1][1].type&&i[f][1].start.line!==i[f][1].end.line&&(h=f+1,g.push(h),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(o.events=[],m?(m._tokenizer=void 0,m.previous=void 0):g.pop(),f=g.length;f--;){const t=i.slice(g[f],g[f+1]),n=s.pop();l.push([n,n+t.length-1]),e.splice(n,2,t)}for(l.reverse(),f=-1;++f<l.length;)c[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return c}const dc={resolve:function(e){return cc(e),e},tokenize:function(e,t){let n;return function(t){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),r(t)};function r(t){return null===t?a(t):Ll(t)?e.check(fc,s,a)(t):(e.consume(t),r)}function a(n){return e.exit("chunkContent"),e.exit("content"),t(n)}function s(t){return e.consume(t),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,r}}},fc={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Vl(e,a,"linePrefix")};function a(a){if(null===a||Ll(a))return n(a);const s=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&s&&"linePrefix"===s[1].type&&s[2].sliceSerialize(s[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}};function mc(e,t,n,r,a,s,o,i,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return function(t){if(60===t)return e.enter(r),e.enter(a),e.enter(s),e.consume(t),e.exit(s),d;if(null===t||32===t||41===t||Dl(t))return n(t);return e.enter(r),e.enter(o),e.enter(i),e.enter("chunkString",{contentType:"string"}),p(t)};function d(n){return 62===n?(e.enter(s),e.consume(n),e.exit(s),e.exit(a),e.exit(r),t):(e.enter(i),e.enter("chunkString",{contentType:"string"}),f(n))}function f(t){return 62===t?(e.exit("chunkString"),e.exit(i),d(t)):null===t||60===t||Ll(t)?n(t):(e.consume(t),92===t?m:f)}function m(t){return 60===t||62===t||92===t?(e.consume(t),f):f(t)}function p(a){return u||null!==a&&41!==a&&!Ml(a)?u<c&&40===a?(e.consume(a),u++,p):41===a?(e.consume(a),u--,p):null===a||32===a||40===a||Dl(a)?n(a):(e.consume(a),92===a?h:p):(e.exit("chunkString"),e.exit(i),e.exit(o),e.exit(r),t(a))}function h(t){return 40===t||41===t||92===t?(e.consume(t),p):p(t)}}function pc(e,t,n,r,a,s){const o=this;let i,l=0;return function(t){return e.enter(r),e.enter(a),e.consume(t),e.exit(a),e.enter(s),c};function c(d){return l>999||null===d||91===d||93===d&&!i||94===d&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(d):93===d?(e.exit(s),e.enter(a),e.consume(d),e.exit(a),e.exit(r),t):Ll(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),u(d))}function u(t){return null===t||91===t||93===t||Ll(t)||l++>999?(e.exit("chunkString"),c(t)):(e.consume(t),i||(i=!Ol(t)),92===t?d:u)}function d(t){return 91===t||92===t||93===t?(e.consume(t),l++,u):u(t)}}function hc(e,t,n,r,a,s){let o;return function(t){if(34===t||39===t||40===t)return e.enter(r),e.enter(a),e.consume(t),e.exit(a),o=40===t?41:t,i;return n(t)};function i(n){return n===o?(e.enter(a),e.consume(n),e.exit(a),e.exit(r),t):(e.enter(s),l(n))}function l(t){return t===o?(e.exit(s),i(o)):null===t?n(t):Ll(t)?(e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),Vl(e,l,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(t))}function c(t){return t===o||null===t||Ll(t)?(e.exit("chunkString"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return t===o||92===t?(e.consume(t),c):c(t)}}function gc(e,t){let n;return function r(a){if(Ll(a))return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,r;if(Ol(a))return Vl(e,r,n?"linePrefix":"lineSuffix")(a);return t(a)}}const xc={name:"definition",tokenize:function(e,t,n){const r=this;let a;return function(t){return e.enter("definition"),function(t){return pc.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(t)}(t)};function s(t){return a=Il(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),o):n(t)}function o(t){return Ml(t)?gc(e,i)(t):i(t)}function i(t){return mc(e,l,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(t)}function l(t){return e.attempt(bc,c,c)(t)}function c(t){return Ol(t)?Vl(e,u,"whitespace")(t):u(t)}function u(s){return null===s||Ll(s)?(e.exit("definition"),r.parser.defined.push(a),t(s)):n(s)}}},bc={partial:!0,tokenize:function(e,t,n){return function(t){return Ml(t)?gc(e,r)(t):n(t)};function r(t){return hc(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(t)}function a(t){return Ol(t)?Vl(e,s,"whitespace")(t):s(t)}function s(e){return null===e||Ll(e)?t(e):n(e)}}};const yc={name:"hardBreakEscape",tokenize:function(e,t,n){return function(t){return e.enter("hardBreakEscape"),e.consume(t),r};function r(r){return Ll(r)?(e.exit("hardBreakEscape"),t(r)):n(r)}}};const vc={name:"headingAtx",resolve:function(e,t){let n,r,a=e.length-2,s=3;"whitespace"===e[s][1].type&&(s+=2);a-2>s&&"whitespace"===e[a][1].type&&(a-=2);"atxHeadingSequence"===e[a][1].type&&(s===a-1||a-4>s&&"whitespace"===e[a-2][1].type)&&(a-=s+1===a?2:4);a>s&&(n={type:"atxHeadingText",start:e[s][1].start,end:e[a][1].end},r={type:"chunkText",start:e[s][1].start,end:e[a][1].end,contentType:"text"},wl(e,s,a-s+1,[["enter",n,t],["enter",r,t],["exit",r,t],["exit",n,t]]));return e},tokenize:function(e,t,n){let r=0;return function(t){return e.enter("atxHeading"),function(t){return e.enter("atxHeadingSequence"),a(t)}(t)};function a(t){return 35===t&&r++<6?(e.consume(t),a):null===t||Ml(t)?(e.exit("atxHeadingSequence"),s(t)):n(t)}function s(n){return 35===n?(e.enter("atxHeadingSequence"),o(n)):null===n||Ll(n)?(e.exit("atxHeading"),t(n)):Ol(n)?Vl(e,s,"whitespace")(n):(e.enter("atxHeadingText"),i(n))}function o(t){return 35===t?(e.consume(t),o):(e.exit("atxHeadingSequence"),s(t))}function i(t){return null===t||35===t||Ml(t)?(e.exit("atxHeadingText"),s(t)):(e.consume(t),i)}}};const wc=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],kc=["pre","script","style","textarea"],Nc={concrete:!0,name:"htmlFlow",resolveTo:function(e){let t=e.length;for(;t--&&("enter"!==e[t][0]||"htmlFlow"!==e[t][1].type););t>1&&"linePrefix"===e[t-2][1].type&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2));return e},tokenize:function(e,t,n){const r=this;let a,s,o,i,l;return function(t){return function(t){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(t),c}(t)};function c(i){return 33===i?(e.consume(i),u):47===i?(e.consume(i),s=!0,m):63===i?(e.consume(i),a=3,r.interrupt?t:F):Pl(i)?(e.consume(i),o=String.fromCharCode(i),p):n(i)}function u(s){return 45===s?(e.consume(s),a=2,d):91===s?(e.consume(s),a=5,i=0,f):Pl(s)?(e.consume(s),a=4,r.interrupt?t:F):n(s)}function d(a){return 45===a?(e.consume(a),r.interrupt?t:F):n(a)}function f(a){const s="CDATA[";return a===s.charCodeAt(i++)?(e.consume(a),6===i?r.interrupt?t:S:f):n(a)}function m(t){return Pl(t)?(e.consume(t),o=String.fromCharCode(t),p):n(t)}function p(i){if(null===i||47===i||62===i||Ml(i)){const l=47===i,c=o.toLowerCase();return l||s||!kc.includes(c)?wc.includes(o.toLowerCase())?(a=6,l?(e.consume(i),h):r.interrupt?t(i):S(i)):(a=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(i):s?g(i):x(i)):(a=1,r.interrupt?t(i):S(i))}return 45===i||El(i)?(e.consume(i),o+=String.fromCharCode(i),p):n(i)}function h(a){return 62===a?(e.consume(a),r.interrupt?t:S):n(a)}function g(t){return Ol(t)?(e.consume(t),g):j(t)}function x(t){return 47===t?(e.consume(t),j):58===t||95===t||Pl(t)?(e.consume(t),b):Ol(t)?(e.consume(t),x):j(t)}function b(t){return 45===t||46===t||58===t||95===t||El(t)?(e.consume(t),b):y(t)}function y(t){return 61===t?(e.consume(t),v):Ol(t)?(e.consume(t),y):x(t)}function v(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),l=t,w):Ol(t)?(e.consume(t),v):k(t)}function w(t){return t===l?(e.consume(t),l=null,N):null===t||Ll(t)?n(t):(e.consume(t),w)}function k(t){return null===t||34===t||39===t||47===t||60===t||61===t||62===t||96===t||Ml(t)?y(t):(e.consume(t),k)}function N(e){return 47===e||62===e||Ol(e)?x(e):n(e)}function j(t){return 62===t?(e.consume(t),C):n(t)}function C(t){return null===t||Ll(t)?S(t):Ol(t)?(e.consume(t),C):n(t)}function S(t){return 45===t&&2===a?(e.consume(t),E):60===t&&1===a?(e.consume(t),A):62===t&&4===a?(e.consume(t),_):63===t&&3===a?(e.consume(t),F):93===t&&5===a?(e.consume(t),R):!Ll(t)||6!==a&&7!==a?null===t||Ll(t)?(e.exit("htmlFlowData"),T(t)):(e.consume(t),S):(e.exit("htmlFlowData"),e.check(jc,L,T)(t))}function T(t){return e.check(Cc,I,L)(t)}function I(t){return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),P}function P(t){return null===t||Ll(t)?T(t):(e.enter("htmlFlowData"),S(t))}function E(t){return 45===t?(e.consume(t),F):S(t)}function A(t){return 47===t?(e.consume(t),o="",D):S(t)}function D(t){if(62===t){const n=o.toLowerCase();return kc.includes(n)?(e.consume(t),_):S(t)}return Pl(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),D):S(t)}function R(t){return 93===t?(e.consume(t),F):S(t)}function F(t){return 62===t?(e.consume(t),_):45===t&&2===a?(e.consume(t),F):S(t)}function _(t){return null===t||Ll(t)?(e.exit("htmlFlowData"),L(t)):(e.consume(t),_)}function L(n){return e.exit("htmlFlow"),t(n)}}},jc={partial:!0,tokenize:function(e,t,n){return function(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),e.attempt(Jl,t,n)}}},Cc={partial:!0,tokenize:function(e,t,n){const r=this;return function(t){if(Ll(t))return e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),a;return n(t)};function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}};const Sc={name:"htmlText",tokenize:function(e,t,n){const r=this;let a,s,o;return function(t){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(t),i};function i(t){return 33===t?(e.consume(t),l):47===t?(e.consume(t),v):63===t?(e.consume(t),b):Pl(t)?(e.consume(t),N):n(t)}function l(t){return 45===t?(e.consume(t),c):91===t?(e.consume(t),s=0,m):Pl(t)?(e.consume(t),x):n(t)}function c(t){return 45===t?(e.consume(t),f):n(t)}function u(t){return null===t?n(t):45===t?(e.consume(t),d):Ll(t)?(o=u,D(t)):(e.consume(t),u)}function d(t){return 45===t?(e.consume(t),f):u(t)}function f(e){return 62===e?A(e):45===e?d(e):u(e)}function m(t){const r="CDATA[";return t===r.charCodeAt(s++)?(e.consume(t),6===s?p:m):n(t)}function p(t){return null===t?n(t):93===t?(e.consume(t),h):Ll(t)?(o=p,D(t)):(e.consume(t),p)}function h(t){return 93===t?(e.consume(t),g):p(t)}function g(t){return 62===t?A(t):93===t?(e.consume(t),g):p(t)}function x(t){return null===t||62===t?A(t):Ll(t)?(o=x,D(t)):(e.consume(t),x)}function b(t){return null===t?n(t):63===t?(e.consume(t),y):Ll(t)?(o=b,D(t)):(e.consume(t),b)}function y(e){return 62===e?A(e):b(e)}function v(t){return Pl(t)?(e.consume(t),w):n(t)}function w(t){return 45===t||El(t)?(e.consume(t),w):k(t)}function k(t){return Ll(t)?(o=k,D(t)):Ol(t)?(e.consume(t),k):A(t)}function N(t){return 45===t||El(t)?(e.consume(t),N):47===t||62===t||Ml(t)?j(t):n(t)}function j(t){return 47===t?(e.consume(t),A):58===t||95===t||Pl(t)?(e.consume(t),C):Ll(t)?(o=j,D(t)):Ol(t)?(e.consume(t),j):A(t)}function C(t){return 45===t||46===t||58===t||95===t||El(t)?(e.consume(t),C):S(t)}function S(t){return 61===t?(e.consume(t),T):Ll(t)?(o=S,D(t)):Ol(t)?(e.consume(t),S):j(t)}function T(t){return null===t||60===t||61===t||62===t||96===t?n(t):34===t||39===t?(e.consume(t),a=t,I):Ll(t)?(o=T,D(t)):Ol(t)?(e.consume(t),T):(e.consume(t),P)}function I(t){return t===a?(e.consume(t),a=void 0,E):null===t?n(t):Ll(t)?(o=I,D(t)):(e.consume(t),I)}function P(t){return null===t||34===t||39===t||60===t||61===t||96===t?n(t):47===t||62===t||Ml(t)?j(t):(e.consume(t),P)}function E(e){return 47===e||62===e||Ml(e)?j(e):n(e)}function A(r){return 62===r?(e.consume(r),e.exit("htmlTextData"),e.exit("htmlText"),t):n(r)}function D(t){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),R}function R(t){return Ol(t)?Vl(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):F(t)}function F(t){return e.enter("htmlTextData"),o(t)}}};const Tc={name:"labelEnd",resolveAll:function(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),"labelImage"===r.type||"labelLink"===r.type||"labelEnd"===r.type){const e="labelImage"===r.type?4:2;r.type="data",t+=e}}e.length!==n.length&&wl(e,0,e.length,n);return e},resolveTo:function(e,t){let n,r,a,s,o=e.length,i=0;for(;o--;)if(n=e[o][1],r){if("link"===n.type||"labelLink"===n.type&&n._inactive)break;"enter"===e[o][0]&&"labelLink"===n.type&&(n._inactive=!0)}else if(a){if("enter"===e[o][0]&&("labelImage"===n.type||"labelLink"===n.type)&&!n._balanced&&(r=o,"labelLink"!==n.type)){i=2;break}}else"labelEnd"===n.type&&(a=o);const l={type:"labelLink"===e[r][1].type?"link":"image",start:{...e[r][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[r][1].start},end:{...e[a][1].end}},u={type:"labelText",start:{...e[r+i+2][1].end},end:{...e[a-2][1].start}};return s=[["enter",l,t],["enter",c,t]],s=kl(s,e.slice(r+1,r+i+3)),s=kl(s,[["enter",u,t]]),s=kl(s,Kl(t.parser.constructs.insideSpan.null,e.slice(r+i+4,a-3),t)),s=kl(s,[["exit",u,t],e[a-2],e[a-1],["exit",c,t]]),s=kl(s,e.slice(a+1)),s=kl(s,[["exit",l,t]]),wl(e,r,e.length,s),e},tokenize:function(e,t,n){const r=this;let a,s,o=r.events.length;for(;o--;)if(("labelImage"===r.events[o][1].type||"labelLink"===r.events[o][1].type)&&!r.events[o][1]._balanced){a=r.events[o][1];break}return function(t){if(!a)return n(t);if(a._inactive)return u(t);return s=r.parser.defined.includes(Il(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelEnd"),i};function i(t){return 40===t?e.attempt(Ic,c,s?c:u)(t):91===t?e.attempt(Pc,c,s?l:u)(t):s?c(t):u(t)}function l(t){return e.attempt(Ec,c,u)(t)}function c(e){return t(e)}function u(e){return a._balanced=!0,n(e)}}},Ic={tokenize:function(e,t,n){return function(t){return e.enter("resource"),e.enter("resourceMarker"),e.consume(t),e.exit("resourceMarker"),r};function r(t){return Ml(t)?gc(e,a)(t):a(t)}function a(t){return 41===t?c(t):mc(e,s,o,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(t)}function s(t){return Ml(t)?gc(e,i)(t):c(t)}function o(e){return n(e)}function i(t){return 34===t||39===t||40===t?hc(e,l,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(t):c(t)}function l(t){return Ml(t)?gc(e,c)(t):c(t)}function c(r){return 41===r?(e.enter("resourceMarker"),e.consume(r),e.exit("resourceMarker"),e.exit("resource"),t):n(r)}}},Pc={tokenize:function(e,t,n){const r=this;return function(t){return pc.call(r,e,a,s,"reference","referenceMarker","referenceString")(t)};function a(e){return r.parser.defined.includes(Il(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function s(e){return n(e)}}},Ec={tokenize:function(e,t,n){return function(t){return e.enter("reference"),e.enter("referenceMarker"),e.consume(t),e.exit("referenceMarker"),r};function r(r){return 93===r?(e.enter("referenceMarker"),e.consume(r),e.exit("referenceMarker"),e.exit("reference"),t):n(r)}}};const Ac={name:"labelStartImage",resolveAll:Tc.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(t),e.exit("labelImageMarker"),a};function a(t){return 91===t?(e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelImage"),s):n(t)}function s(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const Dc={name:"labelStartLink",resolveAll:Tc.resolveAll,tokenize:function(e,t,n){const r=this;return function(t){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(t),e.exit("labelMarker"),e.exit("labelLink"),a};function a(e){return 94===e&&"_hiddenFootnoteSupport"in r.parser.constructs?n(e):t(e)}}};const Rc={name:"lineEnding",tokenize:function(e,t){return function(n){return e.enter("lineEnding"),e.consume(n),e.exit("lineEnding"),Vl(e,t,"linePrefix")}}};const Fc={name:"thematicBreak",tokenize:function(e,t,n){let r,a=0;return function(t){return e.enter("thematicBreak"),function(e){return r=e,s(e)}(t)};function s(s){return s===r?(e.enter("thematicBreakSequence"),o(s)):a>=3&&(null===s||Ll(s))?(e.exit("thematicBreak"),t(s)):n(s)}function o(t){return t===r?(e.consume(t),a++,o):(e.exit("thematicBreakSequence"),Ol(t)?Vl(e,s,"whitespace")(t):s(t))}}};const _c={continuation:{tokenize:function(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Jl,a,s);function a(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Vl(e,t,"listItemIndent",r.containerState.size+1)(n)}function s(n){return r.containerState.furtherBlankLines||!Ol(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Mc,t,o)(n))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Vl(e,e.attempt(_c,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}},exit:function(e){e.exit(this.containerState.type)},name:"list",tokenize:function(e,t,n){const r=this,a=r.events[r.events.length-1];let s=a&&"linePrefix"===a[1].type?a[2].sliceSerialize(a[1],!0).length:0,o=0;return function(t){const a=r.containerState.type||(42===t||43===t||45===t?"listUnordered":"listOrdered");if("listUnordered"===a?!r.containerState.marker||t===r.containerState.marker:Rl(t)){if(r.containerState.type||(r.containerState.type=a,e.enter(a,{_container:!0})),"listUnordered"===a)return e.enter("listItemPrefix"),42===t||45===t?e.check(Fc,n,l)(t):l(t);if(!r.interrupt||49===t)return e.enter("listItemPrefix"),e.enter("listItemValue"),i(t)}return n(t)};function i(t){return Rl(t)&&++o<10?(e.consume(t),i):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:41===t||46===t)?(e.exit("listItemValue"),l(t)):n(t)}function l(t){return e.enter("listItemMarker"),e.consume(t),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||t,e.check(Jl,r.interrupt?n:c,e.attempt(Lc,d,u))}function c(e){return r.containerState.initialBlankLine=!0,s++,d(e)}function u(t){return Ol(t)?(e.enter("listItemPrefixWhitespace"),e.consume(t),e.exit("listItemPrefixWhitespace"),d):n(t)}function d(n){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(n)}}},Lc={partial:!0,tokenize:function(e,t,n){const r=this;return Vl(e,function(e){const a=r.events[r.events.length-1];return!Ol(e)&&a&&"listItemPrefixWhitespace"===a[1].type?t(e):n(e)},"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5)}},Mc={partial:!0,tokenize:function(e,t,n){const r=this;return Vl(e,function(e){const a=r.events[r.events.length-1];return a&&"listItemIndent"===a[1].type&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(e):n(e)},"listItemIndent",r.containerState.size+1)}};const Oc={name:"setextUnderline",resolveTo:function(e,t){let n,r,a,s=e.length;for(;s--;)if("enter"===e[s][0]){if("content"===e[s][1].type){n=s;break}"paragraph"===e[s][1].type&&(r=s)}else"content"===e[s][1].type&&e.splice(s,1),a||"definition"!==e[s][1].type||(a=s);const o={type:"setextHeading",start:{...e[n][1].start},end:{...e[e.length-1][1].end}};e[r][1].type="setextHeadingText",a?(e.splice(r,0,["enter",o,t]),e.splice(a+1,0,["exit",e[n][1],t]),e[n][1].end={...e[a][1].end}):e[n][1]=o;return e.push(["exit",o,t]),e},tokenize:function(e,t,n){const r=this;let a;return function(t){let o,i=r.events.length;for(;i--;)if("lineEnding"!==r.events[i][1].type&&"linePrefix"!==r.events[i][1].type&&"content"!==r.events[i][1].type){o="paragraph"===r.events[i][1].type;break}if(!r.parser.lazy[r.now().line]&&(r.interrupt||o))return e.enter("setextHeadingLine"),a=t,function(t){return e.enter("setextHeadingLineSequence"),s(t)}(t);return n(t)};function s(t){return t===a?(e.consume(t),s):(e.exit("setextHeadingLineSequence"),Ol(t)?Vl(e,o,"lineSuffix")(t):o(t))}function o(r){return null===r||Ll(r)?(e.exit("setextHeadingLine"),t(r)):n(r)}}};const zc={tokenize:function(e){const t=this,n=e.attempt(Jl,function(r){if(null===r)return void e.consume(r);return e.enter("lineEndingBlank"),e.consume(r),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n},e.attempt(this.parser.constructs.flowInitial,r,Vl(e,e.attempt(this.parser.constructs.flow,r,e.attempt(dc,r)),"linePrefix")));return n;function r(r){if(null!==r)return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),t.currentConstruct=void 0,n;e.consume(r)}}};const Bc={resolveAll:qc()},Uc=Vc("string"),$c=Vc("text");function Vc(e){return{resolveAll:qc("text"===e?Hc:void 0),tokenize:function(t){const n=this,r=this.parser.constructs[e],a=t.attempt(r,s,o);return s;function s(e){return l(e)?a(e):o(e)}function o(e){if(null!==e)return t.enter("data"),t.consume(e),i;t.consume(e)}function i(e){return l(e)?(t.exit("data"),a(e)):(t.consume(e),i)}function l(e){if(null===e)return!0;const t=r[e];let a=-1;if(t)for(;++a<t.length;){const e=t[a];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}}function qc(e){return function(t,n){let r,a=-1;for(;++a<=t.length;)void 0===r?t[a]&&"data"===t[a][1].type&&(r=a,a++):t[a]&&"data"===t[a][1].type||(a!==r+2&&(t[r][1].end=t[a-1][1].end,t.splice(r+2,a-r-2),a=r+2),r=void 0);return e?e(t,n):t}}function Hc(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||"lineEnding"===e[n][1].type)&&"data"===e[n-1][1].type){const r=e[n-1][1],a=t.sliceStream(r);let s,o=a.length,i=-1,l=0;for(;o--;){const e=a[o];if("string"==typeof e){for(i=e.length;32===e.charCodeAt(i-1);)l++,i--;if(i)break;i=-1}else if(-2===e)s=!0,l++;else if(-1!==e){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const a={type:n===e.length||s||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?i:r.start._bufferIndex+i,_index:r.start._index+o,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...a.start},r.start.offset===r.end.offset?Object.assign(r,a):(e.splice(n,0,["enter",a,t],["exit",a,t]),n+=2)}n++}return e}const Wc={42:_c,43:_c,45:_c,48:_c,49:_c,50:_c,51:_c,52:_c,53:_c,54:_c,55:_c,56:_c,57:_c,62:Zl},Qc={91:xc},Kc={[-2]:ac,[-1]:ac,32:ac},Xc={35:vc,42:Fc,45:[Oc,Fc],60:Nc,61:Oc,95:Fc,96:rc,126:rc},Gc={38:tc,92:ec},Yc={[-5]:Rc,[-4]:Rc,[-3]:Rc,33:Ac,38:tc,42:Xl,60:[Yl,Sc],91:Dc,92:[yc,ec],93:Tc,95:Xl,96:oc},Jc={null:[Xl,Bc]};var Zc=Object.freeze({__proto__:null,attentionMarkers:{null:[42,95]},contentInitial:Qc,disable:{null:[]},document:Wc,flow:Xc,flowInitial:Kc,insideSpan:Jc,string:Gc,text:Yc});function eu(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},s=[];let o=[],i=[];const l={attempt:g(function(e,t){x(e,t.from)}),check:g(h),consume:function(e){Ll(e)?(r.line++,r.column=1,r.offset+=-3===e?2:1,b()):-1!==e&&(r.column++,r.offset++);r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++));c.previous=e},enter:function(e,t){const n=t||{};return n.type=e,n.start=f(),c.events.push(["enter",n,c]),i.push(n),n},exit:function(e){const t=i.pop();return t.end=f(),c.events.push(["exit",t,c]),t},interrupt:g(h,{interrupt:!0})},c={code:null,containerState:{},defineSkip:function(e){a[e.line]=e.column,b()},events:[],now:f,parser:e,previous:null,sliceSerialize:function(e,t){return function(e,t){let n=-1;const r=[];let a;for(;++n<e.length;){const s=e[n];let o;if("string"==typeof s)o=s;else switch(s){case-5:o="\r";break;case-4:o="\n";break;case-3:o="\r\n";break;case-2:o=t?" ":"\t";break;case-1:if(!t&&a)continue;o=" ";break;default:o=String.fromCharCode(s)}a=-2===s,r.push(o)}return r.join("")}(d(e),t)},sliceStream:d,write:function(e){if(o=kl(o,e),m(),null!==o[o.length-1])return[];return x(t,0),c.events=Kl(s,c.events,c),c.events}};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(e){return function(e,t){const n=t.start._index,r=t.start._bufferIndex,a=t.end._index,s=t.end._bufferIndex;let o;if(n===a)o=[e[n].slice(r,s)];else{if(o=e.slice(n,a),r>-1){const e=o[0];"string"==typeof e?o[0]=e.slice(r):o.shift()}s>0&&o.push(e[a].slice(0,s))}return o}(o,e)}function f(){const{_bufferIndex:e,_index:t,line:n,column:a,offset:s}=r;return{_bufferIndex:e,_index:t,line:n,column:a,offset:s}}function m(){let e;for(;r._index<o.length;){const t=o[r._index];if("string"==typeof t)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)p(t.charCodeAt(r._bufferIndex));else p(t)}}function p(e){u=u(e)}function h(e,t){t.restore()}function g(e,t){return function(n,a,s){let o,u,d,m;return Array.isArray(n)?p(n):"tokenize"in n?p([n]):function(e){return t;function t(t){const n=null!==t&&e[t],r=null!==t&&e.null;return p([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}(n);function p(e){return o=e,u=0,0===e.length?s:h(e[u])}function h(e){return function(n){m=function(){const e=f(),t=c.previous,n=c.currentConstruct,a=c.events.length,s=Array.from(i);return{from:a,restore:o};function o(){r=e,c.previous=t,c.currentConstruct=n,c.events.length=a,i=s,b()}}(),d=e,e.partial||(c.currentConstruct=e);if(e.name&&c.parser.constructs.disable.null.includes(e.name))return x();return e.tokenize.call(t?Object.assign(Object.create(c),t):c,l,g,x)(n)}}function g(t){return e(d,m),a}function x(e){return m.restore(),++u<o.length?h(o[u]):s}}}function x(e,t){e.resolveAll&&!s.includes(e)&&s.push(e),e.resolve&&wl(c.events,t,c.events.length-t,e.resolve(c.events.slice(t),c)),e.resolveTo&&(c.events=e.resolveTo(c.events,c))}function b(){r.line in a&&r.column<2&&(r.column=a[r.line],r.offset+=a[r.line]-1)}}const tu=/[\0\t\n\r]/g;const nu=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ru(e,t,n){if(t)return t;if(35===n.charCodeAt(0)){const e=n.charCodeAt(1),t=120===e||88===e;return Tl(n.slice(t?2:1),t?16:10)}return vl(n)||e}const au={}.hasOwnProperty;function su(e,t,n){return"string"!=typeof t&&(n=t,t=void 0),function(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(te),autolinkProtocol:C,autolinkEmail:C,atxHeading:s(Y),blockQuote:s(W),characterEscape:C,characterReference:C,codeFenced:s(Q),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(Q,o),codeText:s(K,o),codeTextData:C,data:C,codeFlowValue:C,definition:s(X),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(G),hardBreakEscape:s(J),hardBreakTrailing:s(J),htmlFlow:s(Z,o),htmlFlowData:C,htmlText:s(Z,o),htmlTextData:C,image:s(ee),label:o,link:s(te),listItem:s(re),listItemValue:f,listOrdered:s(ne,d),listUnordered:s(ne),paragraph:s(ae),reference:z,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Y),strong:s(se),thematicBreak:s(ie)},exit:{atxHeading:l(),atxHeadingSequence:w,autolink:l(),autolinkEmail:H,autolinkProtocol:q,blockQuote:l(),characterEscapeValue:S,characterReferenceMarkerHexadecimal:U,characterReferenceMarkerNumeric:U,characterReferenceValue:$,characterReference:V,codeFenced:l(g),codeFencedFence:h,codeFencedFenceInfo:m,codeFencedFenceMeta:p,codeFlowValue:S,codeIndented:l(x),codeText:l(A),codeTextData:S,data:S,definition:l(),definitionDestinationString:v,definitionLabelString:b,definitionTitleString:y,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(P),htmlFlowData:S,htmlText:l(E),htmlTextData:S,image:l(R),label:_,labelText:F,lineEnding:T,link:l(D),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:L,resourceTitleString:M,resource:O,setextHeading:l(j),setextHeadingLineSequence:N,setextHeadingText:k,strong:l(),thematicBreak:l()}};iu(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(e){let r={type:"root",children:[]};const s={stack:[r],tokenStack:[],config:t,enter:i,exit:c,buffer:o,resume:u,data:n},l=[];let d=-1;for(;++d<e.length;)if("listOrdered"===e[d][1].type||"listUnordered"===e[d][1].type)if("enter"===e[d][0])l.push(d);else{d=a(e,l.pop(),d)}for(d=-1;++d<e.length;){const n=t[e[d][0]];au.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},s),e[d][1])}if(s.tokenStack.length>0){const e=s.tokenStack[s.tokenStack.length-1];(e[1]||cu).call(s,void 0,e[0])}for(r.position={start:ou(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ou(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function a(e,t,n){let r,a,s,o,i=t-1,l=-1,c=!1;for(;++i<=n;){const t=e[i];switch(t[1].type){case"listUnordered":case"listOrdered":case"blockQuote":"enter"===t[0]?l++:l--,o=void 0;break;case"lineEndingBlank":"enter"===t[0]&&(!r||o||l||s||(s=i),o=void 0);break;case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:o=void 0}if(!l&&"enter"===t[0]&&"listItemPrefix"===t[1].type||-1===l&&"exit"===t[0]&&("listUnordered"===t[1].type||"listOrdered"===t[1].type)){if(r){let o=i;for(a=void 0;o--;){const t=e[o];if("lineEnding"===t[1].type||"lineEndingBlank"===t[1].type){if("exit"===t[0])continue;a&&(e[a][1].type="lineEndingBlank",c=!0),t[1].type="lineEnding",a=o}else if("linePrefix"!==t[1].type&&"blockQuotePrefix"!==t[1].type&&"blockQuotePrefixWhitespace"!==t[1].type&&"blockQuoteMarker"!==t[1].type&&"listItemIndent"!==t[1].type)break}s&&(!a||s<a)&&(r._spread=!0),r.end=Object.assign({},a?e[a][1].start:t[1].end),e.splice(a||i,0,["exit",r,t[2]]),i++,n++}if("listItemPrefix"===t[1].type){const a={type:"listItem",_spread:!1,start:Object.assign({},t[1].start),end:void 0};r=a,e.splice(i,0,["enter",a,t[2]]),i++,n++,s=void 0,o=!0}}}return e[t][1]._spread=c,n}function s(e,t){return n;function n(n){i.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:"fragment",children:[]})}function i(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:ou(t.start),end:void 0}}function l(e){return t;function t(t){e&&e.call(this,t),c.call(this,t)}}function c(e,t){const n=this.stack.pop(),r=this.tokenStack.pop();if(!r)throw new Error("Cannot close `"+e.type+"` ("+Qi({start:e.start,end:e.end})+"): it’s not open");if(r[0].type!==e.type)if(t)t.call(this,e,r[0]);else{(r[1]||cu).call(this,e,r[0])}n.position.end=ou(e.end)}function u(){return gl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){this.stack[this.stack.length-2].start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function m(){const e=this.resume();this.stack[this.stack.length-1].lang=e}function p(){const e=this.resume();this.stack[this.stack.length-1].meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function x(){const e=this.resume();this.stack[this.stack.length-1].value=e.replace(/(\r?\n|\r)$/g,"")}function b(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Il(this.sliceSerialize(e)).toLowerCase()}function y(){const e=this.resume();this.stack[this.stack.length-1].title=e}function v(){const e=this.resume();this.stack[this.stack.length-1].url=e}function w(e){const t=this.stack[this.stack.length-1];if(!t.depth){const n=this.sliceSerialize(e).length;t.depth=n}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function N(e){this.stack[this.stack.length-1].depth=61===this.sliceSerialize(e).codePointAt(0)?1:2}function j(){this.data.setextHeadingSlurpLineEnding=void 0}function C(e){const t=this.stack[this.stack.length-1].children;let n=t[t.length-1];n&&"text"===n.type||(n=oe(),n.position={start:ou(e.start),end:void 0},t.push(n)),this.stack.push(n)}function S(e){const t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=ou(e.end)}function T(e){const n=this.stack[this.stack.length-1];if(this.data.atHardBreak){return n.children[n.children.length-1].position.end=ou(e.end),void(this.data.atHardBreak=void 0)}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(C.call(this,e),S.call(this,e))}function I(){this.data.atHardBreak=!0}function P(){const e=this.resume();this.stack[this.stack.length-1].value=e}function E(){const e=this.resume();this.stack[this.stack.length-1].value=e}function A(){const e=this.resume();this.stack[this.stack.length-1].value=e}function D(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function R(){const e=this.stack[this.stack.length-1];if(this.data.inReference){const t=this.data.referenceType||"shortcut";e.type+="Reference",e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function F(e){const t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=function(e){return e.replace(nu,ru)}(t),n.identifier=Il(t).toLowerCase()}function _(){const e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];if(this.data.inReference=!0,"link"===n.type){const t=e.children;n.children=t}else n.alt=t}function L(){const e=this.resume();this.stack[this.stack.length-1].url=e}function M(){const e=this.resume();this.stack[this.stack.length-1].title=e}function O(){this.data.inReference=void 0}function z(){this.data.referenceType="collapsed"}function B(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Il(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType="full"}function U(e){this.data.characterReferenceType=e.type}function $(e){const t=this.sliceSerialize(e),n=this.data.characterReferenceType;let r;if(n)r=Tl(t,"characterReferenceMarkerNumeric"===n?10:16),this.data.characterReferenceType=void 0;else{r=vl(t)}this.stack[this.stack.length-1].value+=r}function V(e){this.stack.pop().position.end=ou(e.end)}function q(e){S.call(this,e);this.stack[this.stack.length-1].url=this.sliceSerialize(e)}function H(e){S.call(this,e);this.stack[this.stack.length-1].url="mailto:"+this.sliceSerialize(e)}function W(){return{type:"blockquote",children:[]}}function Q(){return{type:"code",lang:null,meta:null,value:""}}function K(){return{type:"inlineCode",value:""}}function X(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function G(){return{type:"emphasis",children:[]}}function Y(){return{type:"heading",depth:0,children:[]}}function J(){return{type:"break"}}function Z(){return{type:"html",value:""}}function ee(){return{type:"image",title:null,url:"",alt:null}}function te(){return{type:"link",title:null,url:"",children:[]}}function ne(e){return{type:"list",ordered:"listOrdered"===e.type,start:null,spread:e._spread,children:[]}}function re(e){return{type:"listItem",spread:e._spread,checked:null,children:[]}}function ae(){return{type:"paragraph",children:[]}}function se(){return{type:"strong",children:[]}}function oe(){return{type:"text",value:""}}function ie(){return{type:"thematicBreak"}}}(n)(function(e){for(;!cc(e););return e}(function(e){const t={constructs:jl([Zc,...(e||{}).extensions||[]]),content:n(ql),defined:[],document:n(Hl),flow:n(zc),lazy:{},string:n(Uc),text:n($c)};return t;function n(e){return function(n){return eu(t,e,n)}}}(n).document().write(function(){let e,t=1,n="",r=!0;return function(a,s,o){const i=[];let l,c,u,d,f;for(a=n+("string"==typeof a?a.toString():new TextDecoder(s||void 0).decode(a)),u=0,n="",r&&(65279===a.charCodeAt(0)&&u++,r=void 0);u<a.length;){if(tu.lastIndex=u,l=tu.exec(a),d=l&&void 0!==l.index?l.index:a.length,f=a.charCodeAt(d),!l){n=a.slice(u);break}if(10===f&&u===d&&e)i.push(-3),e=void 0;else switch(e&&(i.push(-5),e=void 0),u<d&&(i.push(a.slice(u,d)),t+=d-u),f){case 0:i.push(65533),t++;break;case 9:for(c=4*Math.ceil(t/4),i.push(-2);t++<c;)i.push(-1);break;case 10:i.push(-4),t=1;break;default:e=!0,t=1}u=d+1}return o&&(e&&i.push(-5),n&&i.push(n),i.push(null)),i}}()(e,t,!0))))}function ou(e){return{line:e.line,column:e.column,offset:e.offset}}function iu(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?iu(e,r):lu(e,r)}}function lu(e,t){let n;for(n in t)if(au.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function cu(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Qi({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Qi({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Qi({start:t.start,end:t.end})+") is still open")}function uu(e){const t=this;t.parser=function(n){return su(n,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function du(e,t){const n=t.referenceType;let r="]";if("collapsed"===n?r+="[]":"full"===n&&(r+="["+(t.label||t.identifier)+"]"),"imageReference"===t.type)return[{type:"text",value:"!["+t.alt+r}];const a=e.all(t),s=a[0];s&&"text"===s.type?s.value="["+s.value:a.unshift({type:"text",value:"["});const o=a[a.length-1];return o&&"text"===o.type?o.value+=r:a.push({type:"text",value:r}),a}function fu(e){const t=e.spread;return null==t?e.children.length>1:t}function mu(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),a=0;const s=[];for(;r;)s.push(pu(t.slice(a,r.index),a>0,!0),r[0]),a=r.index+r[0].length,r=n.exec(t);return s.push(pu(t.slice(a),a>0,!1)),s.join("")}function pu(e,t,n){let r=0,a=e.length;if(t){let t=e.codePointAt(r);for(;9===t||32===t;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(a-1);for(;9===t||32===t;)a--,t=e.codePointAt(a-1)}return a>r?e.slice(r,a):""}const hu={blockquote:function(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)},break:function(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:"\n"}]},code:function(e,t){const n=t.value?t.value+"\n":"",r={};t.lang&&(r.className=["language-"+t.lang]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a},delete:function(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},emphasis:function(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},footnoteReference:function(e,t){const n="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),a=$l(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,i=e.footnoteCounts.get(r);void 0===i?(i=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,i+=1,e.footnoteCounts.set(r,i);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(i>1?"-"+i:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)},heading:function(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},html:function(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}},imageReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return du(e,t);const a={src:$l(r.url||""),alt:t.alt};null!==r.title&&void 0!==r.title&&(a.title=r.title);const s={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,s),e.applyData(t,s)},image:function(e,t){const n={src:$l(t.url)};null!==t.alt&&void 0!==t.alt&&(n.alt=t.alt),null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)},inlineCode:function(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)},linkReference:function(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return du(e,t);const a={href:$l(r.url||"")};null!==r.title&&void 0!==r.title&&(a.title=r.title);const s={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)},link:function(e,t){const n={href:$l(t.url)};null!==t.title&&void 0!==t.title&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)},listItem:function(e,t,n){const r=e.all(t),a=n?function(e){let t=!1;if("list"===e.type){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=fu(n[r])}return t}(n):fu(t),s={},o=[];if("boolean"==typeof t.checked){const e=r[0];let n;e&&"element"===e.type&&"p"===e.tagName?n=e:(n={type:"element",tagName:"p",properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:"text",value:" "}),n.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let i=-1;for(;++i<r.length;){const e=r[i];(a||0!==i||"element"!==e.type||"p"!==e.tagName)&&o.push({type:"text",value:"\n"}),"element"!==e.type||"p"!==e.tagName||a?o.push(e):o.push(...e.children)}const l=r[r.length-1];l&&(a||"element"!==l.type||"p"!==l.tagName)&&o.push({type:"text",value:"\n"});const c={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,c),e.applyData(t,c)},list:function(e,t){const n={},r=e.all(t);let a=-1;for("number"==typeof t.start&&1!==t.start&&(n.start=t.start);++a<r.length;){const e=r[a];if("element"===e.type&&"li"===e.tagName&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)},paragraph:function(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},root:function(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)},strong:function(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},table:function(e,t){const n=e.all(t),r=n.shift(),a=[];if(r){const n={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),a.push(n)}if(n.length>0){const r={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=Hi(t.children[1]),o=qi(t.children[t.children.length-1]);s&&o&&(r.position={start:s,end:o}),a.push(r)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,s),e.applyData(t,s)},tableCell:function(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)},tableRow:function(e,t,n){const r=n?n.children:void 0,a=0===(r?r.indexOf(t):1)?"th":"td",s=n&&"table"===n.type?n.align:void 0,o=s?s.length:t.children.length;let i=-1;const l=[];for(;++i<o;){const n=t.children[i],r={},o=s?s[i]:void 0;o&&(r.align=o);let c={type:"element",tagName:a,properties:r,children:[]};n&&(c.children=e.all(n),e.patch(n,c),c=e.applyData(n,c)),l.push(c)}const c={type:"element",tagName:"tr",properties:{},children:e.wrap(l,!0)};return e.patch(t,c),e.applyData(t,c)},text:function(e,t){const n={type:"text",value:mu(String(t.value))};return e.patch(t,n),e.applyData(t,n)},thematicBreak:function(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)},toml:gu,yaml:gu,definition:gu,footnoteDefinition:gu};function gu(){}const xu="object"==typeof self?self:globalThis,bu=e=>((e,t)=>{const n=(t,n)=>(e.set(n,t),t),r=a=>{if(e.has(a))return e.get(a);const[s,o]=t[a];switch(s){case 0:case-1:return n(o,a);case 1:{const e=n([],a);for(const t of o)e.push(r(t));return e}case 2:{const e=n({},a);for(const[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),a);case 4:{const{source:e,flags:t}=o;return n(new RegExp(e,t),a)}case 5:{const e=n(new Map,a);for(const[t,n]of o)e.set(r(t),r(n));return e}case 6:{const e=n(new Set,a);for(const t of o)e.add(r(t));return e}case 7:{const{name:e,message:t}=o;return n(new xu[e](t),a)}case 8:return n(BigInt(o),a);case"BigInt":return n(Object(BigInt(o)),a);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new xu[s](o),a)};return r})(new Map,e)(0),yu="",{toString:vu}={},{keys:wu}=Object,ku=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const n=vu.call(e).slice(8,-1);switch(n){case"Array":return[1,yu];case"Object":return[2,yu];case"Date":return[3,yu];case"RegExp":return[4,yu];case"Map":return[5,yu];case"Set":return[6,yu];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},Nu=([e,t])=>0===e&&("function"===t||"symbol"===t),ju=(e,{json:t,lossy:n}={})=>{const r=[];return((e,t,n,r)=>{const a=(e,t)=>{const a=r.push(e)-1;return n.set(t,a),a},s=r=>{if(n.has(r))return n.get(r);let[o,i]=ku(r);switch(o){case 0:{let t=r;switch(i){case"bigint":o=8,t=r.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+i);t=null;break;case"undefined":return a([-1],r)}return a([o,t],r)}case 1:{if(i){let e=r;return"DataView"===i?e=new Uint8Array(r.buffer):"ArrayBuffer"===i&&(e=new Uint8Array(r)),a([i,[...e]],r)}const e=[],t=a([o,e],r);for(const n of r)e.push(s(n));return t}case 2:{if(i)switch(i){case"BigInt":return a([i,r.toString()],r);case"Boolean":case"Number":case"String":return a([i,r.valueOf()],r)}if(t&&"toJSON"in r)return s(r.toJSON());const n=[],l=a([o,n],r);for(const t of wu(r))!e&&Nu(ku(r[t]))||n.push([s(t),s(r[t])]);return l}case 3:return a([o,r.toISOString()],r);case 4:{const{source:e,flags:t}=r;return a([o,{source:e,flags:t}],r)}case 5:{const t=[],n=a([o,t],r);for(const[a,o]of r)(e||!Nu(ku(a))&&!Nu(ku(o)))&&t.push([s(a),s(o)]);return n}case 6:{const t=[],n=a([o,t],r);for(const a of r)!e&&Nu(ku(a))||t.push(s(a));return n}}const{message:l}=r;return a([o,{name:i,message:l}],r)};return s})(!(t||n),!!t,new Map,r)(e),r};var Cu="function"==typeof structuredClone?(e,t)=>t&&("json"in t||"lossy"in t)?bu(ju(e,t)):structuredClone(e):(e,t)=>bu(ju(e,t));function Su(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function Tu(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}const Iu=function(e){if(null==e)return Eu;if("function"==typeof e)return Pu(e);if("object"==typeof e)return Array.isArray(e)?function(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Iu(e[n]);return Pu(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}(e):function(e){const t=e;return Pu(n);function n(n){const r=n;let a;for(a in e)if(r[a]!==t[a])return!1;return!0}}(e);if("string"==typeof e)return function(e){return Pu(t);function t(t){return t&&t.type===e}}(e);throw new Error("Expected function, string, or object as test")};function Pu(e){return function(t,n,r){return Boolean(function(e){return null!==e&&"object"==typeof e&&"type"in e}(t)&&e.call(this,t,"number"==typeof n?n:void 0,r||void 0))}}function Eu(){return!0}const Au=[],Du=!0,Ru=!1;function Fu(e,t,n,r){let a;"function"==typeof t&&"function"!=typeof n?(r=n,n=t):a=t;const s=Iu(a),o=r?-1:1;!function e(a,i,l){const c=a&&"object"==typeof a?a:{};if("string"==typeof c.type){const e="string"==typeof c.tagName?c.tagName:"string"==typeof c.name?c.name:void 0;Object.defineProperty(u,"name",{value:"node ("+a.type+(e?"<"+e+">":"")+")"})}return u;function u(){let c,u,d,f=Au;if((!t||s(a,i,l[l.length-1]||void 0))&&(f=function(e){if(Array.isArray(e))return e;if("number"==typeof e)return[Du,e];return null==e?Au:[e]}(n(a,l)),f[0]===Ru))return f;if("children"in a&&a.children){const t=a;if(t.children&&"skip"!==f[0])for(u=(r?t.children.length:-1)+o,d=l.concat(t);u>-1&&u<t.children.length;){const n=t.children[u];if(c=e(n,u,d)(),c[0]===Ru)return c;u="number"==typeof c[1]?c[1]:u+o}}return f}}(e,void 0,[])()}function _u(e,t,n,r){let a,s,o;"function"==typeof t&&"function"!=typeof n?(s=void 0,o=t,a=n):(s=t,o=n,a=r),Fu(e,s,function(e,t){const n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)},a)}const Lu={}.hasOwnProperty,Mu={};function Ou(e,t){e.position&&(t.position=function(e){const t=Hi(e),n=qi(e);if(t&&n)return{start:t,end:n}}(e))}function zu(e,t){let n=t;if(e&&e.data){const t=e.data.hName,r=e.data.hChildren,a=e.data.hProperties;if("string"==typeof t)if("element"===n.type)n.tagName=t;else{n={type:"element",tagName:t,properties:{},children:"children"in n?n.children:[n]}}"element"===n.type&&a&&Object.assign(n.properties,Cu(a)),"children"in n&&n.children&&null!=r&&(n.children=r)}return n}function Bu(e,t){const n=t.data||{},r=!("value"in t)||Lu.call(n,"hProperties")||Lu.call(n,"hChildren")?{type:"element",tagName:"div",properties:{},children:e.all(t)}:{type:"text",value:t.value};return e.patch(t,r),e.applyData(t,r)}function Uu(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:"\n"});++r<e.length;)r&&n.push({type:"text",value:"\n"}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:"\n"}),n}function $u(e){let t=0,n=e.charCodeAt(t);for(;9===n||32===n;)t++,n=e.charCodeAt(t);return e.slice(t)}function Vu(e,t){const n=function(e,t){const n=t||Mu,r=new Map,a=new Map,s=new Map,o={...hu,...n.handlers},i={all:function(e){const t=[];if("children"in e){const n=e.children;let r=-1;for(;++r<n.length;){const a=i.one(n[r],e);if(a){if(r&&"break"===n[r-1].type&&(Array.isArray(a)||"text"!==a.type||(a.value=$u(a.value)),!Array.isArray(a)&&"element"===a.type)){const e=a.children[0];e&&"text"===e.type&&(e.value=$u(e.value))}Array.isArray(a)?t.push(...a):t.push(a)}}}return t},applyData:zu,definitionById:r,footnoteById:a,footnoteCounts:s,footnoteOrder:[],handlers:o,one:function(e,t){const n=e.type,r=i.handlers[n];if(Lu.call(i.handlers,n)&&r)return r(i,e,t);if(i.options.passThrough&&i.options.passThrough.includes(n)){if("children"in e){const{children:t,...n}=e,r=Cu(n);return r.children=i.all(e),r}return Cu(e)}return(i.options.unknownHandler||Bu)(i,e,t)},options:n,patch:Ou,wrap:Uu};return _u(e,function(e){if("definition"===e.type||"footnoteDefinition"===e.type){const t="definition"===e.type?r:a,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),i}(e,t),r=n.one(e,void 0),a=function(e){const t="string"==typeof e.options.clobberPrefix?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Su,r=e.options.footnoteBackLabel||Tu,a=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},i=[];let l=-1;for(;++l<e.footnoteOrder.length;){const a=e.footnoteById.get(e.footnoteOrder[l]);if(!a)continue;const s=e.all(a),o=String(a.identifier).toUpperCase(),c=$l(o.toLowerCase());let u=0;const d=[],f=e.footnoteCounts.get(o);for(;void 0!==f&&++u<=f;){d.length>0&&d.push({type:"text",value:" "});let e="string"==typeof n?n:n(l,u);"string"==typeof e&&(e={type:"text",value:e}),d.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+c+(u>1?"-"+u:""),dataFootnoteBackref:"",ariaLabel:"string"==typeof r?r:r(l,u),className:["data-footnote-backref"]},children:Array.isArray(e)?e:[e]})}const m=s[s.length-1];if(m&&"element"===m.type&&"p"===m.tagName){const e=m.children[m.children.length-1];e&&"text"===e.type?e.value+=" ":m.children.push({type:"text",value:" "}),m.children.push(...d)}else s.push(...d);const p={type:"element",tagName:"li",properties:{id:t+"fn-"+c},children:e.wrap(s,!0)};e.patch(a,p),i.push(p)}if(0!==i.length)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Cu(o),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:"\n"},{type:"element",tagName:"ol",properties:{},children:e.wrap(i,!0)},{type:"text",value:"\n"}]}}(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return a&&s.children.push({type:"text",value:"\n"},a),s}function qu(e,t){return e&&"run"in e?async function(n,r){const a=Vu(n,{file:r,...t});await e.run(a,r)}:function(n,r){return Vu(n,{file:r,...e||t})}}function Hu(e){if(e)throw e}var Wu,Qu;var Ku=function(){if(Qu)return Wu;Qu=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},s=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,a=e.call(n,"constructor"),s=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!a&&!s)return!1;for(r in n);return void 0===r||e.call(n,r)},o=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},i=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Wu=function e(){var t,n,r,l,c,u,d=arguments[0],f=1,m=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},f=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});f<m;++f)if(null!=(t=arguments[f]))for(n in t)r=i(d,n),d!==(l=i(t,n))&&(p&&l&&(s(l)||(c=a(l)))?(c?(c=!1,u=r&&a(r)?r:[]):u=r&&s(r)?r:{},o(d,{name:n,newValue:e(p,u,l)})):void 0!==l&&o(d,{name:n,newValue:l}));return d},Wu}(),Xu=ae(Ku);function Gu(e){if("object"!=typeof e||null===e)return!1;const t=Object.getPrototypeOf(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)}function Yu(){const e=[],t={run:function(...t){let n=-1;const r=t.pop();if("function"!=typeof r)throw new TypeError("Expected function as last argument, not "+r);!function a(s,...o){const i=e[++n];let l=-1;if(s)r(s);else{for(;++l<t.length;)null!==o[l]&&void 0!==o[l]||(o[l]=t[l]);t=o,i?function(e,t){let n;return r;function r(...t){const r=e.length>t.length;let i;r&&t.push(a);try{i=e.apply(this,t)}catch(s){if(r&&n)throw s;return a(s)}r||(i&&i.then&&"function"==typeof i.then?i.then(o,a):i instanceof Error?a(i):o(i))}function a(e,...r){n||(n=!0,t(e,...r))}function o(e){a(null,e)}}(i,a)(...o):r(null,...o)}}(null,...t)},use:function(n){if("function"!=typeof n)throw new TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}};return t}const Ju={basename:function(e,t){if(void 0!==t&&"string"!=typeof t)throw new TypeError('"ext" argument must be a string');Zu(e);let n,r=0,a=-1,s=e.length;if(void 0===t||0===t.length||t.length>e.length){for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else a<0&&(n=!0,a=s+1);return a<0?"":e.slice(r,a)}if(t===e)return"";let o=-1,i=t.length-1;for(;s--;)if(47===e.codePointAt(s)){if(n){r=s+1;break}}else o<0&&(n=!0,o=s+1),i>-1&&(e.codePointAt(s)===t.codePointAt(i--)?i<0&&(a=s):(i=-1,a=o));r===a?a=o:a<0&&(a=e.length);return e.slice(r,a)},dirname:function(e){if(Zu(e),0===e.length)return".";let t,n=-1,r=e.length;for(;--r;)if(47===e.codePointAt(r)){if(t){n=r;break}}else t||(t=!0);return n<0?47===e.codePointAt(0)?"/":".":1===n&&47===e.codePointAt(0)?"//":e.slice(0,n)},extname:function(e){Zu(e);let t,n=e.length,r=-1,a=0,s=-1,o=0;for(;n--;){const i=e.codePointAt(n);if(47!==i)r<0&&(t=!0,r=n+1),46===i?s<0?s=n:1!==o&&(o=1):s>-1&&(o=-1);else if(t){a=n+1;break}}if(s<0||r<0||0===o||1===o&&s===r-1&&s===a+1)return"";return e.slice(s,r)},join:function(...e){let t,n=-1;for(;++n<e.length;)Zu(e[n]),e[n]&&(t=void 0===t?e[n]:t+"/"+e[n]);return void 0===t?".":function(e){Zu(e);const t=47===e.codePointAt(0);let n=function(e,t){let n,r,a="",s=0,o=-1,i=0,l=-1;for(;++l<=e.length;){if(l<e.length)n=e.codePointAt(l);else{if(47===n)break;n=47}if(47===n){if(o===l-1||1===i);else if(o!==l-1&&2===i){if(a.length<2||2!==s||46!==a.codePointAt(a.length-1)||46!==a.codePointAt(a.length-2))if(a.length>2){if(r=a.lastIndexOf("/"),r!==a.length-1){r<0?(a="",s=0):(a=a.slice(0,r),s=a.length-1-a.lastIndexOf("/")),o=l,i=0;continue}}else if(a.length>0){a="",s=0,o=l,i=0;continue}t&&(a=a.length>0?a+"/..":"..",s=2)}else a.length>0?a+="/"+e.slice(o+1,l):a=e.slice(o+1,l),s=l-o-1;o=l,i=0}else 46===n&&i>-1?i++:i=-1}return a}(e,!t);0!==n.length||t||(n=".");n.length>0&&47===e.codePointAt(e.length-1)&&(n+="/");return t?"/"+n:n}(t)},sep:"/"};function Zu(e){if("string"!=typeof e)throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const ed={cwd:function(){return"/"}};function td(e){return Boolean(null!==e&&"object"==typeof e&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&void 0===e.auth)}function nd(e){if("string"==typeof e)e=new URL(e);else if(!td(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if("file:"!==e.protocol){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return function(e){if(""!==e.hostname){const e=new TypeError('File URL host must be "localhost" or empty on darwin');throw e.code="ERR_INVALID_FILE_URL_HOST",e}const t=e.pathname;let n=-1;for(;++n<t.length;)if(37===t.codePointAt(n)&&50===t.codePointAt(n+1)){const e=t.codePointAt(n+2);if(70===e||102===e){const e=new TypeError("File URL path must not include encoded / characters");throw e.code="ERR_INVALID_FILE_URL_PATH",e}}return decodeURIComponent(t)}(e)}const rd=["history","path","basename","stem","extname","dirname"];class ad{constructor(e){let t;t=e?td(e)?{path:e}:"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)?{value:e}:e:{},this.cwd="cwd"in t?"":ed.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n,r=-1;for(;++r<rd.length;){const e=rd[r];e in t&&void 0!==t[e]&&null!==t[e]&&(this[e]="history"===e?[...t[e]]:t[e])}for(n in t)rd.includes(n)||(this[n]=t[n])}get basename(){return"string"==typeof this.path?Ju.basename(this.path):void 0}set basename(e){od(e,"basename"),sd(e,"basename"),this.path=Ju.join(this.dirname||"",e)}get dirname(){return"string"==typeof this.path?Ju.dirname(this.path):void 0}set dirname(e){id(this.basename,"dirname"),this.path=Ju.join(e||"",this.basename)}get extname(){return"string"==typeof this.path?Ju.extname(this.path):void 0}set extname(e){if(sd(e,"extname"),id(this.dirname,"extname"),e){if(46!==e.codePointAt(0))throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ju.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){td(e)&&(e=nd(e)),od(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return"string"==typeof this.path?Ju.basename(this.path,this.extname):void 0}set stem(e){od(e,"stem"),sd(e,"stem"),this.path=Ju.join(this.dirname||"",e+(this.extname||""))}fail(e,t,n){const r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){const r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){const r=new Yi(e,t,n);return this.path&&(r.name=this.path+":"+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){if(void 0===this.value)return"";if("string"==typeof this.value)return this.value;return new TextDecoder(e||void 0).decode(this.value)}}function sd(e,t){if(e&&e.includes(Ju.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ju.sep+"`")}function od(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function id(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}const ld=function(e){const t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r},cd={}.hasOwnProperty;class ud extends ld{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Yu()}copy(){const e=new ud;let t=-1;for(;++t<this.attachers.length;){const n=this.attachers[t];e.use(...n)}return e.data(Xu(!0,{},this.namespace)),e}data(e,t){return"string"==typeof e?2===arguments.length?(pd("data",this.frozen),this.namespace[e]=t,this):cd.call(this.namespace,e)&&this.namespace[e]||void 0:e?(pd("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[t,...n]=this.attachers[this.freezeIndex];if(!1===n[0])continue;!0===n[0]&&(n[0]=void 0);const r=t.call(e,...n);"function"==typeof r&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const t=xd(e),n=this.parser||this.Parser;return fd("parse",n),n(String(t),t)}process(e,t){const n=this;return this.freeze(),fd("process",this.parser||this.Parser),md("process",this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,a){const s=xd(e),o=n.parse(s);function i(e,n){e||!n?a(e):r?r(n):t(void 0,n)}n.run(o,s,function(e,t,r){if(e||!t||!r)return i(e);const a=t,s=n.stringify(a,r);!function(e){return"string"==typeof e||function(e){return Boolean(e&&"object"==typeof e&&"byteLength"in e&&"byteOffset"in e)}(e)}(s)?r.result=s:r.value=s,i(e,r)})}}processSync(e){let t,n=!1;return this.freeze(),fd("processSync",this.parser||this.Parser),md("processSync",this.compiler||this.Compiler),this.process(e,function(e,r){n=!0,Hu(e),t=r}),gd("processSync","process",n),t}run(e,t,n){hd(e),this.freeze();const r=this.transformers;return n||"function"!=typeof t||(n=t,t=void 0),n?a(void 0,n):new Promise(a);function a(a,s){const o=xd(t);r.run(e,o,function(t,r,o){const i=r||e;t?s(t):a?a(i):n(void 0,i,o)})}}runSync(e,t){let n,r=!1;return this.run(e,t,function(e,t){Hu(e),n=t,r=!0}),gd("runSync","run",r),n}stringify(e,t){this.freeze();const n=xd(t),r=this.compiler||this.Compiler;return md("stringify",r),hd(e),r(e,n)}use(e,...t){const n=this.attachers,r=this.namespace;if(pd("use",this.frozen),null==e);else if("function"==typeof e)i(e,t);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");Array.isArray(e)?o(e):s(e)}return this;function a(e){if("function"==typeof e)i(e,[]);else{if("object"!=typeof e)throw new TypeError("Expected usable value, not `"+e+"`");if(Array.isArray(e)){const[t,...n]=e;i(t,n)}else s(e)}}function s(e){if(!("plugins"in e)&&!("settings"in e))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=Xu(!0,r.settings,e.settings))}function o(e){let t=-1;if(null==e);else{if(!Array.isArray(e))throw new TypeError("Expected a list of plugins, not `"+e+"`");for(;++t<e.length;){a(e[t])}}}function i(e,t){let r=-1,a=-1;for(;++r<n.length;)if(n[r][0]===e){a=r;break}if(-1===a)n.push([e,...t]);else if(t.length>0){let[r,...s]=t;const o=n[a][1];Gu(o)&&Gu(r)&&(r=Xu(!0,o,r)),n[a]=[e,r,...s]}}}}const dd=(new ud).freeze();function fd(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `parser`")}function md(e,t){if("function"!=typeof t)throw new TypeError("Cannot `"+e+"` without `compiler`")}function pd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function hd(e){if(!Gu(e)||"string"!=typeof e.type)throw new TypeError("Expected node, got `"+e+"`")}function gd(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function xd(e){return function(e){return Boolean(e&&"object"==typeof e&&"message"in e&&"messages"in e)}(e)?e:new ad(e)}const bd=[],yd={allowDangerousHtml:!0},vd=/^(https?|ircs?|mailto|xmpp)$/i,wd=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function kd(e){const t=function(e){const t=e.rehypePlugins||bd,n=e.remarkPlugins||bd,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...yd}:yd,a=dd().use(uu).use(n).use(qu,r).use(t);return a}(e),n=function(e){const t=e.children||"",n=new ad;"string"==typeof t&&(n.value=t);return n}(e);return function(e,t){const n=t.allowedElements,r=t.allowElement,a=t.components,s=t.disallowedElements,o=t.skipHtml,i=t.unwrapDisallowed,l=t.urlTransform||Nd;for(const u of wd)Object.hasOwn(t,u.from)&&Ho((u.from,u.to&&u.to,u.id));return _u(e,c),al(e,{Fragment:fe.Fragment,components:a,ignoreInvalidStyle:!0,jsx:fe.jsx,jsxs:fe.jsxs,passKeys:!0,passNode:!0});function c(e,t,a){if("raw"===e.type&&a&&"number"==typeof t)return o?a.children.splice(t,1):a.children[t]={type:"text",value:e.value},t;if("element"===e.type){let t;for(t in pl)if(Object.hasOwn(pl,t)&&Object.hasOwn(e.properties,t)){const n=e.properties[t],r=pl[t];(null===r||r.includes(e.tagName))&&(e.properties[t]=l(String(n||""),t,e))}}if("element"===e.type){let o=n?!n.includes(e.tagName):!!s&&s.includes(e.tagName);if(!o&&r&&"number"==typeof t&&(o=!r(e,t,a)),o&&a&&"number"==typeof t)return i&&e.children?a.children.splice(t,1,...e.children):a.children.splice(t,1),t}}}(t.runSync(t.parse(n),n),e)}function Nd(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),a=e.indexOf("/");return-1===t||-1!==a&&t>a||-1!==n&&t>n||-1!==r&&t>r||vd.test(e.slice(0,t))?e:""}function jd(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,a=n.indexOf(t);for(;-1!==a;)r++,a=n.indexOf(t,a+t.length);return r}function Cd(e,t,n){const r=Iu((n||{}).ignore||[]),a=function(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const e=n[r];t.push([Sd(e[0]),Td(e[1])])}return t}(t);let s=-1;for(;++s<a.length;)Fu(e,"text",o);function o(e,t){let n,o=-1;for(;++o<t.length;){const e=t[o],a=n?n.children:void 0;if(r(e,a?a.indexOf(e):void 0,n))return;n=e}if(n)return function(e,t){const n=t[t.length-1],r=a[s][0],o=a[s][1];let i=0;const l=n.children.indexOf(e);let c=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){const n=d.index,a={index:d.index,input:d.input,stack:[...t,e]};let s=o(...d,a);if("string"==typeof s&&(s=s.length>0?{type:"text",value:s}:void 0),!1===s?r.lastIndex=n+1:(i!==n&&u.push({type:"text",value:e.value.slice(i,n)}),Array.isArray(s)?u.push(...s):s&&u.push(s),i=n+d[0].length,c=!0),!r.global)break;d=r.exec(e.value)}c?(i<e.value.length&&u.push({type:"text",value:e.value.slice(i)}),n.children.splice(l,1,...u)):u=[e];return l+u.length}(e,t)}}function Sd(e){return"string"==typeof e?new RegExp(function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e}function Td(e){return"function"==typeof e?e:function(){return e}}const Id="phrasing",Pd=["autolink","link","image","label"];function Ed(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Ad(e){this.config.enter.autolinkProtocol.call(this,e)}function Dd(e){this.config.exit.autolinkProtocol.call(this,e)}function Rd(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function Fd(e){this.config.exit.autolinkEmail.call(this,e)}function _d(e){this.exit(e)}function Ld(e){Cd(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Md],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Od]],{ignore:["link","linkReference"]})}function Md(e,t,n,r,a){let s="";if(!zd(a))return!1;if(/^w/i.test(t)&&(n=t+n,t="",s="http://"),!function(e){const t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}(n))return!1;const o=function(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=jd(e,"(");let s=jd(e,")");for(;-1!==r&&a>s;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[e,n]}(n+r);if(!o[0])return!1;const i={type:"link",title:null,url:s+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[i,{type:"text",value:o[1]}]:i}function Od(e,t,n,r){return!(!zd(r,!0)||/[-\d_]$/.test(n))&&{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function zd(e,t){const n=e.input.charCodeAt(e.index-1);return(0===e.index||Bl(n)||zl(n))&&(!t||47!==n)}function Bd(){this.buffer()}function Ud(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function $d(){this.buffer()}function Vd(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function qd(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Il(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hd(e){this.exit(e)}function Wd(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Il(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Qd(e){this.exit(e)}function Kd(e,t,n,r){const a=n.createTracker(r);let s=a.move("[^");const o=n.enter("footnoteReference"),i=n.enter("reference");return s+=a.move(n.safe(n.associationId(e),{after:"]",before:s})),i(),o(),s+=a.move("]"),s}function Xd(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:function(e,n,r,a){const s=r.createTracker(a);let o=s.move("[^");const i=r.enter("footnoteDefinition"),l=r.enter("label");o+=s.move(r.safe(r.associationId(e),{before:o,after:"]"})),l(),o+=s.move("]:"),e.children&&e.children.length>0&&(s.shift(4),o+=s.move((t?"\n":" ")+r.indentLines(r.containerFlow(e,s.current()),t?Yd:Gd)));return i(),o},footnoteReference:Kd},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}}function Gd(e,t,n){return 0===t?e:Yd(e,t,n)}function Yd(e,t,n){return(n?"":" ")+e}Kd.peek=function(){return"["};const Jd=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function Zd(e){this.enter({type:"delete",children:[]},e)}function ef(e){this.exit(e)}function tf(e,t,n,r){const a=n.createTracker(r),s=n.enter("strikethrough");let o=a.move("~~");return o+=n.containerPhrasing(e,{...a.current(),before:o,after:"~"}),o+=a.move("~~"),s(),o}function nf(e){return e.length}function rf(e){return null==e?"":String(e)}function af(e){const t="string"==typeof e?e.codePointAt(0):0;return 67===t||99===t?99:76===t||108===t?108:82===t||114===t?114:0}function sf(e,t,n){return">"+(n?"":" ")+e}function of(e,t){return lf(e,t.inConstruct,!0)&&!lf(e,t.notInConstruct,!1)}function lf(e,t,n){if("string"==typeof t&&(t=[t]),!t||0===t.length)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function cf(e,t,n,r){let a=-1;for(;++a<n.unsafe.length;)if("\n"===n.unsafe[a].character&&of(n.stack,n.unsafe[a]))return/[ \t]/.test(r.before)?"":" ";return"\\\n"}function uf(e,t,n){return(n?"":" ")+e}function df(e){const t=e.options.quote||'"';if('"'!==t&&"'"!==t)throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ff(e){return"&#x"+e.toString(16).toUpperCase()+";"}function mf(e,t,n){const r=Ql(e),a=Ql(t);return void 0===r?void 0===a?"_"===n?{inside:!0,outside:!0}:{inside:!1,outside:!1}:1===a?{inside:!0,outside:!0}:{inside:!1,outside:!0}:1===r?void 0===a?{inside:!1,outside:!1}:1===a?{inside:!0,outside:!0}:{inside:!1,outside:!1}:void 0===a?{inside:!1,outside:!1}:1===a?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function pf(e,t,n,r){const a=function(e){const t=e.options.emphasis||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}(n),s=n.enter("emphasis"),o=n.createTracker(r),i=o.move(a);let l=o.move(n.containerPhrasing(e,{after:a,before:i,...o.current()}));const c=l.charCodeAt(0),u=mf(r.before.charCodeAt(r.before.length-1),c,a);u.inside&&(l=ff(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=mf(r.after.charCodeAt(0),d,a);f.inside&&(l=l.slice(0,-1)+ff(d));const m=o.move(a);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},i+l+m}function hf(e){return e.value||""}function gf(e,t,n,r){const a=df(n),s='"'===a?"Quote":"Apostrophe",o=n.enter("image");let i=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),i(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(i=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(i=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),i(),e.title&&(i=n.enter(`title${s}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),i()),c+=l.move(")"),o(),c}function xf(e,t,n,r){const a=e.referenceType,s=n.enter("imageReference");let o=n.enter("label");const i=n.createTracker(r);let l=i.move("![");const c=n.safe(e.alt,{before:l,after:"]",...i.current()});l+=i.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...i.current()});return o(),n.stack=u,s(),"full"!==a&&c&&c===d?"shortcut"===a?l=l.slice(0,-1):l+=i.move("]"):l+=i.move(d+"]"),l}function bf(e,t,n){let r=e.value||"",a="`",s=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(r);)a+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const e=n.unsafe[s],t=n.compilePattern(e);let a;if(e.atBreak)for(;a=t.exec(r);){let e=a.index;10===r.charCodeAt(e)&&13===r.charCodeAt(e-1)&&e--,r=r.slice(0,e)+" "+r.slice(a.index+1)}}return a+r+a}function yf(e,t){const n=gl(e);return Boolean(!t.options.resourceLink&&e.url&&!e.title&&e.children&&1===e.children.length&&"text"===e.children[0].type&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}function vf(e,t,n,r){const a=df(n),s='"'===a?"Quote":"Apostrophe",o=n.createTracker(r);let i,l;if(yf(e,n)){const t=n.stack;n.stack=[],i=n.enter("autolink");let r=o.move("<");return r+=o.move(n.containerPhrasing(e,{before:r,after:">",...o.current()})),r+=o.move(">"),i(),n.stack=t,r}i=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${s}`),c+=o.move(" "+a),c+=o.move(n.safe(e.title,{before:c,after:a,...o.current()})),c+=o.move(a),l()),c+=o.move(")"),i(),c}function wf(e,t,n,r){const a=e.referenceType,s=n.enter("linkReference");let o=n.enter("label");const i=n.createTracker(r);let l=i.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...i.current()});l+=i.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...i.current()});return o(),n.stack=u,s(),"full"!==a&&c&&c===d?"shortcut"===a?l=l.slice(0,-1):l+=i.move("]"):l+=i.move(d+"]"),l}function kf(e){const t=e.options.bullet||"*";if("*"!==t&&"+"!==t&&"-"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Nf(e){const t=e.options.rule||"*";if("*"!==t&&"-"!==t&&"_"!==t)throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}tf.peek=function(){return"~"},pf.peek=function(e,t,n){return n.options.emphasis||"*"},hf.peek=function(){return"<"},gf.peek=function(){return"!"},xf.peek=function(){return"!"},bf.peek=function(){return"`"},vf.peek=function(e,t,n){return yf(e,n)?"<":"["},wf.peek=function(){return"["};const jf=Iu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Cf(e,t,n,r){const a=function(e){const t=e.options.strong||"*";if("*"!==t&&"_"!==t)throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}(n),s=n.enter("strong"),o=n.createTracker(r),i=o.move(a+a);let l=o.move(n.containerPhrasing(e,{after:a,before:i,...o.current()}));const c=l.charCodeAt(0),u=mf(r.before.charCodeAt(r.before.length-1),c,a);u.inside&&(l=ff(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=mf(r.after.charCodeAt(0),d,a);f.inside&&(l=l.slice(0,-1)+ff(d));const m=o.move(a+a);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},i+l+m}Cf.peek=function(e,t,n){return n.options.strong||"*"};const Sf={blockquote:function(e,t,n,r){const a=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(e,s.current()),sf);return a(),o},break:cf,code:function(e,t,n,r){const a=function(e){const t=e.options.fence||"`";if("`"!==t&&"~"!==t)throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}(n),s=e.value||"",o="`"===a?"GraveAccent":"Tilde";if(function(e,t){return Boolean(!1===t.options.fences&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}(e,n)){const e=n.enter("codeIndented"),t=n.indentLines(s,uf);return e(),t}const i=n.createTracker(r),l=a.repeat(Math.max(function(e,t){const n=String(e);let r=n.indexOf(t),a=r,s=0,o=0;if("string"!=typeof t)throw new TypeError("Expected substring");for(;-1!==r;)r===a?++s>o&&(o=s):s=1,a=r+t.length,r=n.indexOf(t,a);return o}(s,a)+1,3)),c=n.enter("codeFenced");let u=i.move(l);if(e.lang){const t=n.enter(`codeFencedLang${o}`);u+=i.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...i.current()})),t()}if(e.lang&&e.meta){const t=n.enter(`codeFencedMeta${o}`);u+=i.move(" "),u+=i.move(n.safe(e.meta,{before:u,after:"\n",encode:["`"],...i.current()})),t()}return u+=i.move("\n"),s&&(u+=i.move(s+"\n")),u+=i.move(l),c(),u},definition:function(e,t,n,r){const a=df(n),s='"'===a?"Quote":"Apostrophe",o=n.enter("definition");let i=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),i(),!e.url||/[\0- \u007F]/.test(e.url)?(i=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(i=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":"\n",...l.current()}))),i(),e.title&&(i=n.enter(`title${s}`),c+=l.move(" "+a),c+=l.move(n.safe(e.title,{before:c,after:a,...l.current()})),c+=l.move(a),i()),o(),c},emphasis:pf,hardBreak:cf,heading:function(e,t,n,r){const a=Math.max(Math.min(6,e.depth||1),1),s=n.createTracker(r);if(function(e,t){let n=!1;return _u(e,function(e){if("value"in e&&/\r?\n|\r/.test(e.value)||"break"===e.type)return n=!0,Ru}),Boolean((!e.depth||e.depth<3)&&gl(e)&&(t.options.setext||n))}(e,n)){const t=n.enter("headingSetext"),r=n.enter("phrasing"),o=n.containerPhrasing(e,{...s.current(),before:"\n",after:"\n"});return r(),t(),o+"\n"+(1===a?"=":"-").repeat(o.length-(Math.max(o.lastIndexOf("\r"),o.lastIndexOf("\n"))+1))}const o="#".repeat(a),i=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:"\n",...s.current()});return/^[\t ]/.test(c)&&(c=ff(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),i(),c},html:hf,image:gf,imageReference:xf,inlineCode:bf,link:vf,linkReference:wf,list:function(e,t,n,r){const a=n.enter("list"),s=n.bulletCurrent;let o=e.ordered?function(e){const t=e.options.bulletOrdered||".";if("."!==t&&")"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}(n):kf(n);const i=e.ordered?"."===o?")":".":function(e){const t=kf(e),n=e.options.bulletOther;if(!n)return"*"===t?"-":"*";if("*"!==n&&"+"!==n&&"-"!==n)throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}(n);let l=!(!t||!n.bulletLastUsed)&&o===n.bulletLastUsed;if(!e.ordered){const t=e.children?e.children[0]:void 0;if("*"!==o&&"-"!==o||!t||t.children&&t.children[0]||"list"!==n.stack[n.stack.length-1]||"listItem"!==n.stack[n.stack.length-2]||"list"!==n.stack[n.stack.length-3]||"listItem"!==n.stack[n.stack.length-4]||0!==n.indexStack[n.indexStack.length-1]||0!==n.indexStack[n.indexStack.length-2]||0!==n.indexStack[n.indexStack.length-3]||(l=!0),Nf(n)===o&&t){let t=-1;for(;++t<e.children.length;){const n=e.children[t];if(n&&"listItem"===n.type&&n.children&&n.children[0]&&"thematicBreak"===n.children[0].type){l=!0;break}}}}l&&(o=i),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=s,a(),c},listItem:function(e,t,n,r){const a=function(e){const t=e.options.listItemIndent||"one";if("tab"!==t&&"one"!==t&&"mixed"!==t)throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}(n);let s=n.bulletCurrent||kf(n);t&&"list"===t.type&&t.ordered&&(s=("number"==typeof t.start&&t.start>-1?t.start:1)+(!1===n.options.incrementListMarker?0:t.children.indexOf(e))+s);let o=s.length+1;("tab"===a||"mixed"===a&&(t&&"list"===t.type&&t.spread||e.spread))&&(o=4*Math.ceil(o/4));const i=n.createTracker(r);i.move(s+" ".repeat(o-s.length)),i.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,i.current()),function(e,t,n){if(t)return(n?"":" ".repeat(o))+e;return(n?s:s+" ".repeat(o-s.length))+e});return l(),c},paragraph:function(e,t,n,r){const a=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(e,r);return s(),a(),o},root:function(e,t,n,r){return(e.children.some(function(e){return jf(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)},strong:Cf,text:function(e,t,n,r){return n.safe(e.value,r)},thematicBreak:function(e,t,n){const r=(Nf(n)+(n.options.ruleSpaces?" ":"")).repeat(function(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}(n));return n.options.ruleSpaces?r.slice(0,-1):r}};function Tf(e){const t=e._align;this.enter({type:"table",align:t.map(function(e){return"none"===e?null:e}),children:[]},e),this.data.inTable=!0}function If(e){this.exit(e),this.data.inTable=void 0}function Pf(e){this.enter({type:"tableRow",children:[]},e)}function Ef(e){this.exit(e)}function Af(e){this.enter({type:"tableCell",children:[]},e)}function Df(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Rf));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Rf(e,t){return"|"===t?t:e}function Ff(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,a=t.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[\t :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(e,t,n){let r=Sf.inlineCode(e,t,n);n.stack.includes("tableCell")&&(r=r.replace(/\|/g,"\\$&"));return r},table:function(e,t,n,r){return i(function(e,t,n){const r=e.children;let a=-1;const s=[],o=t.enter("table");for(;++a<r.length;)s[a]=l(r[a],t,n);return o(),s}(e,n,r),e.align)},tableCell:o,tableRow:function(e,t,n,r){const a=l(e,n,r),s=i([a]);return s.slice(0,s.indexOf("\n"))}}};function o(e,t,n,r){const a=n.enter("tableCell"),o=n.enter("phrasing"),i=n.containerPhrasing(e,{...r,before:s,after:s});return o(),a(),i}function i(e,t){return function(e,t){const n=t||{},r=(n.align||[]).concat(),a=n.stringLength||nf,s=[],o=[],i=[],l=[];let c=0,u=-1;for(;++u<e.length;){const t=[],r=[];let s=-1;for(e[u].length>c&&(c=e[u].length);++s<e[u].length;){const o=rf(e[u][s]);if(!1!==n.alignDelimiters){const e=a(o);r[s]=e,(void 0===l[s]||e>l[s])&&(l[s]=e)}t.push(o)}o[u]=t,i[u]=r}let d=-1;if("object"==typeof r&&"length"in r)for(;++d<c;)s[d]=af(r[d]);else{const e=af(r);for(;++d<c;)s[d]=e}d=-1;const f=[],m=[];for(;++d<c;){const e=s[d];let t="",r="";99===e?(t=":",r=":"):108===e?t=":":114===e&&(r=":");let a=!1===n.alignDelimiters?1:Math.max(1,l[d]-t.length-r.length);const o=t+"-".repeat(a)+r;!1!==n.alignDelimiters&&(a=t.length+a+r.length,a>l[d]&&(l[d]=a),m[d]=a),f[d]=o}o.splice(1,0,f),i.splice(1,0,m),u=-1;const p=[];for(;++u<o.length;){const e=o[u],t=i[u];d=-1;const r=[];for(;++d<c;){const a=e[d]||"";let o="",i="";if(!1!==n.alignDelimiters){const e=l[d]-(t[d]||0),n=s[d];114===n?o=" ".repeat(e):99===n?e%2?(o=" ".repeat(e/2+.5),i=" ".repeat(e/2-.5)):(o=" ".repeat(e/2),i=o):i=" ".repeat(e)}!1===n.delimiterStart||d||r.push("|"),!1===n.padding||!1===n.alignDelimiters&&""===a||!1===n.delimiterStart&&!d||r.push(" "),!1!==n.alignDelimiters&&r.push(o),r.push(a),!1!==n.alignDelimiters&&r.push(i),!1!==n.padding&&r.push(" "),!1===n.delimiterEnd&&d===c-1||r.push("|")}p.push(!1===n.delimiterEnd?r.join("").replace(/ +$/,""):r.join(""))}return p.join("\n")}(e,{align:t,alignDelimiters:r,padding:n,stringLength:a})}function l(e,t,n){const r=e.children;let a=-1;const s=[],i=t.enter("tableRow");for(;++a<r.length;)s[a]=o(r[a],0,t,n);return i(),s}}function _f(e){const t=this.stack[this.stack.length-2];t.type,t.checked="taskListCheckValueChecked"===e.type}function Lf(e){const t=this.stack[this.stack.length-2];if(t&&"listItem"===t.type&&"boolean"==typeof t.checked){const e=this.stack[this.stack.length-1];e.type;const n=e.children[0];if(n&&"text"===n.type){const r=t.children;let a,s=-1;for(;++s<r.length;){const e=r[s];if("paragraph"===e.type){a=e;break}}a===e&&(n.value=n.value.slice(1),0===n.value.length?e.children.shift():e.position&&n.position&&"number"==typeof n.position.start.offset&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Mf(e,t,n,r){const a=e.children[0],s="boolean"==typeof e.checked&&a&&"paragraph"===a.type,o="["+(e.checked?"x":" ")+"] ",i=n.createTracker(r);s&&i.move(o);let l=Sf.listItem(e,t,n,{...r,...i.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(e){return e+o})),l}const Of={tokenize:function(e,t,n){let r=0;return function t(s){if((87===s||119===s)&&r<3)return r++,e.consume(s),t;if(46===s&&3===r)return e.consume(s),a;return n(s)};function a(e){return null===e?n(e):t(e)}},partial:!0},zf={tokenize:function(e,t,n){let r,a,s;return o;function o(t){return 46===t||95===t?e.check(Uf,l,i)(t):null===t||Ml(t)||Bl(t)||45!==t&&zl(t)?l(t):(s=!0,e.consume(t),o)}function i(t){return 95===t?r=!0:(a=r,r=void 0),e.consume(t),o}function l(e){return a||r||!s?n(e):t(e)}},partial:!0},Bf={tokenize:function(e,t){let n=0,r=0;return a;function a(o){return 40===o?(n++,e.consume(o),a):41===o&&r<n?s(o):33===o||34===o||38===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||60===o||63===o||93===o||95===o||126===o?e.check(Uf,t,s)(o):null===o||Ml(o)||Bl(o)?t(o):(e.consume(o),a)}function s(t){return 41===t&&r++,e.consume(t),a}},partial:!0},Uf={tokenize:function(e,t,n){return r;function r(o){return 33===o||34===o||39===o||41===o||42===o||44===o||46===o||58===o||59===o||63===o||95===o||126===o?(e.consume(o),r):38===o?(e.consume(o),s):93===o?(e.consume(o),a):60===o||null===o||Ml(o)||Bl(o)?t(o):n(o)}function a(e){return null===e||40===e||91===e||Ml(e)||Bl(e)?t(e):r(e)}function s(e){return Pl(e)?o(e):n(e)}function o(t){return 59===t?(e.consume(t),r):Pl(t)?(e.consume(t),o):n(t)}},partial:!0},$f={tokenize:function(e,t,n){return function(t){return e.consume(t),r};function r(e){return El(e)?n(e):t(e)}},partial:!0},Vf={name:"wwwAutolink",tokenize:function(e,t,n){const r=this;return function(t){if(87!==t&&119!==t||!Kf.call(r,r.previous)||Jf(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Of,e.attempt(zf,e.attempt(Bf,a),n),n)(t)};function a(n){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(n)}},previous:Kf},qf={name:"protocolAutolink",tokenize:function(e,t,n){const r=this;let a="",s=!1;return function(t){if((72===t||104===t)&&Xf.call(r,r.previous)&&!Jf(r.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(t),e.consume(t),o;return n(t)};function o(t){if(Pl(t)&&a.length<5)return a+=String.fromCodePoint(t),e.consume(t),o;if(58===t){const n=a.toLowerCase();if("http"===n||"https"===n)return e.consume(t),i}return n(t)}function i(t){return 47===t?(e.consume(t),s?l:(s=!0,i)):n(t)}function l(t){return null===t||Dl(t)||Ml(t)||Bl(t)||zl(t)?n(t):e.attempt(zf,e.attempt(Bf,c),n)(t)}function c(n){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(n)}},previous:Xf},Hf={name:"emailAutolink",tokenize:function(e,t,n){const r=this;let a,s;return function(t){if(!Yf(t)||!Gf.call(r,r.previous)||Jf(r.events))return n(t);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),o(t)};function o(t){return Yf(t)?(e.consume(t),o):64===t?(e.consume(t),i):n(t)}function i(t){return 46===t?e.check($f,c,l)(t):45===t||95===t||El(t)?(s=!0,e.consume(t),i):c(t)}function l(t){return e.consume(t),a=!0,i}function c(o){return s&&a&&Pl(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(o)):n(o)}},previous:Gf},Wf={};let Qf=48;for(;Qf<123;)Wf[Qf]=Hf,Qf++,58===Qf?Qf=65:91===Qf&&(Qf=97);function Kf(e){return null===e||40===e||42===e||95===e||91===e||93===e||126===e||Ml(e)}function Xf(e){return!Pl(e)}function Gf(e){return!(47===e||Yf(e))}function Yf(e){return 43===e||45===e||46===e||95===e||El(e)}function Jf(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if(("labelLink"===r.type||"labelImage"===r.type)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}Wf[43]=Hf,Wf[45]=Hf,Wf[46]=Hf,Wf[95]=Hf,Wf[72]=[Hf,qf],Wf[104]=[Hf,qf],Wf[87]=[Hf,Vf],Wf[119]=[Hf,Vf];const Zf={tokenize:function(e,t,n){const r=this;return Vl(e,function(e){const a=r.events[r.events.length-1];return a&&"gfmFootnoteDefinitionIndent"===a[1].type&&4===a[2].sliceSerialize(a[1],!0).length?t(e):n(e)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function em(e,t,n){const r=this;let a=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;a--;){const e=r.events[a][1];if("labelImage"===e.type){o=e;break}if("gfmFootnoteCall"===e.type||"labelLink"===e.type||"label"===e.type||"image"===e.type||"link"===e.type)break}return function(a){if(!o||!o._balanced)return n(a);const i=Il(r.sliceSerialize({start:o.end,end:r.now()}));if(94!==i.codePointAt(0)||!s.includes(i.slice(1)))return n(a);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(a),e.exit("gfmFootnoteCallLabelMarker"),t(a)}}function tm(e,t){let n=e.length;for(;n--;)if("labelImage"===e[n][1].type&&"enter"===e[n][0]){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},i=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...i),e}function nm(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0;return function(t){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(t),e.exit("gfmFootnoteCallLabelMarker"),i};function i(t){return 94!==t?n(t):(e.enter("gfmFootnoteCallMarker"),e.consume(t),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",l)}function l(i){if(o>999||93===i&&!s||null===i||91===i||Ml(i))return n(i);if(93===i){e.exit("chunkString");const s=e.exit("gfmFootnoteCallString");return a.includes(Il(r.sliceSerialize(s)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(i),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(i)}return Ml(i)||(s=!0),o++,e.consume(i),92===i?c:l}function c(t){return 91===t||92===t||93===t?(e.consume(t),o++,l):l(t)}}function rm(e,t,n){const r=this,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o,i=0;return function(t){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),l};function l(t){return 94===t?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(t)}function c(t){if(i>999||93===t&&!o||null===t||91===t||Ml(t))return n(t);if(93===t){e.exit("chunkString");const n=e.exit("gfmFootnoteDefinitionLabelString");return s=Il(r.sliceSerialize(n)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(t),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return Ml(t)||(o=!0),i++,e.consume(t),92===t?u:c}function u(t){return 91===t||92===t||93===t?(e.consume(t),i++,c):c(t)}function d(t){return 58===t?(e.enter("definitionMarker"),e.consume(t),e.exit("definitionMarker"),a.includes(s)||a.push(s),Vl(e,f,"gfmFootnoteDefinitionWhitespace")):n(t)}function f(e){return t(e)}}function am(e,t,n){return e.check(Jl,t,e.attempt(Zf,t,n))}function sm(e){e.exit("gfmFootnoteDefinition")}function om(e){let t=(e||{}).singleTilde;const n={name:"strikethrough",tokenize:function(e,n,r){const a=this.previous,s=this.events;let o=0;return function(t){if(126===a&&"characterEscape"!==s[s.length-1][1].type)return r(t);return e.enter("strikethroughSequenceTemporary"),i(t)};function i(s){const l=Ql(a);if(126===s)return o>1?r(s):(e.consume(s),o++,i);if(o<2&&!t)return r(s);const c=e.exit("strikethroughSequenceTemporary"),u=Ql(s);return c._open=!u||2===u&&Boolean(l),c._close=!l||2===l&&Boolean(u),n(s)}},resolveAll:function(e,t){let n=-1;for(;++n<e.length;)if("enter"===e[n][0]&&"strikethroughSequenceTemporary"===e[n][1].type&&e[n][1]._close){let r=n;for(;r--;)if("exit"===e[r][0]&&"strikethroughSequenceTemporary"===e[r][1].type&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type="strikethroughSequence",e[r][1].type="strikethroughSequence";const a={type:"strikethrough",start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},s={type:"strikethroughText",start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[["enter",a,t],["enter",e[r][1],t],["exit",e[r][1],t],["enter",s,t]],i=t.parser.constructs.insideSpan.null;i&&wl(o,o.length,0,Kl(i,e.slice(r+1,n),t)),wl(o,o.length,0,[["exit",s,t],["enter",e[n][1],t],["exit",e[n][1],t],["exit",a,t]]),wl(e,r-1,n-r+3,o),n=r+o.length-2;break}}n=-1;for(;++n<e.length;)"strikethroughSequenceTemporary"===e[n][1].type&&(e[n][1].type="data");return e}};return null==t&&(t=!0),{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}}}class im{constructor(){this.map=[]}add(e,t,n){!function(e,t,n,r){let a=0;if(0===n&&0===r.length)return;for(;a<e.map.length;){if(e.map[a][0]===t)return e.map[a][1]+=n,void e.map[a][2].push(...r);a+=1}e.map.push([t,n,r])}(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),0===this.map.length)return;let t=this.map.length;const n=[];for(;t>0;)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(const t of r)e.push(t);r=n.pop()}this.map.length=0}}function lm(e,t){let n=!1;const r=[];for(;t<e.length;){const a=e[t];if(n){if("enter"===a[0])"tableContent"===a[1].type&&r.push("tableDelimiterMarker"===e[t+1][1].type?"left":"none");else if("tableContent"===a[1].type){if("tableDelimiterMarker"===e[t-1][1].type){const e=r.length-1;r[e]="left"===r[e]?"center":"right"}}else if("tableDelimiterRow"===a[1].type)break}else"enter"===a[0]&&"tableDelimiterRow"===a[1].type&&(n=!0);t+=1}return r}function cm(e,t,n){const r=this;let a,s=0,o=0;return function(e){let t=r.events.length-1;for(;t>-1;){const e=r.events[t][1].type;if("lineEnding"!==e&&"linePrefix"!==e)break;t--}const a=t>-1?r.events[t][1].type:null,s="tableHead"===a||"tableRow"===a?v:i;if(s===v&&r.parser.lazy[r.now().line])return n(e);return s(e)};function i(t){return e.enter("tableHead"),e.enter("tableRow"),function(e){if(124===e)return l(e);return a=!0,o+=1,l(e)}(t)}function l(t){return null===t?n(t):Ll(t)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(t),e.exit("lineEnding"),d):n(t):Ol(t)?Vl(e,l,"whitespace")(t):(o+=1,a&&(a=!1,s+=1),124===t?(e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),a=!0,l):(e.enter("data"),c(t)))}function c(t){return null===t||124===t||Ml(t)?(e.exit("data"),l(t)):(e.consume(t),92===t?u:c)}function u(t){return 92===t||124===t?(e.consume(t),c):c(t)}function d(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter("tableDelimiterRow"),a=!1,Ol(t)?Vl(e,f,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(t):f(t))}function f(t){return 45===t||58===t?p(t):124===t?(a=!0,e.enter("tableCellDivider"),e.consume(t),e.exit("tableCellDivider"),m):y(t)}function m(t){return Ol(t)?Vl(e,p,"whitespace")(t):p(t)}function p(t){return 58===t?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),h):45===t?(o+=1,h(t)):null===t||Ll(t)?b(t):y(t)}function h(t){return 45===t?(e.enter("tableDelimiterFiller"),g(t)):y(t)}function g(t){return 45===t?(e.consume(t),g):58===t?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(t),e.exit("tableDelimiterMarker"),x):(e.exit("tableDelimiterFiller"),x(t))}function x(t){return Ol(t)?Vl(e,b,"whitespace")(t):b(t)}function b(n){return 124===n?f(n):(null===n||Ll(n))&&a&&s===o?(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(n)):y(n)}function y(e){return n(e)}function v(t){return e.enter("tableRow"),w(t)}function w(n){return 124===n?(e.enter("tableCellDivider"),e.consume(n),e.exit("tableCellDivider"),w):null===n||Ll(n)?(e.exit("tableRow"),t(n)):Ol(n)?Vl(e,w,"whitespace")(n):(e.enter("data"),k(n))}function k(t){return null===t||124===t||Ml(t)?(e.exit("data"),w(t)):(e.consume(t),92===t?N:k)}function N(t){return 92===t||124===t?(e.consume(t),k):k(t)}}function um(e,t){let n,r,a,s=-1,o=!0,i=0,l=[0,0,0,0],c=[0,0,0,0],u=!1,d=0;const f=new im;for(;++s<e.length;){const m=e[s],p=m[1];"enter"===m[0]?"tableHead"===p.type?(u=!1,0!==d&&(fm(f,t,d,n,r),r=void 0,d=0),n={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(s,0,[["enter",n,t]])):"tableRow"===p.type||"tableDelimiterRow"===p.type?(o=!0,a=void 0,l=[0,0,0,0],c=[0,s+1,0,0],u&&(u=!1,r={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(s,0,[["enter",r,t]])),i="tableDelimiterRow"===p.type?2:r?3:1):!i||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type?"tableCellDivider"===p.type&&(o?o=!1:(0!==l[1]&&(c[0]=c[1],a=dm(f,t,l,i,void 0,a)),l=c,c=[l[1],s,0,0])):(o=!1,0===c[2]&&(0!==l[1]&&(c[0]=c[1],a=dm(f,t,l,i,void 0,a),l=[0,0,0,0]),c[2]=s)):"tableHead"===p.type?(u=!0,d=s):"tableRow"===p.type||"tableDelimiterRow"===p.type?(d=s,0!==l[1]?(c[0]=c[1],a=dm(f,t,l,i,s,a)):0!==c[1]&&(a=dm(f,t,c,i,s,a)),i=0):!i||"data"!==p.type&&"tableDelimiterMarker"!==p.type&&"tableDelimiterFiller"!==p.type||(c[3]=s)}for(0!==d&&fm(f,t,d,n,r),f.consume(t.events),s=-1;++s<t.events.length;){const e=t.events[s];"enter"===e[0]&&"table"===e[1].type&&(e[1]._align=lm(t.events,s))}return e}function dm(e,t,n,r,a,s){const o=1===r?"tableHeader":2===r?"tableDelimiter":"tableData";0!==n[0]&&(s.end=Object.assign({},mm(t.events,n[0])),e.add(n[0],0,[["exit",s,t]]));const i=mm(t.events,n[1]);if(s={type:o,start:Object.assign({},i),end:Object.assign({},i)},e.add(n[1],0,[["enter",s,t]]),0!==n[2]){const a=mm(t.events,n[2]),s=mm(t.events,n[3]),o={type:"tableContent",start:Object.assign({},a),end:Object.assign({},s)};if(e.add(n[2],0,[["enter",o,t]]),2!==r){const r=t.events[n[2]],a=t.events[n[3]];if(r[1].end=Object.assign({},a[1].end),r[1].type="chunkText",r[1].contentType="text",n[3]>n[2]+1){const t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[["exit",o,t]])}return void 0!==a&&(s.end=Object.assign({},mm(t.events,a)),e.add(a,0,[["exit",s,t]]),s=void 0),s}function fm(e,t,n,r,a){const s=[],o=mm(t.events,n);a&&(a.end=Object.assign({},o),s.push(["exit",a,t])),r.end=Object.assign({},o),s.push(["exit",r,t]),e.add(n+1,0,s)}function mm(e,t){const n=e[t],r="enter"===n[0]?"start":"end";return n[1][r]}const pm={name:"tasklistCheck",tokenize:function(e,t,n){const r=this;return function(t){if(null!==r.previous||!r._gfmTasklistFirstContentOfListItem)return n(t);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),a};function a(t){return Ml(t)?(e.enter("taskListCheckValueUnchecked"),e.consume(t),e.exit("taskListCheckValueUnchecked"),s):88===t||120===t?(e.enter("taskListCheckValueChecked"),e.consume(t),e.exit("taskListCheckValueChecked"),s):n(t)}function s(t){return 93===t?(e.enter("taskListCheckMarker"),e.consume(t),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),o):n(t)}function o(r){return Ll(r)?t(r):Ol(r)?e.check({tokenize:hm},t,n)(r):n(r)}}};function hm(e,t,n){return Vl(e,function(e){return null===e?n(e):t(e)},"whitespace")}const gm={};function xm(e){const t=e||gm,n=this.data(),r=n.micromarkExtensions||(n.micromarkExtensions=[]),a=n.fromMarkdownExtensions||(n.fromMarkdownExtensions=[]),s=n.toMarkdownExtensions||(n.toMarkdownExtensions=[]);r.push(function(e){return jl([{text:Wf},{document:{91:{name:"gfmFootnoteDefinition",tokenize:rm,continuation:{tokenize:am},exit:sm}},text:{91:{name:"gfmFootnoteCall",tokenize:nm},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:em,resolveTo:tm}}},om(e),{flow:{null:{name:"table",tokenize:cm,resolveAll:um}}},{text:{91:pm}}])}(t)),a.push([{transforms:[Ld],enter:{literalAutolink:Ed,literalAutolinkEmail:Ad,literalAutolinkHttp:Ad,literalAutolinkWww:Ad},exit:{literalAutolink:_d,literalAutolinkEmail:Fd,literalAutolinkHttp:Dd,literalAutolinkWww:Rd}},{enter:{gfmFootnoteCallString:Bd,gfmFootnoteCall:Ud,gfmFootnoteDefinitionLabelString:$d,gfmFootnoteDefinition:Vd},exit:{gfmFootnoteCallString:qd,gfmFootnoteCall:Hd,gfmFootnoteDefinitionLabelString:Wd,gfmFootnoteDefinition:Qd}},{canContainEols:["delete"],enter:{strikethrough:Zd},exit:{strikethrough:ef}},{enter:{table:Tf,tableData:Af,tableHeader:Af,tableRow:Pf},exit:{codeText:Df,table:If,tableData:Ef,tableHeader:Ef,tableRow:Ef}},{exit:{taskListCheckValueChecked:_f,taskListCheckValueUnchecked:_f,paragraph:Lf}}]),s.push(function(e){return{extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Id,notInConstruct:Pd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Id,notInConstruct:Pd},{character:":",before:"[ps]",after:"\\/",inConstruct:Id,notInConstruct:Pd}]},Xd(e),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Jd}],handlers:{delete:tf}},Ff(e),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Mf}}]}}(t))}function bm({content:e,className:t}){return fe.jsx("div",{className:pe("prose prose-sm max-w-none",t),children:fe.jsx(kd,{remarkPlugins:[xm],components:{h1:({children:e})=>fe.jsx("h1",{className:"text-lg font-bold mt-4 mb-2 text-foreground",children:e}),h2:({children:e})=>fe.jsx("h2",{className:"text-base font-bold mt-3 mb-2 text-foreground",children:e}),h3:({children:e})=>fe.jsx("h3",{className:"text-sm font-semibold mt-2 mb-1 text-foreground",children:e}),p:({children:e})=>fe.jsx("p",{className:"text-sm mb-2 last:mb-0 text-foreground",children:e}),ul:({children:e})=>fe.jsx("ul",{className:"list-disc list-inside mb-2 space-y-1",children:e}),ol:({children:e})=>fe.jsx("ol",{className:"list-decimal list-inside mb-2 space-y-1",children:e}),li:({children:e})=>fe.jsx("li",{className:"text-sm text-foreground",children:e}),code:({inline:e,children:t,...n})=>e?fe.jsx("code",{className:"bg-muted px-1.5 py-0.5 rounded text-xs font-mono text-foreground",...n,children:t}):fe.jsx("code",{className:"block bg-muted p-2 rounded text-xs font-mono overflow-x-auto mb-2 text-foreground",...n,children:t}),pre:({children:e})=>fe.jsx("pre",{className:"bg-muted p-2 rounded overflow-x-auto mb-2",children:e}),a:({children:e,href:t})=>fe.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:text-primary/80",children:e}),blockquote:({children:e})=>fe.jsx("blockquote",{className:"border-l-4 border-primary pl-3 italic my-2 text-muted-foreground",children:e}),strong:({children:e})=>fe.jsx("strong",{className:"font-bold text-foreground",children:e}),em:({children:e})=>fe.jsx("em",{className:"italic text-foreground",children:e})},children:e})})}function ym({open:t,onOpenChange:n,placeId:r,placeName:a,onMakeManager:s,onMakeMembers:o,currentManagerId:l,currentMemberIds:c=[]}){const[u,d]=e.useState([]),[f,m]=e.useState(!1),[p,h]=e.useState(""),{data:g=[],isLoading:x}=zr({enabled:t}),b=e.useMemo(()=>{let e=[...g];if(e.sort((e,t)=>{const n=e.userName?.toLowerCase()||"",r=t.userName?.toLowerCase()||"";return n.localeCompare(r)}),p){const t=p.toLowerCase();e=e.filter(e=>e.userName?.toLowerCase().includes(t)||e.userEmail?.toLowerCase().includes(t))}return e},[g,p]),y=e=>{d(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},v=1===u.length,w=u.length>0;return fe.jsx(Ie,{open:t,onOpenChange:n,children:fe.jsxs(Re,{className:"max-w-2xl",children:[fe.jsx(Fe,{children:fe.jsxs(Le,{className:"flex items-center gap-2",children:[fe.jsx(i.Users,{className:"h-5 w-5"}),"Gerenciar Acessos - ",a]})}),fe.jsxs("div",{className:"relative",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),fe.jsx(ye,{placeholder:"Buscar por nome ou email...",value:p,onChange:e=>h(e.target.value),className:"pl-9"})]}),fe.jsx(Rr,{className:"h-[400px] pr-4",children:x?fe.jsx("div",{className:"space-y-2",children:[...Array(5)].map((e,t)=>fe.jsx(Mt,{className:"h-16 w-full"},t))}):0===b.length?fe.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[fe.jsx(i.Users,{className:"h-12 w-12 text-muted-foreground/50 mb-3"}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:p?"Nenhum usuário encontrado":"Nenhum usuário disponível"})]}):fe.jsx("div",{className:"space-y-2",children:b.map(e=>{const t=e.userId===l,n=c.includes(e.userId||""),r=u.includes(e.userId||"");return fe.jsxs("div",{className:pe("flex items-center gap-3 p-3 rounded-lg border transition-colors",r&&"bg-accent border-primary","hover:bg-accent/50 cursor-pointer"),onClick:()=>y(e.userId||""),children:[fe.jsx(rt,{checked:r,onCheckedChange:()=>y(e.userId||""),onClick:e=>e.stopPropagation()}),fe.jsxs("div",{className:"flex-1",children:[fe.jsxs("div",{className:"flex items-center gap-2",children:[fe.jsx("p",{className:"font-medium",children:e.userName}),t&&fe.jsx(i.Crown,{className:"h-4 w-4 text-yellow-500"})]}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:e.userEmail})]}),(t||n)&&fe.jsx("div",{className:"text-xs text-muted-foreground",children:t?"Gestor":"Membro"})]},e.userId)})})}),fe.jsxs(_e,{className:"flex gap-2 sm:gap-2",children:[fe.jsx("div",{className:"flex-1 text-sm text-muted-foreground",children:u.length>0&&fe.jsxs("span",{children:[u.length," selecionado(s)"]})}),v&&s&&fe.jsxs(xe,{onClick:async()=>{if(s&&1===u.length){m(!0);try{await s(u[0],r),d([])}finally{m(!1)}}},disabled:f,variant:"outline",children:[fe.jsx(i.Crown,{className:"h-4 w-4 mr-2"}),"Tornar Gestor"]}),w&&o&&fe.jsxs(xe,{onClick:async()=>{if(o&&0!==u.length){m(!0);try{await o(u,r),d([])}finally{m(!1)}}},disabled:f,children:[fe.jsx(i.UserPlus,{className:"h-4 w-4 mr-2"}),"Tornar ",u.length>1?"Membros":"Membro"]})]})]})})}function vm({place:t,level:n=0,manageAccessConfig:r}){const[a,s]=e.useState(!1),[o,l]=e.useState(!1),c=t.subPlaces&&t.subPlaces.length>0,u=t.isActive??!0,d=t.usersCount??0;return fe.jsxs("div",{children:[fe.jsxs(Fa,{open:a,onOpenChange:s,children:[fe.jsxs("div",{className:"flex items-center gap-2 py-3 px-4 hover:bg-accent/50 transition-colors",style:{paddingLeft:2*n+1+"rem"},children:[c?fe.jsxs(_a,{className:"flex items-center gap-2 flex-1",children:[fe.jsx(i.ChevronRight,{className:pe("h-4 w-4 transition-transform shrink-0",a&&"rotate-90")}),fe.jsx(i.Building2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),fe.jsx("span",{className:"font-medium",children:t.name}),fe.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",t.subPlaces.length,")"]})]}):fe.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[fe.jsx("div",{className:"w-4 shrink-0"}),fe.jsx(i.Building2,{className:"h-4 w-4 text-muted-foreground shrink-0"}),fe.jsx("span",{className:"font-medium",children:t.name})]}),fe.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[fe.jsxs("div",{className:"flex items-center gap-1.5",children:[fe.jsx(i.Users,{className:"h-3.5 w-3.5 text-muted-foreground"}),fe.jsx("span",{className:"text-sm text-muted-foreground",children:d})]}),fe.jsx(ot,{variant:u?"default":"secondary",className:"text-xs",children:u?"Ativo":"Inativo"}),r&&fe.jsx(xo,{customActions:[{label:"Gerenciar Acessos",icon:i.Settings,onClick:()=>l(!0),variant:"default"}],renderAs:"dropdown",variant:"compact"})]})]}),c&&fe.jsx(La,{children:t.subPlaces.map(e=>fe.jsx(vm,{place:e,level:n+1,manageAccessConfig:r},e.id))})]}),0===n&&fe.jsx(Ya,{}),r&&fe.jsx(ym,{open:o,onOpenChange:l,placeId:t.id,placeName:t.name,onMakeManager:r.onMakeManager,onMakeMembers:r.onMakeMembers,currentManagerId:r.getCurrentManagerId?.(t.id),currentMemberIds:r.getCurrentMemberIds?.(t.id)})]})}var wm=Object.defineProperty,km=(e,t,n)=>((e,t,n)=>t in e?wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n)(e,t+"",n);const Nm=new class{constructor(){km(this,"baseUrl",(void 0).VITE_QUALIEX_API_URL)}async makeApiCall(e,t,n){const r=fn.validateToken();if(!r.valid)throw new Error(r.message||"Token inválido");const a=Kt.getAccessToken();if(!a)throw new Error("Token Qualiex não encontrado");if(!n||""===n.trim())throw new Error("Alias da unidade é obrigatório");const s=new URL(e,this.baseUrl);Object.entries(t).forEach(([e,t])=>{s.searchParams.append(e,t)});const o=await fetch(s.toString(),{method:"GET",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json",Accept:"application/json","un-alias":n}});if(!o.ok){const e=new Error(`API call failed: ${o.status}`);throw e.status=o.status,e}return o.json()}buildHierarchy(e){const t=new Map,n=[];return e.forEach(e=>{t.set(e.id,{...e,subPlaces:[]})}),e.forEach(e=>{const r=t.get(e.id);if(e.parentId){const a=t.get(e.parentId);a?(a.subPlaces=a.subPlaces||[],a.subPlaces.push(r)):n.push(r)}else n.push(r)}),n}async getPlaces(e,t){try{const n=await this.makeApiCall("/api/common/v1/places",{companyId:t},e),r=n.data||n||[];return this.buildHierarchy(r)}catch(n){if(await fn.handleApiError(n))try{const n=await this.makeApiCall("/api/common/v1/places",{companyId:t},e),r=n.data||n||[];return this.buildHierarchy(r)}catch(r){return Yt.handleError(r instanceof Error?r:"Erro ao buscar locais após renovação de token",!0),[]}return Yt.handleError(n instanceof Error?n.message:"Erro ao buscar locais",!0),[]}}};Object.defineProperty(exports,"sonnerToast",{enumerable:!0,get:function(){return o.toast}}),exports.AUTH_CONFIG=gn,exports.Accordion=la,exports.AccordionContent=da,exports.AccordionItem=ca,exports.AccordionTrigger=ua,exports.ActionButton=be,exports.ActionMenu=xo,exports.ActionMenuItems=Sr,exports.Alert=na,exports.AlertDescription=aa,exports.AlertDialog=Un,exports.AlertDialogAction=Gn,exports.AlertDialogCancel=Yn,exports.AlertDialogContent=Hn,exports.AlertDialogDescription=Xn,exports.AlertDialogFooter=Qn,exports.AlertDialogHeader=Wn,exports.AlertDialogOverlay=qn,exports.AlertDialogPortal=Vn,exports.AlertDialogTitle=Kn,exports.AlertDialogTrigger=$n,exports.AlertTitle=ra,exports.AppHeader=Co,exports.AppLayout=Mo,exports.AppSidebar=Lo,exports.AspectRatio=fa,exports.AuthErrorInterceptor=un,exports.AuthProvider=({children:t})=>{const[n,r]=e.useState({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null});let a=null;try{a=g.useQueryClient()}catch{}const[s,o]=e.useState(!1),[i,l]=e.useState(0),c=e.useCallback(e=>{r(t=>({...t,...e}))},[]),u=e.useCallback(e=>{r(t=>({...t,isLoading:e}))},[]),d=e.useCallback(()=>{r({user:null,companies:[],alias:null,isAuthenticated:!1,isLoading:!0,selectedUnit:null,userId:null,userAlias:null,placeId:null,placeName:null,activePlaceId:null,activePlaceName:null})},[]),f=e.useCallback(async e=>{try{u(!0);const r=Kt.getAccessToken();if(!r)return;const s=await sn.generateToken(r,e.alias,void 0,!0);if(!s)return;Kt.setSupabaseToken(s),Kt.setSelectedAlias(e.alias);const o=Kt.extractTokenData(),i=o?.alias||e.alias,l=o?.companyId||Kt.getCompanyId(e.alias),d={id:l||e.id,name:e.name,alias:i};let f=null,m=null;if(n.user?.id&&i&&l)try{const e=(await hn.fetchActiveUsersMap(i,l)).get(n.user.id);if(e){const t=_n(e);f=t.placeId,m=t.placeName}}catch(t){}c({alias:i,selectedUnit:d,placeId:f,placeName:m,activePlaceId:f,activePlaceName:m}),a&&(await a.clear(),await new Promise(e=>setTimeout(e,100)))}catch(t){}finally{u(!1)}},[c,a,u,n.user]),m=e.useCallback(async()=>await Mn.processCallback(),[]),p=e.useCallback(async()=>{Mn.logout(),d(),a&&await a.clear()},[d,a]),h=e.useCallback(e=>{o(e)},[]),x=e.useCallback(()=>{l(e=>e+1)},[]),b=e.useCallback(()=>{l(e=>e+1)},[]);e.useEffect(()=>{if(!n.isAuthenticated)return;let e=!0;const t=setInterval(()=>{e&&(Kt.areAllTokensValid()||e&&p())},6e5);return()=>{e=!1,clearInterval(t)}},[n.isAuthenticated,p]),e.useEffect(()=>{let e=!0;return(async()=>{try{if(await new Promise(e=>setTimeout(e,100)),!e)return;const t=await Mn.initialize();if(!e)return;t&&t.isAuthenticated?c({user:t.user,companies:t.companies,alias:t.alias,isAuthenticated:!0,isLoading:!1,selectedUnit:t.selectedUnit,userId:t.userId,userAlias:t.userAlias,placeId:t.placeId,placeName:t.placeName,activePlaceId:t.activePlaceId,activePlaceName:t.activePlaceName}):e&&u(!1)}catch(t){e&&(un.handleError(t),u(!1))}})(),()=>{e=!1}},[c,u,p]);const y=e.useMemo(()=>({...n,logout:p,processCallback:m,switchUnit:f,availableUnits:n.companies,isSearchVisible:s,setSearchVisible:h,clearSearch:x,refreshData:b}),[n.user,n.companies,n.alias,n.isAuthenticated,n.isLoading,n.selectedUnit,n.userId,n.userAlias,n.placeId,n.placeName,n.activePlaceId,n.activePlaceName,p,m,f,s,h,x,b]);return fe.jsx(On.Provider,{value:y,children:t})},exports.AuthService=Mn,exports.Avatar=ma,exports.AvatarFallback=ha,exports.AvatarImage=pa,exports.Badge=ot,exports.BaseForm=Ur,exports.Breadcrumb=ga,exports.BreadcrumbEllipsis=ka,exports.BreadcrumbItem=ba,exports.BreadcrumbLink=ya,exports.BreadcrumbList=xa,exports.BreadcrumbPage=va,exports.BreadcrumbSeparator=wa,exports.BulkActionBar=qr,exports.Button=xe,exports.CRUD_CONFIG=xn,exports.Calendar=Ra,exports.CallbackPage=()=>{const{processCallback:t}=zn(),[n,r]=e.useState(null),[a,s]=e.useState(!1);e.useEffect(()=>{(async()=>{try{if(await t()){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){r(e?.message||"Erro durante a autenticação. Tente novamente.")}})()},[t]);const o=async()=>{s(!0),r(null);try{await t()||r("Falha na autenticação. Tente novamente.")}catch(e){r(e?.message||"Erro ao tentar novamente.")}finally{s(!1)}},l=()=>{window.location.href="/"};return n?fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsxs(je,{className:"text-xl font-semibold text-destructive flex items-center justify-center gap-2",children:[fe.jsx(i.AlertCircle,{className:"h-5 w-5"}),"Erro na Autenticação"]})}),fe.jsxs(Se,{className:"space-y-4",children:[fe.jsx(na,{variant:"destructive",children:fe.jsx(aa,{children:n})}),fe.jsx("div",{className:"text-sm text-muted-foreground",children:fe.jsx("p",{children:"Se o problema persistir, verifique se a URL de callback está configurada corretamente no provedor OAuth."})}),fe.jsxs("div",{className:"flex gap-2",children:[fe.jsx(xe,{onClick:o,disabled:a,className:"flex-1",children:a?fe.jsxs(fe.Fragment,{children:[fe.jsx(lt,{size:"sm",className:"mr-2"}),"Tentando..."]}):fe.jsxs(fe.Fragment,{children:[fe.jsx(i.RefreshCw,{className:"h-4 w-4 mr-2"}),"Tentar Novamente"]})}),fe.jsx(xe,{onClick:l,variant:"outline",className:"flex-1",children:"Voltar ao Início"})]})]})]})}):fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Processando Autenticação"})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"flex justify-center mb-4",children:fe.jsx(lt,{size:"lg"})}),fe.jsx("p",{className:"text-muted-foreground",children:"Processando tokens e redirecionando..."})]})]})})},exports.Card=ke,exports.CardContent=Se,exports.CardDescription=Ce,exports.CardFooter=Te,exports.CardHeader=Ne,exports.CardSkeleton=lr,exports.CardTitle=je,exports.Cards=function({data:e,renderCard:t,isLoading:n=!1,emptyMessage:r="Nenhum item encontrado",columns:a,gap:s="md",className:o}){return n?fe.jsx(Ba,{cols:a?String(a):"auto-fit",gap:s,className:o,children:[...Array(6)].map((e,t)=>fe.jsx(Mt,{className:"h-48 w-full"},t))}):0===e.length?fe.jsx("div",{className:"flex items-center justify-center p-8",children:fe.jsx("div",{className:"text-center text-muted-foreground",children:fe.jsx("p",{children:r})})}):fe.jsx(Ba,{cols:a?String(a):"auto-fit",gap:s,className:o,children:e.map(t)})},exports.ChatbotPage=function(){const[t,n]=e.useState(!1),[r,a]=e.useState(""),{messages:s,isLoading:o,error:l,sendMessage:c}=Vo(),u=e.useRef(null),d=e.useRef(null);e.useEffect(()=>{if(u.current){const e=u.current.querySelector("[data-radix-scroll-area-viewport]");e&&(e.scrollTop=e.scrollHeight)}},[s]),e.useEffect(()=>{t&&d.current&&d.current.focus()},[t]),e.useEffect(()=>{const e=e=>{"Escape"===e.key&&t&&n(!1)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t]);const f=()=>{r.trim()&&!o&&(c(r),a(""))};return fe.jsxs(fe.Fragment,{children:[fe.jsx(xe,{onClick:()=>n(!t),className:"fixed bottom-6 right-6 h-14 w-14 rounded-full shadow-lg z-50",size:"icon",children:t?fe.jsx(i.X,{className:"h-6 w-6"}):fe.jsx(i.MessageCircle,{className:"h-6 w-6"})}),t&&fe.jsxs(ke,{className:"fixed bottom-24 right-6 w-96 h-[600px] shadow-xl z-50 flex flex-col",children:[fe.jsxs(Ne,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[fe.jsx(je,{className:"text-lg font-semibold",children:"Chat Assistant"}),fe.jsx(xe,{variant:"ghost",size:"icon",onClick:()=>n(!1),className:"h-8 w-8",children:fe.jsx(i.X,{className:"h-4 w-4"})})]}),fe.jsxs(Se,{className:"flex-1 flex flex-col p-0 overflow-hidden",children:[fe.jsx(Rr,{ref:u,className:"flex-1 px-4",children:fe.jsxs("div",{className:"space-y-4 py-4",children:[s.map(e=>fe.jsx("div",{className:"flex "+("user"===e.role?"justify-end":"justify-start"),children:fe.jsx("div",{className:"max-w-[80%] rounded-lg px-4 py-2 "+("user"===e.role?"bg-primary text-primary-foreground":"bg-muted"),children:"assistant"===e.role?fe.jsx(bm,{content:e.content}):fe.jsx("p",{className:"text-sm whitespace-pre-wrap",children:e.content})})},e.id)),o&&fe.jsx("div",{className:"flex justify-start",children:fe.jsx("div",{className:"bg-muted rounded-lg px-4 py-2",children:fe.jsxs("div",{className:"flex space-x-2",children:[fe.jsx("div",{className:"w-2 h-2 bg-foreground/40 rounded-full animate-bounce"}),fe.jsx("div",{className:"w-2 h-2 bg-foreground/40 rounded-full animate-bounce [animation-delay:0.2s]"}),fe.jsx("div",{className:"w-2 h-2 bg-foreground/40 rounded-full animate-bounce [animation-delay:0.4s]"})]})})}),l&&fe.jsx("div",{className:"text-center text-sm text-destructive py-2",children:l})]})}),fe.jsx("div",{className:"border-t p-4",children:fe.jsxs("div",{className:"flex space-x-2",children:[fe.jsx(ye,{ref:d,value:r,onChange:e=>a(e.target.value),onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),f())},placeholder:"Digite sua mensagem...",disabled:o,className:"flex-1"}),fe.jsx(xe,{onClick:f,disabled:o||!r.trim(),size:"icon",children:fe.jsx(i.Send,{className:"h-4 w-4"})})]})})]})]})]})},exports.Checkbox=rt,exports.Collapsible=Fa,exports.CollapsibleContent=La,exports.CollapsibleTrigger=_a,exports.ColorPicker=Dr,exports.Command=Pt,exports.CommandDialog=({children:e,...t})=>fe.jsx("div",{...t,children:fe.jsx(Pt,{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})}),exports.CommandEmpty=Dt,exports.CommandGroup=Rt,exports.CommandInput=Et,exports.CommandItem=_t,exports.CommandList=At,exports.CommandSeparator=Ft,exports.CommandShortcut=Lt,exports.CreatableCombobox=Mr,exports.CrudCards=function({manager:e,config:t,onEdit:n,onDelete:r}){return e.isLoading?fe.jsx(Ba,{children:Array.from({length:3}).map((e,t)=>fe.jsxs(ke,{children:[fe.jsxs(Ne,{children:[fe.jsx(Mt,{className:"h-4 w-3/4"}),fe.jsx(Mt,{className:"h-3 w-1/2"})]}),fe.jsx(Se,{children:fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(Mt,{className:"h-3 w-full"}),fe.jsx(Mt,{className:"h-3 w-2/3"})]})})]},t))}):fe.jsx(Ma.Root,{children:e.entities.map(e=>fe.jsxs(Ma.Item,{onClick:()=>n(e),children:[fe.jsx(Ne,{className:"pb-3",children:fe.jsxs("div",{className:"flex items-start justify-between",children:[fe.jsxs("div",{className:"flex-1 min-w-0",children:[fe.jsx(je,{className:"text-base leading-6 truncate",children:e.title||e.name||"Sem título"}),fe.jsx(Ce,{className:"text-sm",children:s.format(new Date(e.created_at),"dd/MM/yyyy HH:mm",{locale:Da})})]}),fe.jsxs("div",{className:"flex items-center gap-2 ml-2",children:[e.link&&fe.jsx(xe,{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),o.toast.info("Link copiado para a área de transferência"))}catch(t){window.location.href=e}})(e.link)},title:"Abrir link externo",children:fe.jsx(i.ExternalLink,{className:"h-4 w-4"})}),fe.jsx("div",{onClick:e=>e.stopPropagation(),children:fe.jsx(Tr,{onEdit:()=>n(e),onDelete:r?()=>r(e):void 0,canDelete:!!r})})]})]})}),fe.jsx(Se,{className:"pt-0",children:fe.jsx("div",{className:"space-y-2",children:t.cardFields?.map(t=>{const n=e[t.key];return n?fe.jsx(Ma.Field,{label:t.label,value:t.render?t.render(n,e):String(n)},String(t.key)):null})})})]},e.id))})},exports.CrudPageInternal=Gr,exports.CrudPagination=Vr,exports.CrudPrimitiveFilterBar=function({searchValue:e="",onSearchChange:t,customFilters:n=[],onClearFilters:r,showClearButton:a=!0,layout:s="horizontal"}){const o=e||n.length>0;return fe.jsxs("div",{className:`flex ${"vertical"===s?"flex-col":"flex-row items-center"} gap-2 w-full`,children:[t&&fe.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[fe.jsx(i.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),fe.jsx(ye,{type:"text",placeholder:"Buscar...",value:e,onChange:e=>t(e.target.value),className:"pl-9 h-9"})]}),n.map((e,t)=>fe.jsx("div",{className:"vertical"===s?"w-full":"",children:e},t)),a&&o&&r&&fe.jsxs(xe,{variant:"ghost",size:"sm",onClick:r,className:"h-9 px-3 whitespace-nowrap",children:[fe.jsx(i.X,{size:14,className:"mr-1"}),"Limpar"]})]})},exports.CrudPrimitivePagination=$r,exports.CrudPrimitiveTable=function({data:t,columns:n,sortField:r,sortDirection:a,onSort:s,onRowClick:o,renderActions:l,isLoading:c=!1,emptyMessage:u="Nenhum item encontrado",className:d,enableSelection:f=!1,selectedIds:m=[],onSelectItem:p,onSelectAll:h,isAllSelected:g=!1}){const x=e.useMemo(()=>{const e=n.reduce((e,t)=>t.width?e:e+(t.weight??1),0);return n.map(t=>{if(t.width)return`${t.width}px`;if(t.minWidth&&!t.weight)return`${t.minWidth}px`;const n=(t.weight??1)/e*100;return t.minWidth?`minmax(${t.minWidth}px, ${n}%)`:`${n}%`})},[n]);return c?fe.jsx("div",{className:"flex-1 overflow-auto",children:fe.jsx("div",{className:"p-4 space-y-3",children:[...Array(5)].map((e,t)=>fe.jsx(Mt,{className:"h-12 w-full"},t))})}):0===t.length?fe.jsx("div",{className:"flex-1 flex items-center justify-center",children:fe.jsx("div",{className:"text-center text-muted-foreground",children:fe.jsx("p",{children:u})})}):fe.jsx("div",{className:"flex-1 overflow-auto",children:fe.jsxs(Zn,{className:d,children:[fe.jsx(er,{className:"sticky top-0 bg-background z-10",children:fe.jsxs(rr,{children:[f&&fe.jsx(ar,{className:"w-[40px]",children:fe.jsx(rt,{checked:g,onCheckedChange:h,"aria-label":"Selecionar todos"})}),n.map((e,t)=>{return fe.jsx(ar,{className:e.className,style:{width:x[t]},children:e.sortable&&s?fe.jsxs("button",{onClick:()=>s(String(e.key)),className:"flex items-center hover:text-foreground transition-colors font-medium",children:[e.header,(n=String(e.key),r!==n?fe.jsx(i.ArrowUpDown,{size:14,className:"ml-1 opacity-50"}):"asc"===a?fe.jsx(i.ArrowUp,{size:14,className:"ml-1"}):fe.jsx(i.ArrowDown,{size:14,className:"ml-1"}))]}):fe.jsx("span",{className:"font-medium",children:e.header})},String(e.key));var n}),l&&fe.jsx(ar,{className:"w-[80px] text-right",children:"Ações"})]})}),fe.jsx(tr,{children:t.map(e=>fe.jsxs(rr,{onClick:()=>o?.(e),className:o?"cursor-pointer":"",children:[f&&fe.jsx(sr,{children:fe.jsx(rt,{checked:m.includes(e.id),onCheckedChange:()=>p?.(e.id),onClick:e=>e.stopPropagation(),"aria-label":`Selecionar item ${e.id}`})}),n.map(t=>fe.jsx(sr,{className:t.className,children:t.render?t.render(e):String(e[t.key]??"-")},String(t.key))),l&&fe.jsx(sr,{className:"text-right",onClick:e=>e.stopPropagation(),children:l(e)})]},e.id))})]})})},exports.CrudTable=Pr,exports.DataList=Ma,exports.DeleteConfirmationDialog=Jn,exports.Dialog=Ie,exports.DialogClose=Ae,exports.DialogContent=Re,exports.DialogDescription=Me,exports.DialogFooter=_e,exports.DialogHeader=Fe,exports.DialogOverlay=De,exports.DialogPortal=Ee,exports.DialogTitle=Le,exports.DialogTrigger=Pe,exports.DropdownMenu=dr,exports.DropdownMenuCheckboxItem=wr,exports.DropdownMenuContent=yr,exports.DropdownMenuGroup=mr,exports.DropdownMenuItem=vr,exports.DropdownMenuLabel=Nr,exports.DropdownMenuPortal=pr,exports.DropdownMenuRadioGroup=gr,exports.DropdownMenuRadioItem=kr,exports.DropdownMenuSeparator=jr,exports.DropdownMenuShortcut=Cr,exports.DropdownMenuSub=hr,exports.DropdownMenuSubContent=br,exports.DropdownMenuSubTrigger=xr,exports.DropdownMenuTrigger=fr,exports.EmailService=Uo,exports.EmptyState=ur,exports.EntitySelect=Or,exports.ErrorBoundary=Bo,exports.FilterBar=Xr,exports.Form=Oe,exports.FormControl=qe,exports.FormDescription=He,exports.FormField=({...e})=>fe.jsx(ze.Provider,{value:{name:e.name},children:fe.jsx(u.Controller,{...e})}),exports.FormItem=$e,exports.FormLabel=Ve,exports.FormMessage=We,exports.FormSkeleton=function({fields:e=4}){return fe.jsxs("div",{className:"space-y-4",children:[Array.from({length:e}).map((e,t)=>fe.jsxs("div",{className:"space-y-2",children:[fe.jsx(Mt,{className:"h-4 w-24"}),fe.jsx(Mt,{className:"h-10 w-full"})]},t)),fe.jsxs("div",{className:"flex justify-end space-x-2 pt-4",children:[fe.jsx(Mt,{className:"h-10 w-20"}),fe.jsx(Mt,{className:"h-10 w-20"})]})]})},exports.Grid=Ba,exports.HeaderSkeleton=function(){return fe.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[fe.jsxs("div",{className:"flex items-center space-x-3",children:[fe.jsx(Mt,{className:"h-8 w-8 rounded-full"}),fe.jsx(Mt,{className:"h-6 w-32"})]}),fe.jsxs("div",{className:"flex items-center space-x-2",children:[fe.jsx(Mt,{className:"h-8 w-8"}),fe.jsx(Mt,{className:"h-8 w-24"})]})]})},exports.IconPicker=Lr,exports.Input=ye,exports.Label=we,exports.LoadingState=function({isLoading:e,children:t,className:n,type:r="spinner",size:a="md"}){return e?"overlay"===r?fe.jsxs("div",{className:pe("relative",n),children:[t,fe.jsx("div",{className:"absolute inset-0 bg-background/50 backdrop-blur-sm flex items-center justify-center z-10",children:fe.jsx(lt,{size:a})})]}):"skeleton"===r?fe.jsx("div",{className:pe("animate-pulse",n),children:fe.jsx("div",{className:"bg-muted rounded-md h-full w-full"})}):fe.jsx("div",{className:pe("flex items-center justify-center py-8",n),children:fe.jsx(lt,{size:a})}):fe.jsx(fe.Fragment,{children:t})},exports.LoginPage=()=>fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-2xl font-bold",children:"Acesso ao Sistema"})}),fe.jsxs(Se,{className:"text-center space-y-4",children:[fe.jsx("p",{className:"text-muted-foreground",children:"Faça login para acessar o sistema"}),fe.jsx(xe,{onClick:async()=>{yn()?await Mn.loginDev():Mn.loginProd()},className:"w-full",size:"lg",children:yn()?"Login Desenvolvimento":"Entrar com Qualiex"})]})]})}),exports.MESSAGES=kn,exports.ManageAccessModal=ym,exports.MarkdownMessage=bm,exports.MultiSelect=function({options:t=[],value:n=[],onChange:r,getOptionValue:a=e=>e.value,getOptionLabel:s=e=>e.label,placeholder:o="Selecione itens...",label:l,icon:c,emptyMessage:u="Nenhum item disponível.",searchPlaceholder:d="Buscar...",disabled:f=!1,required:m=!1,isLoading:p=!1,error:h,className:g,sortOptions:x=!0,maxDisplayedBadges:b,onOpen:y,onClose:v}){const[w,k]=e.useState(!1),[N,j]=e.useState(""),C=e.useMemo(()=>{const e=t.map(e=>({original:e,value:a(e),label:s(e)}));return x?e.sort((e,t)=>e.label.localeCompare(t.label,"pt-BR",{sensitivity:"base"})):e},[t,a,s,x]),S=e.useMemo(()=>{if(!N)return C;const e=Ot(N);return C.filter(t=>Ot(t.label).includes(e))},[C,N]),T=e.useMemo(()=>C.filter(e=>n.includes(e.value)),[C,n]),I=(e,t)=>{t.preventDefault(),t.stopPropagation(),r&&r(n.filter(t=>t!==e))};if(p)return fe.jsxs("div",{className:pe("space-y-2",g),children:[l&&fe.jsxs(we,{children:[l,m&&fe.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),fe.jsx(Mt,{className:"h-10 w-full"})]});const P="string"==typeof h?h:h?"Erro ao carregar dados":void 0;if(P)return fe.jsxs("div",{className:pe("space-y-2",g),children:[l&&fe.jsxs(we,{children:[l,m&&fe.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),fe.jsxs("div",{className:"flex items-center gap-2 p-3 border border-destructive rounded-md bg-destructive/10 text-destructive",children:[fe.jsx(i.AlertCircle,{className:"h-4 w-4"}),fe.jsx("span",{className:"text-sm",children:P})]})]});const E=b?T.slice(0,b):T,A=b&&T.length>b?T.length-b:0;return fe.jsxs("div",{className:pe("space-y-2",g),children:[l&&fe.jsxs(we,{children:[l,m&&fe.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),fe.jsxs(St,{open:w,onOpenChange:e=>{k(e),e?y?.():(j(""),v?.())},children:[fe.jsx(Tt,{asChild:!0,children:fe.jsxs(xe,{variant:"outline",role:"combobox","aria-expanded":w,disabled:f,className:pe("w-full justify-between min-h-10 h-auto",0===T.length&&"text-muted-foreground"),children:[0===T.length?fe.jsxs("span",{className:"flex items-center gap-2",children:[c&&fe.jsx(c,{className:"h-4 w-4"}),o]}):fe.jsxs("div",{className:"flex flex-wrap gap-1.5 flex-1 mr-2",children:[E.map(e=>fe.jsxs(ot,{variant:"secondary",className:"gap-1 pr-1",children:[e.label,fe.jsx("button",{type:"button",className:"rounded-full outline-none ring-offset-background focus:ring-2 focus:ring-ring focus:ring-offset-2",onKeyDown:t=>{"Enter"===t.key&&I(e.value,t)},onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:t=>I(e.value,t),children:fe.jsx(i.X,{className:"h-3 w-3 text-muted-foreground hover:text-foreground"})})]},e.value)),A>0&&fe.jsxs(ot,{variant:"outline",className:"gap-1",children:["+",A]})]}),fe.jsx(i.ChevronDown,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),fe.jsx(It,{className:"w-full p-0",align:"start",children:fe.jsxs(Pt,{children:[fe.jsx(Et,{placeholder:d,value:N,onChange:e=>j(e.target.value)}),fe.jsx(At,{children:0===t.length?fe.jsx(Dt,{children:u}):0===S.length?fe.jsx(Dt,{children:"Nenhum item encontrado."}):fe.jsx(Rt,{children:S.map(e=>fe.jsxs(_t,{value:e.value,onSelect:()=>(e=>{if(!r)return;const t=n.includes(e)?n.filter(t=>t!==e):[...n,e];r(t)})(e.value),className:"cursor-pointer",children:[fe.jsx(i.Check,{className:pe("mr-2 h-4 w-4",n.includes(e.value)?"opacity-100":"opacity-0")}),e.label]},e.value))})})]})})]}),P&&fe.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[fe.jsx(i.AlertCircle,{className:"h-3 w-3"}),P]})]})},exports.NavigationProvider=wo,exports.PageBreadcrumb=function({items:e,maxItems:t=3,className:n}){return e.length>t&&(e[0],e.slice(-(t-1))),e.length,fe.jsx(ga,{className:n})},exports.PageMetadataProvider=oa,exports.Pagination=Ua,exports.PaginationContent=$a,exports.PaginationEllipsis=Qa,exports.PaginationItem=Va,exports.PaginationLink=qa,exports.PaginationNext=Wa,exports.PaginationPrevious=Ha,exports.PlaceCard=vm,exports.PlacesList=function({places:e,isLoading:t,manageAccessConfig:n}){return t?fe.jsx("div",{className:"flex items-center justify-center py-12",children:fe.jsxs("div",{className:"text-center space-y-2",children:[fe.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full mx-auto"}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:"Carregando locais..."})]})}):e&&0!==e.length?fe.jsxs("div",{className:"space-y-1",children:[fe.jsx("h2",{className:"text-xl font-bold mb-4",children:"Estrutura de Locais"}),e.map(e=>fe.jsx(vm,{place:e,manageAccessConfig:n},e.id))]}):fe.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-3",children:[fe.jsx(i.Building2,{className:"h-12 w-12 text-muted-foreground/50"}),fe.jsxs("div",{children:[fe.jsx("h3",{className:"font-semibold text-lg",children:"Nenhum local encontrado"}),fe.jsx("p",{className:"text-sm text-muted-foreground",children:"Não há locais cadastrados para esta unidade."})]})]})},exports.Popover=St,exports.PopoverContent=It,exports.PopoverTrigger=Tt,exports.Progress=Ka,exports.ProtectedRoute=({children:t})=>{const{isAuthenticated:n,isLoading:r}=zn();if(e.useEffect(()=>{if(!n)return;const e=()=>{Kt.areAllTokensValid()||Mn.logout()};e();const t=setInterval(e,3e5);return()=>clearInterval(t)},[n]),e.useEffect(()=>{if(r)return;if(n)return;if(Kt.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,a=new URLSearchParams(t);if(e.has("access_token")||a.has("access_token"))return;const s=yn();(async()=>{s?await Mn.loginDev():Mn.loginProd()})()},[n,r]),r)return fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Carregando..."})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),fe.jsx("p",{className:"text-muted-foreground",children:"Verificando autenticação..."})]})]})});if(!n){if(new URLSearchParams(window.location.search).has("access_token")||new URLSearchParams(window.location.hash.substring(1)).has("access_token"))return fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Processando..."})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),fe.jsx("p",{className:"text-muted-foreground",children:"Processando tokens..."})]})]})});try{if(Kt.areAllTokensValid())return fe.jsx(fe.Fragment,{children:t})}catch{}return fe.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-primary/5 to-secondary/5",children:fe.jsxs(ke,{className:"w-full max-w-md",children:[fe.jsx(Ne,{className:"text-center",children:fe.jsx(je,{className:"text-xl font-semibold",children:"Iniciando..."})}),fe.jsxs(Se,{className:"text-center",children:[fe.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary mx-auto mb-4"}),fe.jsx("p",{className:"text-muted-foreground",children:yn()?"Fazendo login automático...":"Redirecionando para autenticação..."})]})]})})}return fe.jsx(fe.Fragment,{children:t})},exports.QUERY_KEYS={crud:e=>[e],list:(e,t)=>[e,"list",t],detail:(e,t)=>[e,"detail",t]},exports.QualiexEnrichmentService=In,exports.QualiexErrorInterceptor=fn,exports.QualiexUserField=Br,exports.RadioGroup=Xa,exports.RadioGroupItem=Ga,exports.SEARCH_CONFIG=bn,exports.ScrollArea=Rr,exports.ScrollBar=Fr,exports.Select=Qe,exports.SelectContent=Ze,exports.SelectGroup=Ke,exports.SelectItem=tt,exports.SelectLabel=et,exports.SelectScrollDownButton=Je,exports.SelectScrollUpButton=Ye,exports.SelectSeparator=nt,exports.SelectTrigger=Ge,exports.SelectValue=Xe,exports.Separator=Ya,exports.Sheet=Ja,exports.SheetClose=es,exports.SheetContent=as,exports.SheetDescription=ls,exports.SheetFooter=os,exports.SheetHeader=ss,exports.SheetOverlay=ns,exports.SheetPortal=ts,exports.SheetTitle=is,exports.SheetTrigger=Za,exports.Sidebar=xs,exports.SidebarContent=Cs,exports.SidebarFooter=Ns,exports.SidebarGroup=Ss,exports.SidebarGroupAction=Is,exports.SidebarGroupContent=Ps,exports.SidebarGroupLabel=Ts,exports.SidebarHeader=ks,exports.SidebarInput=ws,exports.SidebarInset=vs,exports.SidebarMenu=Es,exports.SidebarMenuAction=Fs,exports.SidebarMenuBadge=_s,exports.SidebarMenuButton=Rs,exports.SidebarMenuItem=As,exports.SidebarMenuSkeleton=Ls,exports.SidebarMenuSub=Ms,exports.SidebarMenuSubButton=zs,exports.SidebarMenuSubItem=Os,exports.SidebarProvider=gs,exports.SidebarRail=ys,exports.SidebarSeparator=js,exports.SidebarSkeleton=function(){return fe.jsx("div",{className:"w-64 border-r bg-muted/10",children:fe.jsxs("div",{className:"p-4",children:[fe.jsx(Mt,{className:"h-8 w-32 mb-6"}),fe.jsx("div",{className:"space-y-2",children:Array.from({length:6}).map((e,t)=>fe.jsxs("div",{className:"flex items-center space-x-3 p-2",children:[fe.jsx(Mt,{className:"h-4 w-4"}),fe.jsx(Mt,{className:"h-4 w-20"})]},t))})]})})},exports.SidebarTrigger=bs,exports.Skeleton=Mt,exports.Slider=Bs,exports.SonnerToaster=({...e})=>{const{theme:t="system"}=A.useTheme();return fe.jsx(o.Toaster,{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})},exports.Spinner=lt,exports.Stack=Kr,exports.StatusSelect=function({value:e,onChange:t,activeLabel:n="Ativo",inactiveLabel:r="Inativo",allLabel:a="[Todos]",placeholder:s="Status",className:o="w-full sm:w-[180px]"}){return fe.jsx(Or,{value:String(e),onChange:e=>t(e),items:[{id:"active",name:n},{id:"inactive",name:r},{id:"all",name:a}],getItemValue:e=>e.id,getItemLabel:e=>e.name,placeholder:s,className:o})},exports.Switch=oo,exports.TabPageContent=function({children:e,className:t}){return fe.jsx("div",{className:pe("space-y-6",t),children:e})},exports.TabPageHeader=function({title:e,description:t,actions:n,className:r}){return fe.jsxs("div",{className:pe("space-y-4",r),children:[fe.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[fe.jsxs("div",{className:"space-y-1",children:[fe.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:e}),t&&fe.jsx("p",{className:"text-muted-foreground text-sm",children:t})]}),n&&fe.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:n})]}),fe.jsx(Ya,{})]})},exports.TabPageLayout=function({children:e,className:t}){return fe.jsx("div",{className:pe("flex flex-col h-full",t),children:fe.jsx(Rr,{className:"flex-1",children:fe.jsx("div",{className:"space-y-6 p-6",children:e})})})},exports.Table=Zn,exports.TableBody=tr,exports.TableCaption=or,exports.TableCell=sr,exports.TableFooter=nr,exports.TableHead=ar,exports.TableHeader=er,exports.TableRow=rr,exports.TableRowActions=Tr,exports.TableSkeleton=ir,exports.Tabs=io,exports.TabsContent=uo,exports.TabsList=lo,exports.TabsTrigger=co,exports.Textarea=at,exports.Toast=wt,exports.ToastAction=kt,exports.ToastClose=Nt,exports.ToastDescription=Ct,exports.ToastProvider=bt,exports.ToastTitle=jt,exports.ToastViewport=yt,exports.Toaster=function(){const{toasts:e}=xt();return fe.jsxs(bt,{children:[e.map(function({id:e,title:t,description:n,action:r,...a}){return fe.jsxs(wt,{...a,children:[fe.jsxs("div",{className:"grid gap-1",children:[t&&fe.jsx(jt,{children:t}),n&&fe.jsx(Ct,{children:n})]}),r,fe.jsx(Nt,{})]},e)}),fe.jsx(yt,{})]})},exports.Toggle=mo,exports.ToggleGroup=ho,exports.ToggleGroupItem=go,exports.TokenManager=Kt,exports.TokenService=Bt,exports.Tooltip=us,exports.TooltipContent=fs,exports.TooltipProvider=cs,exports.TooltipTrigger=ds,exports.assets=Do,exports.badgeVariants=st,exports.buttonVariants=ge,exports.cn=pe,exports.createCrudPage=function(e){return({manager:t})=>{const{manager:n,config:r,onSave:a,onEdit:s,onToggleStatus:o}=e,i=t??n,l={entityName:r.entityName,entityNamePlural:r.entityNamePlural,filters:r.filters||[],columns:r.columns,cardFields:r.cardFields||[],enableBulkActions:r.enableBulkActions??!1,bulkActions:r.bulkActions||[],customActions:r.customActions,customRowActions:r.customRowActions,customListView:r.customListView,onEdit:s||r.onEdit};return fe.jsx(Gr,{manager:i,config:l,formSections:r.formSections,onSave:a,onToggleStatus:o,defaultSort:r.defaultSort})}},exports.createCrudRoutingConfig=function(e,t){const n=bo({basePath:e,newPath:t.newPath,editPath:t.editPath});return{useCustomRouting:!0,onNew:n.onNew,onEdit:n.onEdit}},exports.createRoutingHandlers=bo,exports.createService=An,exports.createSimpleSaveHandler=function(e,t,n){return r=>{if(r.id){const t=n(r);e.updateEntity(r.id,t)}else{const n=t(r);e.createEntity(n)}}},exports.createSimpleService=function(e){const t=An({tableName:e.tableName,searchFields:e.searchFields||["title"],selectFields:e.selectFields,schemaName:e.schemaName||"central",entityName:e.entityName,enableQualiexEnrichment:e.enableQualiexEnrichment||!0,userIdFields:e.userIdFields,userFieldsMapping:e.userFieldsMapping});return{service:t,useCrudHook:(n,r)=>Bn({queryKey:e.tableName,service:{...t,getAll:async(e={})=>await t.getAll({...e})},entityName:e.entityName,additionalFilters:n,onSuccess:r})}},exports.crudPresets=ea,exports.debounce=(e,t)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}},exports.deriveEmailField=jn,exports.deriveNameField=Nn,exports.deriveUsernameField=Cn,exports.emailService=$o,exports.errorService=Yt,exports.formatCurrency=e=>null==e?"R$ 0,00":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:2,maximumFractionDigits:2}).format(e),exports.formatDatetime=e=>{if(!e)return"";const t=s.parseISO(e);if(!s.isValid(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"})}`},exports.generateCrudConfig=Yr,exports.getQualiexConfig=wn,exports.getSupabaseClient=an,exports.handleExternalLink=me,exports.isDevEnvironment=yn,exports.logoSrc=Ro,exports.placeService=Nm,exports.qualiexApi=hn,exports.resolveFieldMappings=Sn,exports.setQualiexConfig=e=>{vn={...vn,...e}},exports.setupQualiexCore=function(e){return{queryClient:e.queryClient||new g.QueryClient({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),config:e}},exports.slugify=e=>e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/-+/g,"-"),exports.smallLogoSrc=Fo,exports.toast=gt,exports.toggleVariants=fo,exports.trimTextFields=he,exports.useActiveModules=To,exports.useAuth=zn,exports.useBaseForm=Er,exports.useCrud=Bn,exports.useDebounce=jo,exports.useFormField=Be,exports.useNavigation=ko,exports.useOpenAIChat=Vo,exports.usePageMetadata=function(t){const{setMetadata:n,clearMetadata:r}=ia();e.useEffect(()=>(n(t),()=>r()),[t.title,t.subtitle,n,r])},exports.usePageTitle=No,exports.usePermissionQuery=So,exports.useQualiexUsers=zr,exports.useRouteBreadcrumbs=function(){const e=x.useLocation();return(()=>{const t=e.pathname.split("/").filter(Boolean),n=[{label:"Exemplos",href:"/"}];let r="";return t.forEach((e,a)=>{r+=`/${e}`;const s=a===t.length-1,o=e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ");n.push({label:o,href:s?void 0:r,isCurrentPage:s})}),n})()},exports.useSidebar=hs,exports.useToast=xt,exports.withPreset=function(e,t,n={}){const r=ea[e];return Yr(r.title,t,{...r,...n})};