@noxickon/onyx 0.0.4-dev.2 → 0.0.4-dev.4

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.
@@ -19,7 +19,7 @@ versions may have different capabilities and behavior. The data from one
19
19
  version used in the function from another could produce confusing and
20
20
  spurious results.`)}}return!1};class Z{constructor(t,n="GraphQL request",s={line:1,column:1}){typeof t=="string"||R(!1,`Body must be a string. Received: ${W(t)}.`),this.body=t,this.name=n,this.locationOffset=s,this.locationOffset.line>0||R(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||R(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}function Re(e){return Le(e,Z)}function Fe(e,t){const n=new we(e,t),s=n.parseDocument();return Object.defineProperty(s,"tokenCount",{enumerable:!1,value:n.tokenCount}),s}class we{constructor(t,n={}){const s=Re(t)?t:new Z(t);this._lexer=new fe(s),this._options=n,this._tokenCounter=0}get tokenCount(){return this._tokenCounter}parseName(){const t=this.expectToken(o.NAME);return this.node(t,{kind:c.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:c.DOCUMENT,definitions:this.many(o.SOF,this.parseDefinition,o.EOF)})}parseDefinition(){if(this.peek(o.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),n=t?this._lexer.lookahead():this._lexer.token;if(n.kind===o.NAME){switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw d(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(n.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(n)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(o.BRACE_L))return this.node(t,{kind:c.OPERATION_DEFINITION,operation:O.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const n=this.parseOperationType();let s;return this.peek(o.NAME)&&(s=this.parseName()),this.node(t,{kind:c.OPERATION_DEFINITION,operation:n,name:s,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(o.NAME);switch(t.value){case"query":return O.QUERY;case"mutation":return O.MUTATION;case"subscription":return O.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(o.PAREN_L,this.parseVariableDefinition,o.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:c.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(o.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(o.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(o.DOLLAR),this.node(t,{kind:c.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:c.SELECTION_SET,selections:this.many(o.BRACE_L,this.parseSelection,o.BRACE_R)})}parseSelection(){return this.peek(o.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,n=this.parseName();let s,i;return this.expectOptionalToken(o.COLON)?(s=n,i=this.parseName()):i=n,this.node(t,{kind:c.FIELD,alias:s,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(o.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){const n=t?this.parseConstArgument:this.parseArgument;return this.optionalMany(o.PAREN_L,n,o.PAREN_R)}parseArgument(t=!1){const n=this._lexer.token,s=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.ARGUMENT,name:s,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(o.SPREAD);const n=this.expectOptionalKeyword("on");return!n&&this.peek(o.NAME)?this.node(t,{kind:c.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:c.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this._options.allowLegacyFragmentVariables===!0?this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}):this.node(t,{kind:c.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()}parseValueLiteral(t){const n=this._lexer.token;switch(n.kind){case o.BRACKET_L:return this.parseList(t);case o.BRACE_L:return this.parseObject(t);case o.INT:return this.advanceLexer(),this.node(n,{kind:c.INT,value:n.value});case o.FLOAT:return this.advanceLexer(),this.node(n,{kind:c.FLOAT,value:n.value});case o.STRING:case o.BLOCK_STRING:return this.parseStringLiteral();case o.NAME:switch(this.advanceLexer(),n.value){case"true":return this.node(n,{kind:c.BOOLEAN,value:!0});case"false":return this.node(n,{kind:c.BOOLEAN,value:!1});case"null":return this.node(n,{kind:c.NULL});default:return this.node(n,{kind:c.ENUM,value:n.value})}case o.DOLLAR:if(t)if(this.expectToken(o.DOLLAR),this._lexer.token.kind===o.NAME){const s=this._lexer.token.value;throw d(this._lexer.source,n.start,`Unexpected variable "$${s}" in constant value.`)}else throw this.unexpected(n);return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:c.STRING,value:t.value,block:t.kind===o.BLOCK_STRING})}parseList(t){const n=()=>this.parseValueLiteral(t);return this.node(this._lexer.token,{kind:c.LIST,values:this.any(o.BRACKET_L,n,o.BRACKET_R)})}parseObject(t){const n=()=>this.parseObjectField(t);return this.node(this._lexer.token,{kind:c.OBJECT,fields:this.any(o.BRACE_L,n,o.BRACE_R)})}parseObjectField(t){const n=this._lexer.token,s=this.parseName();return this.expectToken(o.COLON),this.node(n,{kind:c.OBJECT_FIELD,name:s,value:this.parseValueLiteral(t)})}parseDirectives(t){const n=[];for(;this.peek(o.AT);)n.push(this.parseDirective(t));return n}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const n=this._lexer.token;return this.expectToken(o.AT),this.node(n,{kind:c.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let n;if(this.expectOptionalToken(o.BRACKET_L)){const s=this.parseTypeReference();this.expectToken(o.BRACKET_R),n=this.node(t,{kind:c.LIST_TYPE,type:s})}else n=this.parseNamedType();return this.expectOptionalToken(o.BANG)?this.node(t,{kind:c.NON_NULL_TYPE,type:n}):n}parseNamedType(){return this.node(this._lexer.token,{kind:c.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(o.STRING)||this.peek(o.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");const s=this.parseConstDirectives(),i=this.many(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);return this.node(t,{kind:c.SCHEMA_DEFINITION,description:n,directives:s,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,n=this.parseOperationType();this.expectToken(o.COLON);const s=this.parseNamedType();return this.node(t,{kind:c.OPERATION_TYPE_DEFINITION,operation:n,type:s})}parseScalarTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");const s=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:c.SCALAR_TYPE_DEFINITION,description:n,name:s,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");const s=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.OBJECT_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:r,fields:a})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(o.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseFieldDefinition,o.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,n=this.parseDescription(),s=this.parseName(),i=this.parseArgumentDefs();this.expectToken(o.COLON);const r=this.parseTypeReference(),a=this.parseConstDirectives();return this.node(t,{kind:c.FIELD_DEFINITION,description:n,name:s,arguments:i,type:r,directives:a})}parseArgumentDefs(){return this.optionalMany(o.PAREN_L,this.parseInputValueDef,o.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,n=this.parseDescription(),s=this.parseName();this.expectToken(o.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(o.EQUALS)&&(r=this.parseConstValueLiteral());const a=this.parseConstDirectives();return this.node(t,{kind:c.INPUT_VALUE_DEFINITION,description:n,name:s,type:i,defaultValue:r,directives:a})}parseInterfaceTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");const s=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),a=this.parseFieldsDefinition();return this.node(t,{kind:c.INTERFACE_TYPE_DEFINITION,description:n,name:s,interfaces:i,directives:r,fields:a})}parseUnionTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");const s=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:c.UNION_TYPE_DEFINITION,description:n,name:s,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(o.EQUALS)?this.delimitedMany(o.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");const s=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:c.ENUM_TYPE_DEFINITION,description:n,name:s,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(o.BRACE_L,this.parseEnumValueDefinition,o.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,n=this.parseDescription(),s=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:c.ENUM_VALUE_DEFINITION,description:n,name:s,directives:i})}parseEnumValueName(){if(this._lexer.token.value==="true"||this._lexer.token.value==="false"||this._lexer.token.value==="null")throw d(this._lexer.source,this._lexer.token.start,`${v(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");const s=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:s,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(o.BRACE_L,this.parseInputValueDef,o.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===o.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const n=this.parseConstDirectives(),s=this.optionalMany(o.BRACE_L,this.parseOperationTypeDefinition,o.BRACE_R);if(n.length===0&&s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCHEMA_EXTENSION,directives:n,operationTypes:s})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const n=this.parseName(),s=this.parseConstDirectives();if(s.length===0)throw this.unexpected();return this.node(t,{kind:c.SCALAR_TYPE_EXTENSION,name:n,directives:s})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.OBJECT_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const n=this.parseName(),s=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(s.length===0&&i.length===0&&r.length===0)throw this.unexpected();return this.node(t,{kind:c.INTERFACE_TYPE_EXTENSION,name:n,interfaces:s,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.UNION_TYPE_EXTENSION,name:n,directives:s,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.ENUM_TYPE_EXTENSION,name:n,directives:s,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const n=this.parseName(),s=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(s.length===0&&i.length===0)throw this.unexpected();return this.node(t,{kind:c.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:s,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(o.AT);const s=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const a=this.parseDirectiveLocations();return this.node(t,{kind:c.DIRECTIVE_DEFINITION,description:n,name:s,arguments:i,repeatable:r,locations:a})}parseDirectiveLocations(){return this.delimitedMany(o.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,n=this.parseName();if(Object.prototype.hasOwnProperty.call(U,n.value))return n;throw this.unexpected(t)}node(t,n){return this._options.noLocation!==!0&&(n.loc=new ce(t,this._lexer.lastToken,this._lexer.source)),n}peek(t){return this._lexer.token.kind===t}expectToken(t){const n=this._lexer.token;if(n.kind===t)return this.advanceLexer(),n;throw d(this._lexer.source,n.start,`Expected ${K(t)}, found ${v(n)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t?(this.advanceLexer(),!0):!1}expectKeyword(t){const n=this._lexer.token;if(n.kind===o.NAME&&n.value===t)this.advanceLexer();else throw d(this._lexer.source,n.start,`Expected "${t}", found ${v(n)}.`)}expectOptionalKeyword(t){const n=this._lexer.token;return n.kind===o.NAME&&n.value===t?(this.advanceLexer(),!0):!1}unexpected(t){const n=t??this._lexer.token;return d(this._lexer.source,n.start,`Unexpected ${v(n)}.`)}any(t,n,s){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(s);)i.push(n.call(this));return i}optionalMany(t,n,s){if(this.expectOptionalToken(t)){const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}return[]}many(t,n,s){this.expectToken(t);const i=[];do i.push(n.call(this));while(!this.expectOptionalToken(s));return i}delimitedMany(t,n){this.expectOptionalToken(t);const s=[];do s.push(n.call(this));while(this.expectOptionalToken(t));return s}advanceLexer(){const{maxTokens:t}=this._options,n=this._lexer.advance();if(n.kind!==o.EOF&&(++this._tokenCounter,t!==void 0&&this._tokenCounter>t))throw d(this._lexer.source,n.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function v(e){const t=e.value;return K(e.kind)+(t!=null?` "${t}"`:"")}function K(e){return Ee(e)?`"${e}"`:e}var D=new Map,M=new Map,ee=!0,k=!1;function te(e){return e.replace(/[\s,]+/g," ").trim()}function Pe(e){return te(e.source.body.substring(e.start,e.end))}function Ue(e){var t=new Set,n=[];return e.definitions.forEach(function(s){if(s.kind==="FragmentDefinition"){var i=s.name.value,r=Pe(s.loc),a=M.get(i);a&&!a.has(r)?ee&&console.warn("Warning: fragment with name "+i+` already exists.
21
21
  graphql-tag enforces all fragment names across your application to be unique; read more about
22
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||M.set(i,a=new Set),a.add(r),t.has(r)||(t.add(r),n.push(s))}else n.push(s)}),w.__assign(w.__assign({},e),{definitions:n})}function Me(e){var t=new Set(e.definitions);t.forEach(function(s){s.loc&&delete s.loc,Object.keys(s).forEach(function(i){var r=s[i];r&&typeof r=="object"&&t.add(r)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function Ve(e){var t=te(e);if(!D.has(t)){var n=Fe(e,{experimentalFragmentVariables:k,allowLegacyFragmentVariables:k});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");D.set(t,Me(Ue(n)))}return D.get(t)}function x(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];typeof e=="string"&&(e=[e]);var s=e[0];return t.forEach(function(i,r){i&&i.kind==="Document"?s+=i.loc.source.body:s+=i,s+=e[r+1]}),Ve(s)}function Be(){D.clear(),M.clear()}function je(){ee=!1}function Ge(){k=!0}function Ye(){k=!1}var _={gql:x,resetCaches:Be,disableFragmentWarnings:je,enableExperimentalFragmentVariables:Ge,disableExperimentalFragmentVariables:Ye};(function(e){e.gql=_.gql,e.resetCaches=_.resetCaches,e.disableFragmentWarnings=_.disableFragmentWarnings,e.enableExperimentalFragmentVariables=_.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=_.disableExperimentalFragmentVariables})(x||(x={}));x.default=x;const B=C.createContext({user:null,loading:!1,error:null,isLoggedIn:!1,isAdmin:!1,refreshUser:async()=>Promise.resolve(),setUser:()=>{}}),$e=x`
22
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):a||M.set(i,a=new Set),a.add(r),t.has(r)||(t.add(r),n.push(s))}else n.push(s)}),w.__assign(w.__assign({},e),{definitions:n})}function Me(e){var t=new Set(e.definitions);t.forEach(function(s){s.loc&&delete s.loc,Object.keys(s).forEach(function(i){var r=s[i];r&&typeof r=="object"&&t.add(r)})});var n=e.loc;return n&&(delete n.startToken,delete n.endToken),e}function Ve(e){var t=te(e);if(!D.has(t)){var n=Fe(e,{experimentalFragmentVariables:k,allowLegacyFragmentVariables:k});if(!n||n.kind!=="Document")throw new Error("Not a valid GraphQL document.");D.set(t,Me(Ue(n)))}return D.get(t)}function x(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];typeof e=="string"&&(e=[e]);var s=e[0];return t.forEach(function(i,r){i&&i.kind==="Document"?s+=i.loc.source.body:s+=i,s+=e[r+1]}),Ve(s)}function Be(){D.clear(),M.clear()}function je(){ee=!1}function Ge(){k=!0}function Ye(){k=!1}var _={gql:x,resetCaches:Be,disableFragmentWarnings:je,enableExperimentalFragmentVariables:Ge,disableExperimentalFragmentVariables:Ye};(function(e){e.gql=_.gql,e.resetCaches=_.resetCaches,e.disableFragmentWarnings=_.disableFragmentWarnings,e.enableExperimentalFragmentVariables=_.enableExperimentalFragmentVariables,e.disableExperimentalFragmentVariables=_.disableExperimentalFragmentVariables})(x||(x={}));x.default=x;const B=C.createContext({user:null,loading:!0,error:null,isLoggedIn:!1,isAdmin:!1,refreshUser:async()=>Promise.resolve(),setUser:()=>{}}),$e=x`
23
23
  query getCurrentUser {
24
24
  me {
25
25
  id
@@ -2128,7 +2128,7 @@ var _ = {
2128
2128
  O.default = O;
2129
2129
  const ee = ne({
2130
2130
  user: null,
2131
- loading: !1,
2131
+ loading: !0,
2132
2132
  error: null,
2133
2133
  isLoggedIn: !1,
2134
2134
  isAdmin: !1,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chunks/useAuth-DPnpY3XC.js");exports.OxAuthContext=t.OxAuthContext;exports.OxAuthProvider=t.OxAuthProvider;exports.useOxAuth=t.useOxAuth;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../chunks/useAuth-BDiob4Rb.js");exports.OxAuthContext=t.OxAuthContext;exports.OxAuthProvider=t.OxAuthProvider;exports.useOxAuth=t.useOxAuth;
@@ -1,4 +1,4 @@
1
- import { a as x, O as a, u as e } from "../chunks/useAuth-DDRXztKj.js";
1
+ import { a as x, O as a, u as e } from "../chunks/useAuth-raJH4ydc.js";
2
2
  export {
3
3
  x as OxAuthContext,
4
4
  a as OxAuthProvider,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/jsx-runtime-CITbqOLs.js"),m=require("react"),r=require("../chunks/Button-D-v4l8ZE.js"),f=require("../chunks/constants-B1_n9ezb.js"),v=({brand:t,children:n,className:o,hasSidebar:s=!1,navClassName:i,toggleSidebar:a})=>e.jsxRuntimeExports.jsx("header",{className:r.twMerge("fixed top-0 z-50 h-15 w-full border-b border-neutral-800 bg-zinc-1000/50 backdrop-blur-xl",o),children:e.jsxRuntimeExports.jsxs("nav",{className:r.twMerge("mx-auto flex max-w-10xl items-center justify-between px-4 py-2.5",i),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[s?e.jsxRuntimeExports.jsx(r.OxButton,{"aria-label":"Open menu",icon:"mdiMenu",size:"md",variant:"ghost",onClick:a}):null,t?e.jsxRuntimeExports.jsx("div",{children:t}):null]}),n]})}),p=m.createContext({collapsed:!1}),b="h-15",w=({brand:t,children:n,className:o,collapsed:s=!1,onClose:i})=>{const a=m.useMemo(()=>({collapsed:s}),[s]);m.useEffect(()=>{const x=()=>{window.innerWidth<f.MOBILE_BREAKPOINT&&!s?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")};return x(),window.addEventListener("resize",x),()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("resize",x)}},[s]);const l=t||i;return e.jsxRuntimeExports.jsxs(p.Provider,{value:a,children:[e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Mobile navigation",className:r.twMerge("fixed inset-0 top-0 z-50 flex h-screen flex-col bg-zinc-1000/50 backdrop-blur-xl transition-transform duration-300 md:hidden",s?"-translate-x-full":"translate-x-0",o),role:"navigation",children:[l?e.jsxRuntimeExports.jsxs("div",{className:r.twJoin(b,"flex h-15 items-center gap-3 border-b border-neutral-800 px-4"),children:[i?e.jsxRuntimeExports.jsx(r.OxButton,{"aria-label":"Close sidebar",icon:"mdiClose",variant:"ghost",onClick:i}):null,t||null]}):null,n]}),e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Desktop navigation",className:r.twMerge("fixed z-40 hidden flex-col border-r border-neutral-800 bg-zinc-1000/50 text-white backdrop-blur-xl md:flex",t?"top-0 h-screen":"viewport-minus-header",s?"w-16":"w-64",o),role:"navigation",children:[t&&!s?e.jsxRuntimeExports.jsx("div",{"aria-label":s?"Navigation collapsed":"Navigation expanded",className:r.twJoin(b,"flex items-center border-b border-neutral-800 px-4"),children:t}):null,n]})]})},j=()=>m.useContext(p),E=({children:t,className:n,disabled:o=!1,icon:s,isActive:i=!1,...a})=>{const{collapsed:l}=j(),x=r.twMerge("flex cursor-pointer items-center rounded-lg text-sm font-medium transition-colors",l?"size-10 justify-center":"h-10 w-full gap-3 px-3",i?"bg-white/10 text-white":o?"cursor-not-allowed text-neutral-500":"secondary-inset-focus text-neutral-300 hover:bg-white/6 hover:text-white",n);if("href"in a&&a.href){const{href:c,...g}=a;return e.jsxRuntimeExports.jsxs("a",{"aria-current":i?"page":void 0,className:x,href:o?void 0:c,onClick:o?h=>h.preventDefault():void 0,...g,children:[e.jsxRuntimeExports.jsx("span",{className:"flex items-center",children:e.jsxRuntimeExports.jsx(r.OxIcon,{icon:s,size:.8})}),!l&&t?t:null]})}const{onClick:d,...u}=a;return e.jsxRuntimeExports.jsxs("button",{className:x,disabled:o,type:"button",onClick:o?void 0:d,...u,children:[e.jsxRuntimeExports.jsx("span",{className:"flex items-center",children:e.jsxRuntimeExports.jsx(r.OxIcon,{icon:s,size:.8})}),!l&&t?t:null]})},R=({children:t,className:n,headline:o})=>{const{collapsed:s}=j();return e.jsxRuntimeExports.jsxs("div",{className:r.twMerge("flex flex-col gap-1",n),children:[s?null:e.jsxRuntimeExports.jsx("h3",{className:"mb-2 cursor-default px-3 text-xs font-medium text-neutral-400",children:o}),t]})},N=({children:t,className:n})=>e.jsxRuntimeExports.jsx("div",{className:r.twMerge("flex-1 space-y-1 overflow-y-auto p-4",n),children:t}),O=({children:t,className:n})=>e.jsxRuntimeExports.jsx("div",{className:r.twMerge("border-t border-neutral-800 p-4",n),children:t}),y={purple:{border:"border-purple-500/20",bg:"bg-purple-500/10",text:"text-purple-400"},blue:{border:"border-blue-500/20",bg:"bg-blue-500/10",text:"text-blue-400"},emerald:{border:"border-emerald-500/20",bg:"bg-emerald-500/10",text:"text-emerald-400"},orange:{border:"border-orange-500/20",bg:"bg-orange-500/10",text:"text-orange-400"},rose:{border:"border-rose-500/20",bg:"bg-rose-500/10",text:"text-rose-400"},amber:{border:"border-amber-500/20",bg:"bg-amber-500/10",text:"text-amber-400"},cyan:{border:"border-cyan-500/20",bg:"bg-cyan-500/10",text:"text-cyan-400"},indigo:{border:"border-indigo-500/20",bg:"bg-indigo-500/10",text:"text-indigo-400"}},M=({children:t,className:n,collapsed:o=!1,color:s="purple",hasHeader:i=!1,hasSidebar:a=!1,icon:l,subtitle:x,title:d})=>{const u=d||x||l,c=y[s];return e.jsxRuntimeExports.jsxs("main",{"aria-labelledby":u?"main-headline":void 0,className:r.twMerge("m-auto max-w-10xl overflow-y-auto p-6",i&&"mt-15 h-[calc(100vh-60px)]",a&&(o?"md:ml-16":"md:ml-64"),n),children:[u&&e.jsxRuntimeExports.jsx("div",{className:"mb-8 border-b border-neutral-800 pb-6",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[l&&e.jsxRuntimeExports.jsx("div",{className:r.twJoin("rounded-lg border p-3",c.border,c.bg),children:e.jsxRuntimeExports.jsx(r.OxIcon,{className:r.twJoin(c.text),icon:l,size:1.41})}),e.jsxRuntimeExports.jsxs("div",{children:[d&&e.jsxRuntimeExports.jsx("h1",{id:"main-headline",className:"text-3xl font-bold text-white",children:d}),x&&e.jsxRuntimeExports.jsx("p",{className:"mt-1 text-sm text-neutral-400",children:x})]})]})}),t]})};exports.OxHeader=v;exports.OxMainContent=M;exports.OxSidebar=w;exports.OxSidebarBody=N;exports.OxSidebarFooter=O;exports.OxSidebarGroup=R;exports.OxSidebarItem=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/jsx-runtime-CITbqOLs.js"),m=require("react"),r=require("../chunks/Button-D-v4l8ZE.js"),f=require("../chunks/constants-B1_n9ezb.js"),v=({brand:t,children:n,className:o,hasSidebar:s=!1,navClassName:a,toggleSidebar:i})=>e.jsxRuntimeExports.jsx("header",{className:r.twMerge("fixed top-0 z-50 h-15 w-full border-b border-neutral-800 bg-zinc-1000/50 backdrop-blur-xl",o),children:e.jsxRuntimeExports.jsxs("nav",{className:r.twMerge("mx-auto flex max-w-10xl items-center justify-between px-4 py-2.5",a),children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[s?e.jsxRuntimeExports.jsx(r.OxButton,{"aria-label":"Open menu",icon:"mdiMenu",size:"md",variant:"ghost",onClick:i}):null,t?e.jsxRuntimeExports.jsx("div",{children:t}):null]}),n]})}),p=m.createContext({collapsed:!1}),b="h-15",w=({brand:t,children:n,className:o,collapsed:s=!1,hasHeader:a=!1,onClose:i})=>{const x=m.useMemo(()=>({collapsed:s}),[s]);m.useEffect(()=>{const l=()=>{window.innerWidth<f.MOBILE_BREAKPOINT&&!s?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")};return l(),window.addEventListener("resize",l),()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("resize",l)}},[s]);const d=t||i;return e.jsxRuntimeExports.jsxs(p.Provider,{value:x,children:[e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Mobile navigation",className:r.twMerge("fixed inset-0 top-0 z-50 flex h-screen flex-col bg-zinc-1000/50 backdrop-blur-xl transition-transform duration-300 md:hidden",s?"-translate-x-full":"translate-x-0",o),role:"navigation",children:[d?e.jsxRuntimeExports.jsxs("div",{className:r.twJoin(b,"flex h-15 items-center gap-3 border-b border-neutral-800 px-4"),children:[i?e.jsxRuntimeExports.jsx(r.OxButton,{"aria-label":"Close sidebar",icon:"mdiClose",variant:"ghost",onClick:i}):null,t||null]}):null,n]}),e.jsxRuntimeExports.jsxs("nav",{"aria-label":"Desktop navigation",className:r.twMerge("fixed z-40 hidden flex-col border-r border-neutral-800 bg-zinc-1000/50 text-white backdrop-blur-xl md:flex",t&&!a?"top-0 h-screen":"viewport-minus-header",s?"w-16":"w-64",o),role:"navigation",children:[t&&!a&&!s?e.jsxRuntimeExports.jsx("div",{"aria-label":s?"Navigation collapsed":"Navigation expanded",className:r.twJoin(b,"flex items-center border-b border-neutral-800 px-4"),children:t}):null,n]})]})},j=()=>m.useContext(p),E=({children:t,className:n,disabled:o=!1,icon:s,isActive:a=!1,...i})=>{const{collapsed:x}=j(),d=r.twMerge("flex cursor-pointer items-center rounded-lg text-sm font-medium transition-colors",x?"size-10 justify-center":"h-10 w-full gap-3 px-3",a?"bg-white/10 text-white":o?"cursor-not-allowed text-neutral-500":"secondary-inset-focus text-neutral-300 hover:bg-white/6 hover:text-white",n);if("href"in i&&i.href){const{href:u,...g}=i;return e.jsxRuntimeExports.jsxs("a",{"aria-current":a?"page":void 0,className:d,href:o?void 0:u,onClick:o?h=>h.preventDefault():void 0,...g,children:[e.jsxRuntimeExports.jsx("span",{className:"flex items-center",children:e.jsxRuntimeExports.jsx(r.OxIcon,{icon:s,size:.8})}),!x&&t?t:null]})}const{onClick:l,...c}=i;return e.jsxRuntimeExports.jsxs("button",{className:d,disabled:o,type:"button",onClick:o?void 0:l,...c,children:[e.jsxRuntimeExports.jsx("span",{className:"flex items-center",children:e.jsxRuntimeExports.jsx(r.OxIcon,{icon:s,size:.8})}),!x&&t?t:null]})},R=({children:t,className:n,headline:o})=>{const{collapsed:s}=j();return e.jsxRuntimeExports.jsxs("div",{className:r.twMerge("flex flex-col gap-1",n),children:[s?null:e.jsxRuntimeExports.jsx("h3",{className:"mb-2 cursor-default px-3 text-xs font-medium text-neutral-400",children:o}),t]})},N=({children:t,className:n})=>e.jsxRuntimeExports.jsx("div",{className:r.twMerge("flex-1 space-y-1 overflow-y-auto p-4",n),children:t}),O=({children:t,className:n})=>e.jsxRuntimeExports.jsx("div",{className:r.twMerge("border-t border-neutral-800 p-4",n),children:t}),y={purple:{border:"border-purple-500/20",bg:"bg-purple-500/10",text:"text-purple-400"},blue:{border:"border-blue-500/20",bg:"bg-blue-500/10",text:"text-blue-400"},emerald:{border:"border-emerald-500/20",bg:"bg-emerald-500/10",text:"text-emerald-400"},orange:{border:"border-orange-500/20",bg:"bg-orange-500/10",text:"text-orange-400"},rose:{border:"border-rose-500/20",bg:"bg-rose-500/10",text:"text-rose-400"},amber:{border:"border-amber-500/20",bg:"bg-amber-500/10",text:"text-amber-400"},cyan:{border:"border-cyan-500/20",bg:"bg-cyan-500/10",text:"text-cyan-400"},indigo:{border:"border-indigo-500/20",bg:"bg-indigo-500/10",text:"text-indigo-400"}},M=({children:t,className:n,collapsed:o=!1,color:s="purple",hasHeader:a=!1,hasSidebar:i=!1,icon:x,subtitle:d,title:l})=>{const c=l||d||x,u=y[s];return e.jsxRuntimeExports.jsxs("main",{"aria-labelledby":c?"main-headline":void 0,className:r.twMerge("m-auto max-w-10xl overflow-y-auto p-6",a&&"mt-15 h-[calc(100vh-60px)]",i&&(o?"md:ml-16":"md:ml-64"),n),children:[c&&e.jsxRuntimeExports.jsx("div",{className:"mb-8 border-b border-neutral-800 pb-6",children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4",children:[x&&e.jsxRuntimeExports.jsx("div",{className:r.twJoin("rounded-lg border p-3",u.border,u.bg),children:e.jsxRuntimeExports.jsx(r.OxIcon,{className:r.twJoin(u.text),icon:x,size:1.41})}),e.jsxRuntimeExports.jsxs("div",{children:[l&&e.jsxRuntimeExports.jsx("h1",{id:"main-headline",className:"text-3xl font-bold text-white",children:l}),d&&e.jsxRuntimeExports.jsx("p",{className:"mt-1 text-sm text-neutral-400",children:d})]})]})}),t]})};exports.OxHeader=v;exports.OxMainContent=M;exports.OxSidebar=w;exports.OxSidebarBody=N;exports.OxSidebarFooter=O;exports.OxSidebarGroup=R;exports.OxSidebarItem=E;
@@ -7,8 +7,8 @@ const L = ({
7
7
  children: s,
8
8
  className: a,
9
9
  hasSidebar: t = !1,
10
- navClassName: o,
11
- toggleSidebar: n
10
+ navClassName: n,
11
+ toggleSidebar: o
12
12
  }) => /* @__PURE__ */ e.jsx(
13
13
  "header",
14
14
  {
@@ -21,7 +21,7 @@ const L = ({
21
21
  {
22
22
  className: d(
23
23
  "mx-auto flex max-w-10xl items-center justify-between px-4 py-2.5",
24
- o
24
+ n
25
25
  ),
26
26
  children: [
27
27
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
@@ -32,7 +32,7 @@ const L = ({
32
32
  icon: "mdiMenu",
33
33
  size: "md",
34
34
  variant: "ghost",
35
- onClick: n
35
+ onClick: o
36
36
  }
37
37
  ) : null,
38
38
  r ? /* @__PURE__ */ e.jsx("div", { children: r }) : null
@@ -47,19 +47,20 @@ const L = ({
47
47
  children: s,
48
48
  className: a,
49
49
  collapsed: t = !1,
50
+ hasHeader: n = !1,
50
51
  onClose: o
51
52
  }) => {
52
- const n = N(() => ({ collapsed: t }), [t]);
53
+ const l = N(() => ({ collapsed: t }), [t]);
53
54
  y(() => {
54
- const l = () => {
55
+ const i = () => {
55
56
  window.innerWidth < C && !t ? document.body.classList.add("overflow-hidden") : document.body.classList.remove("overflow-hidden");
56
57
  };
57
- return l(), window.addEventListener("resize", l), () => {
58
- document.body.classList.remove("overflow-hidden"), window.removeEventListener("resize", l);
58
+ return i(), window.addEventListener("resize", i), () => {
59
+ document.body.classList.remove("overflow-hidden"), window.removeEventListener("resize", i);
59
60
  };
60
61
  }, [t]);
61
- const i = r || o;
62
- return /* @__PURE__ */ e.jsxs(g.Provider, { value: n, children: [
62
+ const x = r || o;
63
+ return /* @__PURE__ */ e.jsxs(g.Provider, { value: l, children: [
63
64
  /* @__PURE__ */ e.jsxs(
64
65
  "nav",
65
66
  {
@@ -71,7 +72,7 @@ const L = ({
71
72
  ),
72
73
  role: "navigation",
73
74
  children: [
74
- i ? /* @__PURE__ */ e.jsxs(
75
+ x ? /* @__PURE__ */ e.jsxs(
75
76
  "div",
76
77
  {
77
78
  className: m(
@@ -102,13 +103,13 @@ const L = ({
102
103
  "aria-label": "Desktop navigation",
103
104
  className: d(
104
105
  "fixed z-40 hidden flex-col border-r border-neutral-800 bg-zinc-1000/50 text-white backdrop-blur-xl md:flex",
105
- r ? "top-0 h-screen" : "viewport-minus-header",
106
+ r && !n ? "top-0 h-screen" : "viewport-minus-header",
106
107
  t ? "w-16" : "w-64",
107
108
  a
108
109
  ),
109
110
  role: "navigation",
110
111
  children: [
111
- r && !t ? /* @__PURE__ */ e.jsx(
112
+ r && !n && !t ? /* @__PURE__ */ e.jsx(
112
113
  "div",
113
114
  {
114
115
  "aria-label": t ? "Navigation collapsed" : "Navigation expanded",
@@ -126,44 +127,44 @@ const L = ({
126
127
  className: s,
127
128
  disabled: a = !1,
128
129
  icon: t,
129
- isActive: o = !1,
130
- ...n
130
+ isActive: n = !1,
131
+ ...o
131
132
  }) => {
132
- const { collapsed: i } = p(), l = d(
133
+ const { collapsed: l } = p(), x = d(
133
134
  "flex cursor-pointer items-center rounded-lg text-sm font-medium transition-colors",
134
- i ? "size-10 justify-center" : "h-10 w-full gap-3 px-3",
135
- o ? "bg-white/10 text-white" : a ? "cursor-not-allowed text-neutral-500" : "secondary-inset-focus text-neutral-300 hover:bg-white/6 hover:text-white",
135
+ l ? "size-10 justify-center" : "h-10 w-full gap-3 px-3",
136
+ n ? "bg-white/10 text-white" : a ? "cursor-not-allowed text-neutral-500" : "secondary-inset-focus text-neutral-300 hover:bg-white/6 hover:text-white",
136
137
  s
137
138
  );
138
- if ("href" in n && n.href) {
139
- const { href: c, ...v } = n;
139
+ if ("href" in o && o.href) {
140
+ const { href: b, ...v } = o;
140
141
  return /* @__PURE__ */ e.jsxs(
141
142
  "a",
142
143
  {
143
- "aria-current": o ? "page" : void 0,
144
- className: l,
145
- href: a ? void 0 : c,
144
+ "aria-current": n ? "page" : void 0,
145
+ className: x,
146
+ href: a ? void 0 : b,
146
147
  onClick: a ? (j) => j.preventDefault() : void 0,
147
148
  ...v,
148
149
  children: [
149
150
  /* @__PURE__ */ e.jsx("span", { className: "flex items-center", children: /* @__PURE__ */ e.jsx(u, { icon: t, size: 0.8 }) }),
150
- !i && r ? r : null
151
+ !l && r ? r : null
151
152
  ]
152
153
  }
153
154
  );
154
155
  }
155
- const { onClick: x, ...b } = n;
156
+ const { onClick: i, ...c } = o;
156
157
  return /* @__PURE__ */ e.jsxs(
157
158
  "button",
158
159
  {
159
- className: l,
160
+ className: x,
160
161
  disabled: a,
161
162
  type: "button",
162
- onClick: a ? void 0 : x,
163
- ...b,
163
+ onClick: a ? void 0 : i,
164
+ ...c,
164
165
  children: [
165
166
  /* @__PURE__ */ e.jsx("span", { className: "flex items-center", children: /* @__PURE__ */ e.jsx(u, { icon: t, size: 0.8 }) }),
166
- !i && r ? r : null
167
+ !l && r ? r : null
167
168
  ]
168
169
  }
169
170
  );
@@ -223,29 +224,29 @@ const L = ({
223
224
  className: s,
224
225
  collapsed: a = !1,
225
226
  color: t = "purple",
226
- hasHeader: o = !1,
227
- hasSidebar: n = !1,
228
- icon: i,
229
- subtitle: l,
230
- title: x
227
+ hasHeader: n = !1,
228
+ hasSidebar: o = !1,
229
+ icon: l,
230
+ subtitle: x,
231
+ title: i
231
232
  }) => {
232
- const b = x || l || i, c = O[t];
233
+ const c = i || x || l, b = O[t];
233
234
  return /* @__PURE__ */ e.jsxs(
234
235
  "main",
235
236
  {
236
- "aria-labelledby": b ? "main-headline" : void 0,
237
+ "aria-labelledby": c ? "main-headline" : void 0,
237
238
  className: d(
238
239
  "m-auto max-w-10xl overflow-y-auto p-6",
239
- o && "mt-15 h-[calc(100vh-60px)]",
240
- n && (a ? "md:ml-16" : "md:ml-64"),
240
+ n && "mt-15 h-[calc(100vh-60px)]",
241
+ o && (a ? "md:ml-16" : "md:ml-64"),
241
242
  s
242
243
  ),
243
244
  children: [
244
- b && /* @__PURE__ */ e.jsx("div", { className: "mb-8 border-b border-neutral-800 pb-6", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
245
- i && /* @__PURE__ */ e.jsx("div", { className: m("rounded-lg border p-3", c.border, c.bg), children: /* @__PURE__ */ e.jsx(u, { className: m(c.text), icon: i, size: 1.41 }) }),
245
+ c && /* @__PURE__ */ e.jsx("div", { className: "mb-8 border-b border-neutral-800 pb-6", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4", children: [
246
+ l && /* @__PURE__ */ e.jsx("div", { className: m("rounded-lg border p-3", b.border, b.bg), children: /* @__PURE__ */ e.jsx(u, { className: m(b.text), icon: l, size: 1.41 }) }),
246
247
  /* @__PURE__ */ e.jsxs("div", { children: [
247
- x && /* @__PURE__ */ e.jsx("h1", { id: "main-headline", className: "text-3xl font-bold text-white", children: x }),
248
- l && /* @__PURE__ */ e.jsx("p", { className: "mt-1 text-sm text-neutral-400", children: l })
248
+ i && /* @__PURE__ */ e.jsx("h1", { id: "main-headline", className: "text-3xl font-bold text-white", children: i }),
249
+ x && /* @__PURE__ */ e.jsx("p", { className: "mt-1 text-sm text-neutral-400", children: x })
249
250
  ] })
250
251
  ] }) }),
251
252
  r
package/dist/layout.d.ts CHANGED
@@ -69,6 +69,7 @@ export declare interface OxSidebarProps {
69
69
  children: React.ReactNode;
70
70
  className?: string;
71
71
  collapsed?: boolean;
72
+ hasHeader?: boolean;
72
73
  onClose?: () => void;
73
74
  }
74
75
 
package/dist/onyx.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("./chunks/jsx-runtime-CITbqOLs.js"),b=require("react"),n=require("./chunks/Button-D-v4l8ZE.js"),M=require("./chunks/Input-CLi1H63d.js"),ee=require("react-dom"),de=require("./chunks/constants-B1_n9ezb.js"),ue=require("./chunks/formatTimestamp-TTsNcy7u.js"),te=require("./chunks/useAuth-DPnpY3XC.js"),me=({children:t,className:s})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex items-center gap-3",s),children:t}),G={rounded:"rounded-full",square:"rounded-lg"},K={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10",xl:"h-12 w-12","2xl":"h-16 w-16"},pe={sm:"h-2 w-2",md:"h-2.5 w-2.5",lg:"h-3 w-3",xl:"h-3.5 w-3.5","2xl":"h-4 w-4"},fe={online:"bg-green-500",offline:"bg-neutral-500",away:"bg-yellow-500",busy:"bg-red-500"},be={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-base","2xl":"text-lg"},se=({alt:t,className:s,fallback:o,showStatus:i=!1,size:r="md",skeleton:x=!1,src:a,status:l,type:u="square"})=>{const[h,d]=b.useState(!1),[p,g]=b.useState(!1),[f,j]=b.useState(!0);b.useEffect(()=>{if(!a){d(!1),g(!0),j(!1);return}j(!0);const R=new Image;R.src=a;const O=()=>{d(!0),g(!1),j(!1)},c=()=>{d(!1),g(!0),j(!1)};return R.addEventListener("load",O),R.addEventListener("error",c),()=>{R.removeEventListener("load",O),R.removeEventListener("error",c)}},[a]);const v=()=>f&&x?e.jsxRuntimeExports.jsx("div",{className:n.twJoin("animate-pulse bg-zinc-800",G[u],K[r])}):h&&!p?e.jsxRuntimeExports.jsx("img",{alt:t,className:n.twMerge(G[u],K[r],"object-cover",s),loading:"lazy",src:a}):e.jsxRuntimeExports.jsx("div",{"aria-label":t,className:n.twMerge("flex items-center justify-center bg-zinc-800 font-medium text-white",G[u],K[r],be[r],s),role:"img",children:typeof o=="string"&&o.length>2?o.substring(0,2):o});return e.jsxRuntimeExports.jsxs("div",{className:"relative shrink-0",children:[v(),i&&l&&e.jsxRuntimeExports.jsx("span",{"aria-label":`Status: ${l}`,className:n.twJoin("absolute right-0 bottom-0 rounded-full border-2 border-zinc-900",pe[r],fe[l]),role:"status"})]})},he=({className:t,size:s="md",subtext:o,username:i})=>{const r={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg","2xl":"text-xl"},x={sm:"text-xs",md:"text-xs",lg:"text-sm",xl:"text-sm","2xl":"text-base"};return e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("flex flex-col justify-center overflow-hidden",t),children:[e.jsxRuntimeExports.jsx("span",{className:n.twJoin("block truncate font-medium text-white",r[s]),children:i}),o&&e.jsxRuntimeExports.jsx("span",{className:n.twJoin("block truncate text-neutral-400",x[s]),children:o})]})},ge={sm:"px-1 py-0.5 text-xs",md:"px-1.5 py-0.5 text-sm",lg:"px-2 py-1 text-base"},je={purple:"bg-purple-500/25 text-purple-400",lime:"bg-lime-400/10 text-lime-300",red:"bg-red-500/25 text-red-400",yellow:"bg-yellow-500/25 text-yellow-400",green:"bg-green-500/25 text-green-400",blue:"bg-blue-500/25 text-blue-400",indigo:"bg-indigo-500/25 text-indigo-400",pink:"bg-pink-500/25 text-pink-400",amber:"bg-amber-500/25 text-amber-400",emerald:"bg-emerald-500/25 text-emerald-400",teal:"bg-teal-500/25 text-teal-400",cyan:"bg-cyan-500/25 text-cyan-400",sky:"bg-sky-500/25 text-sky-400",violet:"bg-violet-500/25 text-violet-400",fuchsia:"bg-fuchsia-500/25 text-fuchsia-400",gray:"bg-gray-500/25 text-gray-400"};function we(t){const s=t.startsWith("#")?t.substring(1):t;if(!/^[0-9A-Fa-f]{3,6}$/.test(s))return"#FFFFFF";const i=parseInt(s.length===3?s[0]+s[0]:s.substr(0,2),16),r=parseInt(s.length===3?s[1]+s[1]:s.substr(2,2),16),x=parseInt(s.length===3?s[2]+s[2]:s.substr(4,2),16);return(.299*i+.587*r+.114*x)/255>.5?"#000000":"#FFFFFF"}const q=({bgColor:t,children:s,className:o,color:i="purple",size:r="md",textColor:x})=>{const a=!t&&!x?je[i]:"",l={};return t&&(l.backgroundColor=t,x||(l.color=we(t))),x&&(l.color=x),e.jsxRuntimeExports.jsx("span",{className:n.twMerge("inline-flex items-center rounded-md font-medium",ge[r],a,o),style:Object.keys(l).length?l:void 0,children:s})},Ee={default:"bg-zinc-900/90 border border-zinc-800",outline:"bg-transparent border border-zinc-700",gradient:"bg-gradient-to-br from-zinc-900 via-purple-900/20 to-zinc-900 border border-purple-800/30"},ve={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"},Re={none:"",lift:"hover:scale-[1.01] hover:-translate-y-1",glow:"hover:shadow-lg hover:shadow-purple-500/10",border:"hover:border-purple-500/50"},ye={purple:"hover:border-purple-500/50",blue:"hover:border-blue-500/50",emerald:"hover:border-emerald-500/50",orange:"hover:border-orange-500/50",rose:"hover:border-rose-500/50",amber:"hover:border-amber-500/50",cyan:"hover:border-cyan-500/50",indigo:"hover:border-indigo-500/50"},Oe={purple:"from-purple-500/5 to-pink-500/5",blue:"from-blue-500/5 to-cyan-500/5",emerald:"from-emerald-500/5 to-teal-500/5",orange:"from-orange-500/5 to-red-500/5",rose:"from-rose-500/5 to-pink-500/5",amber:"from-amber-500/5 to-orange-500/5",cyan:"from-cyan-500/5 to-blue-500/5",indigo:"from-indigo-500/5 to-purple-500/5"},Ne=({backdropBlur:t=!1,children:s,className:o,color:i="purple",equalHeight:r=!1,hoverVariant:x="lift",hoverable:a=!1,padding:l="md",variant:u="default",...h})=>{const d=a?x:"none",p=a&&d!=="none";return e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("relative overflow-hidden rounded-lg transition-all duration-300",Ee[u],ve[l],r&&"flex flex-col",t&&"backdrop-blur-sm",p&&Re[d],p&&"group hover:bg-white/5",p&&ye[i],o),...h,children:[p&&e.jsxRuntimeExports.jsx("div",{className:n.twMerge("absolute inset-0 bg-gradient-to-br opacity-0 transition-opacity duration-300 group-hover:opacity-100",Oe[i])}),e.jsxRuntimeExports.jsx("div",{className:"relative z-10",children:s})]})},ke={purple:{border:"border-purple-500/20",bg:"bg-purple-500/10",text:"text-purple-400"},blue:{border:"border-blue-500/20",bg:"bg-blue-500/10",text:"text-blue-400"},emerald:{border:"border-emerald-500/20",bg:"bg-emerald-500/10",text:"text-emerald-400"},orange:{border:"border-orange-500/20",bg:"bg-orange-500/10",text:"text-orange-400"},rose:{border:"border-rose-500/20",bg:"bg-rose-500/10",text:"text-rose-400"},amber:{border:"border-amber-500/20",bg:"bg-amber-500/10",text:"text-amber-400"},cyan:{border:"border-cyan-500/20",bg:"bg-cyan-500/10",text:"text-cyan-400"},indigo:{border:"border-indigo-500/20",bg:"bg-indigo-500/10",text:"text-indigo-400"}},Ce=({action:t,children:s,className:o,color:i="purple",icon:r,iconColor:x,subtitle:a,title:l,...u})=>{if(s)return e.jsxRuntimeExports.jsx("div",{className:n.twMerge("mb-4",o),...u,children:s});const d=ke[x||i];return e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("mb-4 flex items-start justify-between gap-3",o),...u,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsxRuntimeExports.jsx("div",{className:n.twMerge("rounded-lg border p-2",d.border,d.bg),children:e.jsxRuntimeExports.jsx(n.OxIcon,{className:d.text,icon:r})}),e.jsxRuntimeExports.jsxs("div",{children:[l&&e.jsxRuntimeExports.jsx("h3",{className:"text-base font-semibold text-white",children:l}),a&&e.jsxRuntimeExports.jsx("p",{className:"text-sm text-neutral-400",children:a})]})]}),t&&e.jsxRuntimeExports.jsx("div",{children:t})]})},Ie=({children:t,className:s,flexGrow:o=!0,...i})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("py-2",o&&"flex-grow",s),...i,children:t}),Me=({children:t,className:s,...o})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("mt-4 flex items-center justify-end border-t border-neutral-800 pt-4",s),...o,children:t}),Se={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},ze={sm:.5,md:.7,lg:.9},Le=({checked:t,className:s,defaultChecked:o,description:i,disabled:r=!1,error:x=!1,errorMessage:a,id:l,label:u,name:h,onChange:d,required:p=!1,size:g="md",value:f,...j})=>{const v=b.useId(),R=l||v,O=`${R}-checkbox`,c=`${R}-description`,w=`${R}-error`,y=x&&a,I=e.jsxRuntimeExports.jsxs("div",{className:"relative inline-flex shrink-0",children:[e.jsxRuntimeExports.jsx("input",{id:O,"aria-describedby":[i?c:"",y?w:""].filter(Boolean).join(" ")||void 0,"aria-invalid":x,"aria-required":p,checked:t,className:n.twMerge("peer cursor-pointer appearance-none rounded-sm","checked:bg-violet-700","default-outset-focus","disabled:cursor-not-allowed disabled:opacity-50",x?"default-error-border":"default-border",Se[g],s),defaultChecked:o,disabled:r,name:h,type:"checkbox",value:f,onChange:d,...j}),e.jsxRuntimeExports.jsx(n.OxIcon,{className:"pointer-events-none absolute inset-0 m-auto opacity-0 peer-checked:opacity-80",icon:"mdiCheck",size:ze[g]||.7})]});return e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-2",children:[I,u&&e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[e.jsxRuntimeExports.jsx(M.OxLabel,{htmlFor:O,required:p,children:u}),i?e.jsxRuntimeExports.jsx(M.OxDescription,{id:c,disabled:r,children:i}):null]})]}),y?e.jsxRuntimeExports.jsx(M.OxErrorMessage,{id:w,children:a}):null]})},Y=({align:t="center",ariaHaspopup:s,children:o,className:i,content:r,contentClassName:x,contentRole:a,contentStyle:l,disabled:u=!1,id:h,offset:d=8,onOpenChange:p,open:g,portal:f=!0,position:j="top",trigger:v="hover",useAriaControls:R=!1})=>{const O=b.useId(),[c,w]=b.useState(!1),y=b.useRef(null),I=b.useRef(null),L=g!==void 0,N=u?!1:L?g:c,F=h||O,S=b.useCallback(m=>{u||(p?.(m),L||w(m))},[u,L,p]),D=b.useCallback(()=>{if(!y.current||!I.current||!N)return;const m=y.current.getBoundingClientRect(),E=I.current.getBoundingClientRect(),C={width:window.innerWidth,height:window.innerHeight};let z=j;j==="top"&&m.top<E.height+d?z="bottom":j==="bottom"&&m.bottom+E.height+d>C.height?z="top":j==="left"&&m.left<E.width+d?z="right":j==="right"&&m.right+E.width+d>C.width&&(z="left");const $=P(m,E,z,t,d);I.current&&(I.current.style.left=`${$.x}px`,I.current.style.top=`${$.y}px`)},[N,j,t,d]);b.useEffect(()=>{if(!N||v!=="click")return;const m=E=>{y.current&&!y.current.contains(E.target)&&I.current&&!I.current.contains(E.target)&&S(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[N,S,v]),b.useEffect(()=>{if(N){D();const m=()=>D(),E=()=>D();return window.addEventListener("resize",m),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",E,!0)}}},[N,j,t,d,D]);const P=(m,E,C,z,$)=>{let T=0,B=0;switch(C){case"top":T=m.left,B=m.top-E.height-$;break;case"bottom":T=m.left,B=m.bottom+$;break;case"left":T=m.left-E.width-$,B=m.top;break;case"right":T=m.right+$,B=m.top;break}if(C==="top"||C==="bottom")switch(z){case"start":break;case"center":T=m.left+(m.width-E.width)/2;break;case"end":T=m.right-E.width;break}else if(C==="left"||C==="right")switch(z){case"start":break;case"center":B=m.top+(m.height-E.height)/2;break;case"end":B=m.bottom-E.height;break}return{x:T,y:B}},W=()=>{v==="hover"&&S(!0)},V=()=>{v==="hover"&&S(!1)},H=()=>{v==="click"&&S(!N)},J=()=>{v==="focus"&&S(!0)},A=()=>{v==="focus"&&S(!1)},k=N?e.jsxRuntimeExports.jsx("div",{id:F,"aria-hidden":!N,className:n.twMerge("fixed z-50 transition-opacity duration-200",N?"opacity-100":"pointer-events-none opacity-0",x),ref:I,role:a,style:{left:-9999,top:-9999,...l},children:e.jsxRuntimeExports.jsx("div",{className:"relative",children:r})}):null;return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{"aria-controls":R&&N?F:void 0,"aria-describedby":!R&&N?F:void 0,"aria-expanded":R?N:void 0,"aria-haspopup":s,className:n.twMerge("w-full",i),ref:y,onBlur:A,onClick:H,onFocus:J,onMouseEnter:W,onMouseLeave:V,children:o}),f&&typeof document<"u"?ee.createPortal(k,document.body):k]})},Q=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}),re=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}),X=({children:t,className:s})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("sticky top-0 flex-shrink-0 border-b border-neutral-700 bg-zinc-1000/95 px-3 py-2 backdrop-blur-lg",s),children:t}),ne=b.createContext({open:!1,setOpen:()=>{},disabled:!1});function oe(){const t=b.useContext(ne);if(t===void 0)throw new Error("useDropdownContext must be used within a DropdownProvider");return t}const Z=({animateIcon:t=!1,children:s,className:o,disabled:i=!1,icon:r,outline:x=!1,unstyled:a=!1,...l})=>{const{disabled:u,open:h}=oe(),d=i||u;return e.jsxRuntimeExports.jsxs("button",{"aria-expanded":h,"aria-haspopup":"menu",className:n.twMerge(!a&&["flex h-10 items-center justify-between rounded-lg px-3 py-2 text-sm enabled:cursor-pointer enabled:text-white enabled:hover:bg-white/6","default-outset-focus",x?"default-border":"bg-transparent","default-disabled"],o),disabled:d,type:"button",...l,children:[a?s:e.jsxRuntimeExports.jsx("span",{className:"flex items-center gap-2",children:s}),r&&e.jsxRuntimeExports.jsx(n.OxIcon,{className:n.twJoin(!a&&"ml-2",d&&"text-neutral-500",t&&["transition-transform duration-200",h&&"rotate-180"]),icon:r,size:.8})]})},ie=({children:t,className:s,defaultOpen:o=!1,disabled:i=!1,onOpenChange:r,open:x})=>{const[a,l]=b.useState(o),u=x!==void 0,h=u?x:a,d=c=>{i||(u||l(c),r?.(c))},p={open:h,setOpen:d,disabled:i};let g=null,f=null;const j={children:null,className:""},v={children:null,className:""};let R={side:"bottom",align:"start",className:""};b.Children.forEach(t,c=>{if(b.isValidElement(c)){if(c.type===Z)g=c;else if(c.type===X){const w=c.props;j.className=w.className,j.children=w.children}else if(c.type===re){const w=c.props;v.className=w.className,v.children=w.children}else if(c.type===Q){const w=c.props;f=w.children,R={side:w.side||"bottom",align:w.align||"start",className:w.className||""}}}});const O=e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("default-border z-50 flex max-h-96 min-w-[8rem] flex-col overflow-hidden rounded-lg bg-zinc-1000/50 p-1 backdrop-blur-xl",R.side==="bottom"&&"animate-dropdown-in-bottom",R.side==="top"&&"animate-dropdown-in-top",R.className),children:[j.children?e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex-shrink-0 border-b border-neutral-700 bg-zinc-1000/95 px-3 py-2 backdrop-blur-sm",j.className),children:j.children}):null,e.jsxRuntimeExports.jsx("ul",{className:n.twMerge("min-h-0 flex-1 overflow-y-auto"),children:f}),v.children?e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex-shrink-0 border-t border-neutral-700 bg-zinc-1000/95 px-3 py-2 backdrop-blur-sm",v.className),children:v.children}):null]});return e.jsxRuntimeExports.jsx(ne.Provider,{value:p,children:e.jsxRuntimeExports.jsx("div",{className:n.twMerge("inline-block",s),children:e.jsxRuntimeExports.jsx(Y,{align:R.align,content:O,contentRole:"menu",disabled:i,open:h,portal:!0,position:R.side,trigger:"click",onOpenChange:d,children:g})})})},le=({children:t,className:s,disabled:o=!1,icon:i,onClick:r,unstyled:x=!1})=>{const{setOpen:a}=oe(),l=u=>{o||(r&&r(u),a(!1))};return e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsxs("button",{className:n.twMerge(!x&&["group flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm enabled:text-white","enabled:cursor-pointer enabled:hover:bg-white/6","default-inset-focus","default-disabled"],s),disabled:o,role:"menuitem",onClick:l,children:[i&&e.jsxRuntimeExports.jsx(n.OxIcon,{className:n.twJoin("mr-2",o&&"text-neutral-500"),icon:i,size:.75}),t]})})},Fe=({className:t})=>e.jsxRuntimeExports.jsx("li",{className:"px-1 py-1",children:e.jsxRuntimeExports.jsx("hr",{className:n.twMerge("border-t-neutral-700",t)})}),De=({children:t,className:s})=>e.jsxRuntimeExports.jsx("span",{className:n.twMerge("ml-auto text-xs tracking-widest text-neutral-500",s),"data-part":"dropdown-shortcut",children:t}),$e={error:{background:"bg-rose-500/20",iconClass:"text-rose-400",icon:"mdiAlertCircleOutline"},success:{background:"bg-green-500/20",iconClass:"text-green-400",icon:"mdiCheckCircleOutline"},warning:{background:"bg-amber-500/20",iconClass:"text-amber-400",icon:"mdiAlertOutline"},info:{background:"bg-blue-500/20",iconClass:"text-blue-400",icon:"mdiInformationOutline"},default:{background:"bg-neutral-500/20",iconClass:"text-neutral-400",icon:"mdiBellOutline"}},Te=({className:t,disabled:s=!1,emptyMessage:o="No notifications",maxHeight:i="max-h-96",notifications:r,onMarkAllRead:x,onNotificationClick:a,unreadCount:l=0})=>{const[u,h]=b.useState(!1),[d,p]=b.useState(!1),g=l>99?"99+":l.toString(),f=l>0,j=r.length>0;b.useEffect(()=>{const c=()=>{const w=window.innerWidth<de.MOBILE_BREAKPOINT;p(w),w&&u?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")};return c(),window.addEventListener("resize",c),()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("resize",c)}},[u]);const v=c=>{a?.(c),d&&h(!1)},R=()=>{x?.(),d&&h(!1)},O=()=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:j?e.jsxRuntimeExports.jsx("div",{className:"divide-y divide-neutral-800/50",children:r.map((c,w)=>{const y=$e[c.type||"default"];return e.jsxRuntimeExports.jsxs(le,{className:n.twMerge("secondary-inset-focus flex w-full items-start gap-3 px-3 py-3 text-left hover:bg-white/6",!c.read&&"bg-white/3",w===r.length-1&&"pb-4"),unstyled:!0,onClick:()=>v(c),children:[e.jsxRuntimeExports.jsx("div",{className:n.twMerge("mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",y.background),children:c.img?e.jsxRuntimeExports.jsx(se,{alt:"User avatar",fallback:"NA",size:"md",src:c.img}):e.jsxRuntimeExports.jsx(n.OxIcon,{className:y.iconClass,icon:c.icon??y.icon,size:.75})}),e.jsxRuntimeExports.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxRuntimeExports.jsx("p",{className:"mb-1 text-sm leading-5 text-white",children:c.title}),c.message&&e.jsxRuntimeExports.jsx("p",{className:"mb-1 text-xs leading-4 text-neutral-400",children:c.message}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-neutral-500",children:ue.formatTimestamp(c.timestamp)})]}),!c.read&&e.jsxRuntimeExports.jsx("div",{className:"mt-1.5 h-2 w-2 flex-shrink-0 rounded-full bg-rose-500"})]},c.id)})}):e.jsxRuntimeExports.jsxs("div",{"aria-label":"No notifications available",className:"px-3 py-8 text-center",role:"status",children:[e.jsxRuntimeExports.jsx(n.OxIcon,{className:"mx-auto mb-2 text-neutral-500",icon:"mdiBellOffOutline",size:2}),e.jsxRuntimeExports.jsx("p",{className:"text-sm text-neutral-400",children:o})]})});return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d?e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"relative",children:[e.jsxRuntimeExports.jsx(n.OxButton,{"aria-expanded":u,"aria-label":`Notifications${f?` (${l} unread)`:""}`,disabled:s,icon:"mdiBellOutline",variant:"ghost",onClick:()=>h(!u)}),f?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{className:"absolute -top-2 -right-2",children:e.jsxRuntimeExports.jsx(q,{className:"min-w-[1.25rem] justify-center px-1",color:"violet",size:"sm",children:g})})}):null]}),ee.createPortal(e.jsxRuntimeExports.jsxs("div",{"aria-labelledby":"notifications-title-mobile","aria-modal":"true",className:n.twMerge("fixed inset-y-0 z-50 flex w-full flex-col bg-zinc-1000/50 backdrop-blur-xl transition-transform duration-300",u?"translate-x-0":"translate-x-full"),role:"dialog",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-15 items-center justify-between border-b border-neutral-800 px-4",children:[d?e.jsxRuntimeExports.jsx(n.OxButton,{"aria-label":"Close sidebar",icon:"mdiClose",variant:"ghost",onClick:()=>h(!1)}):null,e.jsxRuntimeExports.jsx("h3",{id:"notifications-title-mobile",className:"text-sm font-semibold text-white",children:"Notifications"}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:f&&x&&e.jsxRuntimeExports.jsx("button",{className:"cursor-pointer text-xs text-neutral-400 transition-colors hover:text-white",onClick:R,children:"Mark all read"})})]}),e.jsxRuntimeExports.jsx("ul",{className:"flex-1 overflow-y-auto",children:e.jsxRuntimeExports.jsx(O,{})})]}),document.body)]}):e.jsxRuntimeExports.jsxs(ie,{className:t,disabled:s,children:[e.jsxRuntimeExports.jsx(Z,{"aria-label":`Notifications${f?` (${l} unread)`:""}`,className:n.twJoin("relative flex h-10 w-10 items-center justify-center px-2 text-sm","secondary-outset-focus group rounded-lg border border-transparent bg-transparent text-white enabled:cursor-pointer enabled:hover:bg-white/6"),disabled:s,icon:"mdiBellOutline",unstyled:!0,children:f?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{className:"absolute -top-2 -right-2",children:e.jsxRuntimeExports.jsx(q,{className:"min-w-[1.25rem] justify-center px-1",color:"violet",size:"sm",children:g})})}):null}),e.jsxRuntimeExports.jsx(X,{children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxRuntimeExports.jsx("h3",{id:"notifications-title",className:"text-sm font-semibold text-white",children:"Notifications"}),f&&x&&e.jsxRuntimeExports.jsx("button",{className:"secondary-outset-focus cursor-pointer rounded-lg p-1 text-xs text-neutral-400 transition-colors hover:text-white",onClick:x,children:"Mark all read"})]})}),e.jsxRuntimeExports.jsx(Q,{align:"end","aria-labelledby":"notifications-title",className:n.twMerge("flex w-85 flex-col overflow-hidden p-0",i),side:"bottom",children:e.jsxRuntimeExports.jsx(O,{})})]})})},ae=b.createContext(void 0),Be=()=>{const t=b.useContext(ae);if(!t)throw new Error("Select components must be used within an OxSelect");return t},xe=({children:t,className:s,disabled:o=!1,id:i,value:r})=>{const{closeDropdown:x,onSelect:a,selectedValue:l}=Be(),u=()=>{a({value:r,label:t})},h=p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a({value:r,label:t})),p.key==="Escape"&&x()},d=l.includes(r);return e.jsxRuntimeExports.jsx("li",{role:"none",children:e.jsxRuntimeExports.jsxs("button",{id:i,"aria-selected":d,className:n.twMerge("group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm enabled:text-white","enabled:cursor-pointer enabled:hover:bg-white/6","default-inset-focus","default-disabled",d&&"bg-white/5",s),disabled:o,role:"option",tabIndex:o?-1:0,onClick:u,onKeyDown:h,children:[t,d&&!o&&e.jsxRuntimeExports.jsx(n.OxIcon,{className:"text-violet-700",icon:"mdiCheck",size:.8})]})})};let U=null,_=null;const Pe=()=>(U||(U=document.createElement("canvas"),_=U.getContext("2d"),_.font="0.875rem system-ui, sans-serif"),_),We=(t,s,o)=>{if(t.length===0)return[];if(!s.current)return t.slice(0,1);const i=s.current.offsetWidth||0,r=12,x=32,a=32;let l=i-r-x;t.length>1&&(l-=a);const u=Pe();if(!u)return t.slice(0,2);const h=o?4:8,d=o?12:0;let p=0,g=0;for(let f=0;f<t.length;f++){const j=t[f],v=String(j.label),O=u.measureText(v).width+(o?d:0),c=f>0?p+O+h:p+O;if(c<=l)p=c,g++;else break}return g=Math.max(1,g),t.slice(0,g)},He=t=>t==null?[]:Array.isArray(t)?t:[t],qe=({badgeColor:t="purple",children:s,className:o,defaultValue:i=null,description:r,disabled:x=!1,displayAsBadges:a=!1,error:l=!1,errorMessage:u,id:h,label:d,multiple:p=!1,name:g,onChange:f,placeholder:j="Select an option",required:v=!1})=>{const R=b.useId(),O=b.useRef(null),[c,w]=b.useState(!1),[y,I]=b.useState([]),L=h||R,N=`${L}-select`,F=`${L}-description`,S=`${L}-error`,D=l&&u,P=(k,m)=>{let E=null;return b.Children.forEach(k,C=>{if(b.isValidElement(C)&&C.type===xe){const z=C.props;z.value===m&&(E={value:z.value,label:z.children})}}),E},W=k=>{let m;if(p?y.some(C=>C.value===k.value)?m=y.filter(C=>C.value!==k.value):m=[...y,k]:(m=[k],w(!1)),I(m),f){const E=p?m.map(C=>C.value):m[0]?.value??null;f(E)}};b.useEffect(()=>{if(i!==void 0){const k=He(i),m=[];k.forEach(E=>{const C=P(s,E);C&&m.push(C)}),I(p?m:m.slice(0,1))}},[i,s,p]);const V=e.jsxRuntimeExports.jsx("ul",{id:`${N}-listbox`,"aria-multiselectable":p,className:"max-h-72 space-y-0.5 overflow-hidden overflow-y-auto",role:"listbox",children:s}),H=We(y,O,a),J=y.length-H.length,A=J>0;return e.jsxRuntimeExports.jsx(ae.Provider,{value:{selectedValue:y.map(k=>k.value),multiple:p,onSelect:W,closeDropdown:()=>w(!1)},children:e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("flex w-full flex-col gap-1",o),children:[d&&e.jsxRuntimeExports.jsx(M.OxLabel,{htmlFor:N,required:v,children:d}),e.jsxRuntimeExports.jsx(Y,{align:"start",content:V,contentClassName:"default-border bg-zinc-1000/70 rounded-lg p-1 backdrop-blur-xl animate-dropdown-in-bottom",contentStyle:{minWidth:`${O.current?.offsetWidth||200}px`},disabled:x,open:c,position:"bottom",trigger:"click",onOpenChange:w,children:e.jsxRuntimeExports.jsxs("button",{id:N,"aria-controls":`${N}-listbox`,"aria-describedby":[r?F:"",D?S:""].filter(Boolean).join(" ")||void 0,"aria-disabled":x,"aria-expanded":c,"aria-haspopup":"listbox","aria-invalid":l,"aria-required":v,className:n.twJoin("relative flex h-10 w-full gap-x-2 rounded-lg py-2 ps-3 pe-8 text-start text-sm enabled:cursor-pointer enabled:text-white","default-outset-focus default-disabled",l?"default-error-border":"default-border",c&&"default-active-border"),disabled:x,ref:O,role:"combobox",type:"button",children:[e.jsxRuntimeExports.jsx("span",{className:n.twJoin("w-full overflow-hidden text-ellipsis",a?p&&"flex flex-wrap gap-1":"whitespace-nowrap",x&&a&&"opacity-50"),children:y.length>0?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&p?H.map(k=>e.jsxRuntimeExports.jsx(q,{color:t,size:"sm",children:k.label},String(k.value))):H.map((k,m,E)=>e.jsxRuntimeExports.jsxs(b.Fragment,{children:[k.label,m<E.length-1&&", "]},String(k.value))),A&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!(a&&p)&&" ",e.jsxRuntimeExports.jsxs(q,{color:t,size:"sm",children:["+",J]})]})]}):j}),e.jsxRuntimeExports.jsx("div",{className:"absolute end-3 top-1/2 -translate-y-1/2",children:e.jsxRuntimeExports.jsx(n.OxIcon,{className:n.twJoin("transition-transform duration-300 ease-in-out",x&&"text-neutral-500",c&&"rotate-180"),icon:"mdiChevronDown",size:.8})})]})}),g&&e.jsxRuntimeExports.jsx("input",{name:g,type:"hidden",value:y.map(k=>k.value).join(",")}),r&&e.jsxRuntimeExports.jsx(M.OxDescription,{id:F,disabled:x,children:r}),D&&e.jsxRuntimeExports.jsx(M.OxErrorMessage,{id:S,children:u})]})})},Je=({children:t,className:s})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("px-2 py-1 text-xs font-medium text-neutral-400",s),children:t}),Ve={default:"bg-zinc-800/80",purple:"bg-purple-950/50",blue:"bg-blue-950/50",gray:"bg-gray-800/50"},Ae={rectangle:"rounded-md",circle:"rounded-full"},ce=({animate:t=!0,className:s,color:o="default",fullWidth:i=!1,height:r,shape:x="rectangle",width:a,...l})=>{const u={height:typeof r=="number"?`${r}px`:r,width:typeof a=="number"?`${a}px`:a};return e.jsxRuntimeExports.jsx("div",{"aria-busy":"true","aria-label":"Loading...",className:n.twMerge("relative overflow-hidden",Ve[o],Ae[x],t&&"animate-pulse",i&&"w-full",s),role:"status",style:u,...l})},Ge=({animate:t=!0,className:s,color:o="default",fullWidth:i=!1,gap:r=8,height:x=20,lines:a=1,width:l,...u})=>{const h=g=>g<=1?`${g*100}%`:`${g}px`,d=g=>{if(!i){if(Array.isArray(l)){const f=l[g%l.length];return f==null?void 0:typeof f=="number"?h(f):f}if(typeof l=="number"){if(a>1&&g===a-1){const f=l<=1?l*.6:Math.max(100,l*.6);return h(f)}return h(l)}return"200px"}},p={4:"space-y-1",8:"space-y-2",12:"space-y-3",16:"space-y-4",20:"space-y-5"}[r]||"space-y-2";return e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex flex-col",p,s),...u,children:Array.from({length:a}).map((g,f)=>e.jsxRuntimeExports.jsx(ce,{animate:t,color:o,fullWidth:i,height:x,width:d(f)},f))})},Ke=({className:t,description:s,disabled:o=!1,error:i=!1,errorMessage:r,id:x,label:a,name:l,onChange:u,placeholder:h="Enter text...",readOnly:d=!1,required:p=!1,rows:g=3,showMaxLength:f=!1,value:j,...v})=>{const R=b.useId(),[O,c]=b.useState(typeof j=="string"?j.length:0),w=x||R,y=`${w}-textarea`,I=`${w}-description`,L=`${w}-error`,N=v.maxLength,F=i&&r;b.useEffect(()=>{typeof j=="string"&&c(j.length)},[j]);const S=P=>{const W=P.target.value.length;c(W),u?.(P)},D=e.jsxRuntimeExports.jsx("textarea",{id:y,"aria-describedby":[s?I:"",F?L:""].filter(Boolean).join(" ")||void 0,"aria-invalid":i,"aria-required":p,className:n.twMerge("flex min-h-10 w-full resize-y rounded-lg bg-transparent px-2 py-2 text-sm text-white","placeholder:text-neutral-500","default-outset-focus","default-disabled",i?"default-error-border":"default-border",t),disabled:o,name:l,placeholder:h,readOnly:d,rows:g,value:j,onChange:S,...v});return e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[a?e.jsxRuntimeExports.jsx(M.OxLabel,{htmlFor:y,required:p,children:a}):null,D,f&&typeof N=="number"?e.jsxRuntimeExports.jsxs("div",{className:"pointer-events-none mt-1 text-right text-xs text-neutral-400",children:[O,"/",N]}):null,s?e.jsxRuntimeExports.jsx(M.OxDescription,{id:I,disabled:o,children:s}):null,F?e.jsxRuntimeExports.jsx(M.OxErrorMessage,{id:L,children:r}):null]})},Ue={default:"default-border backdrop-blur-xl text-white bg-zinc-1000/70",error:"bg-red-900/70 text-red-200 border-red-700",warning:"bg-amber-900/70 text-amber-200 border-amber-700",info:"bg-blue-900/70 text-blue-200 border-blue-700",success:"bg-green-900/70 text-green-200 border-green-700"},_e=({align:t="center",children:s,className:o,content:i,disabled:r=!1,id:x,onOpenChange:a,open:l,position:u="top",trigger:h="hover",variant:d="default"})=>{const p=e.jsxRuntimeExports.jsx("div",{className:n.twMerge("max-w-xs rounded-md border px-2 py-1 text-xs break-words backdrop-blur-sm",Ue[d],o),children:i});return e.jsxRuntimeExports.jsx(Y,{id:x,align:t,content:p,contentRole:"tooltip",disabled:r,offset:8,open:l,position:u,trigger:h,useAriaControls:!1,onOpenChange:a,children:s})},Ye=({children:t,onAuthenticated:s=null,onLoading:o=null})=>{const{isLoggedIn:i,loading:r}=te.useOxAuth();return r?o:i?s:t},Qe=({children:t,onLoading:s=null,onUnauthenticated:o=null})=>{const{isLoggedIn:i,loading:r}=te.useOxAuth();return r?s:i?t:o};exports.OxButton=n.OxButton;exports.OxIcon=n.OxIcon;exports.OxDescription=M.OxDescription;exports.OxErrorMessage=M.OxErrorMessage;exports.OxForm=M.OxForm;exports.OxInput=M.OxInput;exports.OxLabel=M.OxLabel;exports.OxAvatar=me;exports.OxAvatarImage=se;exports.OxAvatarText=he;exports.OxBadge=q;exports.OxCard=Ne;exports.OxCardContent=Ie;exports.OxCardFooter=Me;exports.OxCardHeader=Ce;exports.OxCheckbox=Le;exports.OxDropdown=ie;exports.OxDropdownContent=Q;exports.OxDropdownFooter=re;exports.OxDropdownHeader=X;exports.OxDropdownItem=le;exports.OxDropdownSeparator=Fe;exports.OxDropdownShortcut=De;exports.OxDropdownTrigger=Z;exports.OxGuestRoute=Ye;exports.OxNotificationDropdown=Te;exports.OxProtectedRoute=Qe;exports.OxSelect=qe;exports.OxSelectLabel=Je;exports.OxSelectOption=xe;exports.OxSkeleton=ce;exports.OxSkeletonText=Ge;exports.OxTextarea=Ke;exports.OxTooltip=_e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const e=require("./chunks/jsx-runtime-CITbqOLs.js"),b=require("react"),n=require("./chunks/Button-D-v4l8ZE.js"),M=require("./chunks/Input-CLi1H63d.js"),ee=require("react-dom"),de=require("./chunks/constants-B1_n9ezb.js"),ue=require("./chunks/formatTimestamp-TTsNcy7u.js"),te=require("./chunks/useAuth-BDiob4Rb.js"),me=({children:t,className:s})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex items-center gap-3",s),children:t}),G={rounded:"rounded-full",square:"rounded-lg"},K={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10",xl:"h-12 w-12","2xl":"h-16 w-16"},pe={sm:"h-2 w-2",md:"h-2.5 w-2.5",lg:"h-3 w-3",xl:"h-3.5 w-3.5","2xl":"h-4 w-4"},fe={online:"bg-green-500",offline:"bg-neutral-500",away:"bg-yellow-500",busy:"bg-red-500"},be={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-base","2xl":"text-lg"},se=({alt:t,className:s,fallback:o,showStatus:i=!1,size:r="md",skeleton:x=!1,src:a,status:l,type:u="square"})=>{const[h,d]=b.useState(!1),[p,g]=b.useState(!1),[f,j]=b.useState(!0);b.useEffect(()=>{if(!a){d(!1),g(!0),j(!1);return}j(!0);const R=new Image;R.src=a;const O=()=>{d(!0),g(!1),j(!1)},c=()=>{d(!1),g(!0),j(!1)};return R.addEventListener("load",O),R.addEventListener("error",c),()=>{R.removeEventListener("load",O),R.removeEventListener("error",c)}},[a]);const v=()=>f&&x?e.jsxRuntimeExports.jsx("div",{className:n.twJoin("animate-pulse bg-zinc-800",G[u],K[r])}):h&&!p?e.jsxRuntimeExports.jsx("img",{alt:t,className:n.twMerge(G[u],K[r],"object-cover",s),loading:"lazy",src:a}):e.jsxRuntimeExports.jsx("div",{"aria-label":t,className:n.twMerge("flex items-center justify-center bg-zinc-800 font-medium text-white",G[u],K[r],be[r],s),role:"img",children:typeof o=="string"&&o.length>2?o.substring(0,2):o});return e.jsxRuntimeExports.jsxs("div",{className:"relative shrink-0",children:[v(),i&&l&&e.jsxRuntimeExports.jsx("span",{"aria-label":`Status: ${l}`,className:n.twJoin("absolute right-0 bottom-0 rounded-full border-2 border-zinc-900",pe[r],fe[l]),role:"status"})]})},he=({className:t,size:s="md",subtext:o,username:i})=>{const r={sm:"text-xs",md:"text-sm",lg:"text-base",xl:"text-lg","2xl":"text-xl"},x={sm:"text-xs",md:"text-xs",lg:"text-sm",xl:"text-sm","2xl":"text-base"};return e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("flex flex-col justify-center overflow-hidden",t),children:[e.jsxRuntimeExports.jsx("span",{className:n.twJoin("block truncate font-medium text-white",r[s]),children:i}),o&&e.jsxRuntimeExports.jsx("span",{className:n.twJoin("block truncate text-neutral-400",x[s]),children:o})]})},ge={sm:"px-1 py-0.5 text-xs",md:"px-1.5 py-0.5 text-sm",lg:"px-2 py-1 text-base"},je={purple:"bg-purple-500/25 text-purple-400",lime:"bg-lime-400/10 text-lime-300",red:"bg-red-500/25 text-red-400",yellow:"bg-yellow-500/25 text-yellow-400",green:"bg-green-500/25 text-green-400",blue:"bg-blue-500/25 text-blue-400",indigo:"bg-indigo-500/25 text-indigo-400",pink:"bg-pink-500/25 text-pink-400",amber:"bg-amber-500/25 text-amber-400",emerald:"bg-emerald-500/25 text-emerald-400",teal:"bg-teal-500/25 text-teal-400",cyan:"bg-cyan-500/25 text-cyan-400",sky:"bg-sky-500/25 text-sky-400",violet:"bg-violet-500/25 text-violet-400",fuchsia:"bg-fuchsia-500/25 text-fuchsia-400",gray:"bg-gray-500/25 text-gray-400"};function we(t){const s=t.startsWith("#")?t.substring(1):t;if(!/^[0-9A-Fa-f]{3,6}$/.test(s))return"#FFFFFF";const i=parseInt(s.length===3?s[0]+s[0]:s.substr(0,2),16),r=parseInt(s.length===3?s[1]+s[1]:s.substr(2,2),16),x=parseInt(s.length===3?s[2]+s[2]:s.substr(4,2),16);return(.299*i+.587*r+.114*x)/255>.5?"#000000":"#FFFFFF"}const q=({bgColor:t,children:s,className:o,color:i="purple",size:r="md",textColor:x})=>{const a=!t&&!x?je[i]:"",l={};return t&&(l.backgroundColor=t,x||(l.color=we(t))),x&&(l.color=x),e.jsxRuntimeExports.jsx("span",{className:n.twMerge("inline-flex items-center rounded-md font-medium",ge[r],a,o),style:Object.keys(l).length?l:void 0,children:s})},Ee={default:"bg-zinc-900/90 border border-zinc-800",outline:"bg-transparent border border-zinc-700",gradient:"bg-gradient-to-br from-zinc-900 via-purple-900/20 to-zinc-900 border border-purple-800/30"},ve={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"},Re={none:"",lift:"hover:scale-[1.01] hover:-translate-y-1",glow:"hover:shadow-lg hover:shadow-purple-500/10",border:"hover:border-purple-500/50"},ye={purple:"hover:border-purple-500/50",blue:"hover:border-blue-500/50",emerald:"hover:border-emerald-500/50",orange:"hover:border-orange-500/50",rose:"hover:border-rose-500/50",amber:"hover:border-amber-500/50",cyan:"hover:border-cyan-500/50",indigo:"hover:border-indigo-500/50"},Oe={purple:"from-purple-500/5 to-pink-500/5",blue:"from-blue-500/5 to-cyan-500/5",emerald:"from-emerald-500/5 to-teal-500/5",orange:"from-orange-500/5 to-red-500/5",rose:"from-rose-500/5 to-pink-500/5",amber:"from-amber-500/5 to-orange-500/5",cyan:"from-cyan-500/5 to-blue-500/5",indigo:"from-indigo-500/5 to-purple-500/5"},Ne=({backdropBlur:t=!1,children:s,className:o,color:i="purple",equalHeight:r=!1,hoverVariant:x="lift",hoverable:a=!1,padding:l="md",variant:u="default",...h})=>{const d=a?x:"none",p=a&&d!=="none";return e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("relative overflow-hidden rounded-lg transition-all duration-300",Ee[u],ve[l],r&&"flex flex-col",t&&"backdrop-blur-sm",p&&Re[d],p&&"group hover:bg-white/5",p&&ye[i],o),...h,children:[p&&e.jsxRuntimeExports.jsx("div",{className:n.twMerge("absolute inset-0 bg-gradient-to-br opacity-0 transition-opacity duration-300 group-hover:opacity-100",Oe[i])}),e.jsxRuntimeExports.jsx("div",{className:"relative z-10",children:s})]})},ke={purple:{border:"border-purple-500/20",bg:"bg-purple-500/10",text:"text-purple-400"},blue:{border:"border-blue-500/20",bg:"bg-blue-500/10",text:"text-blue-400"},emerald:{border:"border-emerald-500/20",bg:"bg-emerald-500/10",text:"text-emerald-400"},orange:{border:"border-orange-500/20",bg:"bg-orange-500/10",text:"text-orange-400"},rose:{border:"border-rose-500/20",bg:"bg-rose-500/10",text:"text-rose-400"},amber:{border:"border-amber-500/20",bg:"bg-amber-500/10",text:"text-amber-400"},cyan:{border:"border-cyan-500/20",bg:"bg-cyan-500/10",text:"text-cyan-400"},indigo:{border:"border-indigo-500/20",bg:"bg-indigo-500/10",text:"text-indigo-400"}},Ce=({action:t,children:s,className:o,color:i="purple",icon:r,iconColor:x,subtitle:a,title:l,...u})=>{if(s)return e.jsxRuntimeExports.jsx("div",{className:n.twMerge("mb-4",o),...u,children:s});const d=ke[x||i];return e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("mb-4 flex items-start justify-between gap-3",o),...u,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-3",children:[r&&e.jsxRuntimeExports.jsx("div",{className:n.twMerge("rounded-lg border p-2",d.border,d.bg),children:e.jsxRuntimeExports.jsx(n.OxIcon,{className:d.text,icon:r})}),e.jsxRuntimeExports.jsxs("div",{children:[l&&e.jsxRuntimeExports.jsx("h3",{className:"text-base font-semibold text-white",children:l}),a&&e.jsxRuntimeExports.jsx("p",{className:"text-sm text-neutral-400",children:a})]})]}),t&&e.jsxRuntimeExports.jsx("div",{children:t})]})},Ie=({children:t,className:s,flexGrow:o=!0,...i})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("py-2",o&&"flex-grow",s),...i,children:t}),Me=({children:t,className:s,...o})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("mt-4 flex items-center justify-end border-t border-neutral-800 pt-4",s),...o,children:t}),Se={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6"},ze={sm:.5,md:.7,lg:.9},Le=({checked:t,className:s,defaultChecked:o,description:i,disabled:r=!1,error:x=!1,errorMessage:a,id:l,label:u,name:h,onChange:d,required:p=!1,size:g="md",value:f,...j})=>{const v=b.useId(),R=l||v,O=`${R}-checkbox`,c=`${R}-description`,w=`${R}-error`,y=x&&a,I=e.jsxRuntimeExports.jsxs("div",{className:"relative inline-flex shrink-0",children:[e.jsxRuntimeExports.jsx("input",{id:O,"aria-describedby":[i?c:"",y?w:""].filter(Boolean).join(" ")||void 0,"aria-invalid":x,"aria-required":p,checked:t,className:n.twMerge("peer cursor-pointer appearance-none rounded-sm","checked:bg-violet-700","default-outset-focus","disabled:cursor-not-allowed disabled:opacity-50",x?"default-error-border":"default-border",Se[g],s),defaultChecked:o,disabled:r,name:h,type:"checkbox",value:f,onChange:d,...j}),e.jsxRuntimeExports.jsx(n.OxIcon,{className:"pointer-events-none absolute inset-0 m-auto opacity-0 peer-checked:opacity-80",icon:"mdiCheck",size:ze[g]||.7})]});return e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-start gap-2",children:[I,u&&e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[e.jsxRuntimeExports.jsx(M.OxLabel,{htmlFor:O,required:p,children:u}),i?e.jsxRuntimeExports.jsx(M.OxDescription,{id:c,disabled:r,children:i}):null]})]}),y?e.jsxRuntimeExports.jsx(M.OxErrorMessage,{id:w,children:a}):null]})},Y=({align:t="center",ariaHaspopup:s,children:o,className:i,content:r,contentClassName:x,contentRole:a,contentStyle:l,disabled:u=!1,id:h,offset:d=8,onOpenChange:p,open:g,portal:f=!0,position:j="top",trigger:v="hover",useAriaControls:R=!1})=>{const O=b.useId(),[c,w]=b.useState(!1),y=b.useRef(null),I=b.useRef(null),L=g!==void 0,N=u?!1:L?g:c,F=h||O,S=b.useCallback(m=>{u||(p?.(m),L||w(m))},[u,L,p]),D=b.useCallback(()=>{if(!y.current||!I.current||!N)return;const m=y.current.getBoundingClientRect(),E=I.current.getBoundingClientRect(),C={width:window.innerWidth,height:window.innerHeight};let z=j;j==="top"&&m.top<E.height+d?z="bottom":j==="bottom"&&m.bottom+E.height+d>C.height?z="top":j==="left"&&m.left<E.width+d?z="right":j==="right"&&m.right+E.width+d>C.width&&(z="left");const $=P(m,E,z,t,d);I.current&&(I.current.style.left=`${$.x}px`,I.current.style.top=`${$.y}px`)},[N,j,t,d]);b.useEffect(()=>{if(!N||v!=="click")return;const m=E=>{y.current&&!y.current.contains(E.target)&&I.current&&!I.current.contains(E.target)&&S(!1)};return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[N,S,v]),b.useEffect(()=>{if(N){D();const m=()=>D(),E=()=>D();return window.addEventListener("resize",m),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",E,!0)}}},[N,j,t,d,D]);const P=(m,E,C,z,$)=>{let T=0,B=0;switch(C){case"top":T=m.left,B=m.top-E.height-$;break;case"bottom":T=m.left,B=m.bottom+$;break;case"left":T=m.left-E.width-$,B=m.top;break;case"right":T=m.right+$,B=m.top;break}if(C==="top"||C==="bottom")switch(z){case"start":break;case"center":T=m.left+(m.width-E.width)/2;break;case"end":T=m.right-E.width;break}else if(C==="left"||C==="right")switch(z){case"start":break;case"center":B=m.top+(m.height-E.height)/2;break;case"end":B=m.bottom-E.height;break}return{x:T,y:B}},W=()=>{v==="hover"&&S(!0)},V=()=>{v==="hover"&&S(!1)},H=()=>{v==="click"&&S(!N)},J=()=>{v==="focus"&&S(!0)},A=()=>{v==="focus"&&S(!1)},k=N?e.jsxRuntimeExports.jsx("div",{id:F,"aria-hidden":!N,className:n.twMerge("fixed z-50 transition-opacity duration-200",N?"opacity-100":"pointer-events-none opacity-0",x),ref:I,role:a,style:{left:-9999,top:-9999,...l},children:e.jsxRuntimeExports.jsx("div",{className:"relative",children:r})}):null;return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{"aria-controls":R&&N?F:void 0,"aria-describedby":!R&&N?F:void 0,"aria-expanded":R?N:void 0,"aria-haspopup":s,className:n.twMerge("w-full",i),ref:y,onBlur:A,onClick:H,onFocus:J,onMouseEnter:W,onMouseLeave:V,children:o}),f&&typeof document<"u"?ee.createPortal(k,document.body):k]})},Q=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}),re=({children:t})=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t}),X=({children:t,className:s})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("sticky top-0 flex-shrink-0 border-b border-neutral-700 bg-zinc-1000/95 px-3 py-2 backdrop-blur-lg",s),children:t}),ne=b.createContext({open:!1,setOpen:()=>{},disabled:!1});function oe(){const t=b.useContext(ne);if(t===void 0)throw new Error("useDropdownContext must be used within a DropdownProvider");return t}const Z=({animateIcon:t=!1,children:s,className:o,disabled:i=!1,icon:r,outline:x=!1,unstyled:a=!1,...l})=>{const{disabled:u,open:h}=oe(),d=i||u;return e.jsxRuntimeExports.jsxs("button",{"aria-expanded":h,"aria-haspopup":"menu",className:n.twMerge(!a&&["flex h-10 items-center justify-between rounded-lg px-3 py-2 text-sm enabled:cursor-pointer enabled:text-white enabled:hover:bg-white/6","default-outset-focus",x?"default-border":"bg-transparent","default-disabled"],o),disabled:d,type:"button",...l,children:[a?s:e.jsxRuntimeExports.jsx("span",{className:"flex items-center gap-2",children:s}),r&&e.jsxRuntimeExports.jsx(n.OxIcon,{className:n.twJoin(!a&&"ml-2",d&&"text-neutral-500",t&&["transition-transform duration-200",h&&"rotate-180"]),icon:r,size:.8})]})},ie=({children:t,className:s,defaultOpen:o=!1,disabled:i=!1,onOpenChange:r,open:x})=>{const[a,l]=b.useState(o),u=x!==void 0,h=u?x:a,d=c=>{i||(u||l(c),r?.(c))},p={open:h,setOpen:d,disabled:i};let g=null,f=null;const j={children:null,className:""},v={children:null,className:""};let R={side:"bottom",align:"start",className:""};b.Children.forEach(t,c=>{if(b.isValidElement(c)){if(c.type===Z)g=c;else if(c.type===X){const w=c.props;j.className=w.className,j.children=w.children}else if(c.type===re){const w=c.props;v.className=w.className,v.children=w.children}else if(c.type===Q){const w=c.props;f=w.children,R={side:w.side||"bottom",align:w.align||"start",className:w.className||""}}}});const O=e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("default-border z-50 flex max-h-96 min-w-[8rem] flex-col overflow-hidden rounded-lg bg-zinc-1000/50 p-1 backdrop-blur-xl",R.side==="bottom"&&"animate-dropdown-in-bottom",R.side==="top"&&"animate-dropdown-in-top",R.className),children:[j.children?e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex-shrink-0 border-b border-neutral-700 bg-zinc-1000/95 px-3 py-2 backdrop-blur-sm",j.className),children:j.children}):null,e.jsxRuntimeExports.jsx("ul",{className:n.twMerge("min-h-0 flex-1 overflow-y-auto"),children:f}),v.children?e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex-shrink-0 border-t border-neutral-700 bg-zinc-1000/95 px-3 py-2 backdrop-blur-sm",v.className),children:v.children}):null]});return e.jsxRuntimeExports.jsx(ne.Provider,{value:p,children:e.jsxRuntimeExports.jsx("div",{className:n.twMerge("inline-block",s),children:e.jsxRuntimeExports.jsx(Y,{align:R.align,content:O,contentRole:"menu",disabled:i,open:h,portal:!0,position:R.side,trigger:"click",onOpenChange:d,children:g})})})},le=({children:t,className:s,disabled:o=!1,icon:i,onClick:r,unstyled:x=!1})=>{const{setOpen:a}=oe(),l=u=>{o||(r&&r(u),a(!1))};return e.jsxRuntimeExports.jsx("li",{children:e.jsxRuntimeExports.jsxs("button",{className:n.twMerge(!x&&["group flex w-full items-center rounded-sm px-2 py-1.5 text-left text-sm enabled:text-white","enabled:cursor-pointer enabled:hover:bg-white/6","default-inset-focus","default-disabled"],s),disabled:o,role:"menuitem",onClick:l,children:[i&&e.jsxRuntimeExports.jsx(n.OxIcon,{className:n.twJoin("mr-2",o&&"text-neutral-500"),icon:i,size:.75}),t]})})},Fe=({className:t})=>e.jsxRuntimeExports.jsx("li",{className:"px-1 py-1",children:e.jsxRuntimeExports.jsx("hr",{className:n.twMerge("border-t-neutral-700",t)})}),De=({children:t,className:s})=>e.jsxRuntimeExports.jsx("span",{className:n.twMerge("ml-auto text-xs tracking-widest text-neutral-500",s),"data-part":"dropdown-shortcut",children:t}),$e={error:{background:"bg-rose-500/20",iconClass:"text-rose-400",icon:"mdiAlertCircleOutline"},success:{background:"bg-green-500/20",iconClass:"text-green-400",icon:"mdiCheckCircleOutline"},warning:{background:"bg-amber-500/20",iconClass:"text-amber-400",icon:"mdiAlertOutline"},info:{background:"bg-blue-500/20",iconClass:"text-blue-400",icon:"mdiInformationOutline"},default:{background:"bg-neutral-500/20",iconClass:"text-neutral-400",icon:"mdiBellOutline"}},Te=({className:t,disabled:s=!1,emptyMessage:o="No notifications",maxHeight:i="max-h-96",notifications:r,onMarkAllRead:x,onNotificationClick:a,unreadCount:l=0})=>{const[u,h]=b.useState(!1),[d,p]=b.useState(!1),g=l>99?"99+":l.toString(),f=l>0,j=r.length>0;b.useEffect(()=>{const c=()=>{const w=window.innerWidth<de.MOBILE_BREAKPOINT;p(w),w&&u?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden")};return c(),window.addEventListener("resize",c),()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("resize",c)}},[u]);const v=c=>{a?.(c),d&&h(!1)},R=()=>{x?.(),d&&h(!1)},O=()=>e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:j?e.jsxRuntimeExports.jsx("div",{className:"divide-y divide-neutral-800/50",children:r.map((c,w)=>{const y=$e[c.type||"default"];return e.jsxRuntimeExports.jsxs(le,{className:n.twMerge("secondary-inset-focus flex w-full items-start gap-3 px-3 py-3 text-left hover:bg-white/6",!c.read&&"bg-white/3",w===r.length-1&&"pb-4"),unstyled:!0,onClick:()=>v(c),children:[e.jsxRuntimeExports.jsx("div",{className:n.twMerge("mt-0.5 flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg",y.background),children:c.img?e.jsxRuntimeExports.jsx(se,{alt:"User avatar",fallback:"NA",size:"md",src:c.img}):e.jsxRuntimeExports.jsx(n.OxIcon,{className:y.iconClass,icon:c.icon??y.icon,size:.75})}),e.jsxRuntimeExports.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxRuntimeExports.jsx("p",{className:"mb-1 text-sm leading-5 text-white",children:c.title}),c.message&&e.jsxRuntimeExports.jsx("p",{className:"mb-1 text-xs leading-4 text-neutral-400",children:c.message}),e.jsxRuntimeExports.jsx("p",{className:"text-xs text-neutral-500",children:ue.formatTimestamp(c.timestamp)})]}),!c.read&&e.jsxRuntimeExports.jsx("div",{className:"mt-1.5 h-2 w-2 flex-shrink-0 rounded-full bg-rose-500"})]},c.id)})}):e.jsxRuntimeExports.jsxs("div",{"aria-label":"No notifications available",className:"px-3 py-8 text-center",role:"status",children:[e.jsxRuntimeExports.jsx(n.OxIcon,{className:"mx-auto mb-2 text-neutral-500",icon:"mdiBellOffOutline",size:2}),e.jsxRuntimeExports.jsx("p",{className:"text-sm text-neutral-400",children:o})]})});return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:d?e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs("div",{className:"relative",children:[e.jsxRuntimeExports.jsx(n.OxButton,{"aria-expanded":u,"aria-label":`Notifications${f?` (${l} unread)`:""}`,disabled:s,icon:"mdiBellOutline",variant:"ghost",onClick:()=>h(!u)}),f?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{className:"absolute -top-2 -right-2",children:e.jsxRuntimeExports.jsx(q,{className:"min-w-[1.25rem] justify-center px-1",color:"violet",size:"sm",children:g})})}):null]}),ee.createPortal(e.jsxRuntimeExports.jsxs("div",{"aria-labelledby":"notifications-title-mobile","aria-modal":"true",className:n.twMerge("fixed inset-y-0 z-50 flex w-full flex-col bg-zinc-1000/50 backdrop-blur-xl transition-transform duration-300",u?"translate-x-0":"translate-x-full"),role:"dialog",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex h-15 items-center justify-between border-b border-neutral-800 px-4",children:[d?e.jsxRuntimeExports.jsx(n.OxButton,{"aria-label":"Close sidebar",icon:"mdiClose",variant:"ghost",onClick:()=>h(!1)}):null,e.jsxRuntimeExports.jsx("h3",{id:"notifications-title-mobile",className:"text-sm font-semibold text-white",children:"Notifications"}),e.jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:f&&x&&e.jsxRuntimeExports.jsx("button",{className:"cursor-pointer text-xs text-neutral-400 transition-colors hover:text-white",onClick:R,children:"Mark all read"})})]}),e.jsxRuntimeExports.jsx("ul",{className:"flex-1 overflow-y-auto",children:e.jsxRuntimeExports.jsx(O,{})})]}),document.body)]}):e.jsxRuntimeExports.jsxs(ie,{className:t,disabled:s,children:[e.jsxRuntimeExports.jsx(Z,{"aria-label":`Notifications${f?` (${l} unread)`:""}`,className:n.twJoin("relative flex h-10 w-10 items-center justify-center px-2 text-sm","secondary-outset-focus group rounded-lg border border-transparent bg-transparent text-white enabled:cursor-pointer enabled:hover:bg-white/6"),disabled:s,icon:"mdiBellOutline",unstyled:!0,children:f?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx("div",{className:"absolute -top-2 -right-2",children:e.jsxRuntimeExports.jsx(q,{className:"min-w-[1.25rem] justify-center px-1",color:"violet",size:"sm",children:g})})}):null}),e.jsxRuntimeExports.jsx(X,{children:e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxRuntimeExports.jsx("h3",{id:"notifications-title",className:"text-sm font-semibold text-white",children:"Notifications"}),f&&x&&e.jsxRuntimeExports.jsx("button",{className:"secondary-outset-focus cursor-pointer rounded-lg p-1 text-xs text-neutral-400 transition-colors hover:text-white",onClick:x,children:"Mark all read"})]})}),e.jsxRuntimeExports.jsx(Q,{align:"end","aria-labelledby":"notifications-title",className:n.twMerge("flex w-85 flex-col overflow-hidden p-0",i),side:"bottom",children:e.jsxRuntimeExports.jsx(O,{})})]})})},ae=b.createContext(void 0),Be=()=>{const t=b.useContext(ae);if(!t)throw new Error("Select components must be used within an OxSelect");return t},xe=({children:t,className:s,disabled:o=!1,id:i,value:r})=>{const{closeDropdown:x,onSelect:a,selectedValue:l}=Be(),u=()=>{a({value:r,label:t})},h=p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),a({value:r,label:t})),p.key==="Escape"&&x()},d=l.includes(r);return e.jsxRuntimeExports.jsx("li",{role:"none",children:e.jsxRuntimeExports.jsxs("button",{id:i,"aria-selected":d,className:n.twMerge("group flex w-full items-center justify-between rounded-sm px-2 py-1.5 text-left text-sm enabled:text-white","enabled:cursor-pointer enabled:hover:bg-white/6","default-inset-focus","default-disabled",d&&"bg-white/5",s),disabled:o,role:"option",tabIndex:o?-1:0,onClick:u,onKeyDown:h,children:[t,d&&!o&&e.jsxRuntimeExports.jsx(n.OxIcon,{className:"text-violet-700",icon:"mdiCheck",size:.8})]})})};let U=null,_=null;const Pe=()=>(U||(U=document.createElement("canvas"),_=U.getContext("2d"),_.font="0.875rem system-ui, sans-serif"),_),We=(t,s,o)=>{if(t.length===0)return[];if(!s.current)return t.slice(0,1);const i=s.current.offsetWidth||0,r=12,x=32,a=32;let l=i-r-x;t.length>1&&(l-=a);const u=Pe();if(!u)return t.slice(0,2);const h=o?4:8,d=o?12:0;let p=0,g=0;for(let f=0;f<t.length;f++){const j=t[f],v=String(j.label),O=u.measureText(v).width+(o?d:0),c=f>0?p+O+h:p+O;if(c<=l)p=c,g++;else break}return g=Math.max(1,g),t.slice(0,g)},He=t=>t==null?[]:Array.isArray(t)?t:[t],qe=({badgeColor:t="purple",children:s,className:o,defaultValue:i=null,description:r,disabled:x=!1,displayAsBadges:a=!1,error:l=!1,errorMessage:u,id:h,label:d,multiple:p=!1,name:g,onChange:f,placeholder:j="Select an option",required:v=!1})=>{const R=b.useId(),O=b.useRef(null),[c,w]=b.useState(!1),[y,I]=b.useState([]),L=h||R,N=`${L}-select`,F=`${L}-description`,S=`${L}-error`,D=l&&u,P=(k,m)=>{let E=null;return b.Children.forEach(k,C=>{if(b.isValidElement(C)&&C.type===xe){const z=C.props;z.value===m&&(E={value:z.value,label:z.children})}}),E},W=k=>{let m;if(p?y.some(C=>C.value===k.value)?m=y.filter(C=>C.value!==k.value):m=[...y,k]:(m=[k],w(!1)),I(m),f){const E=p?m.map(C=>C.value):m[0]?.value??null;f(E)}};b.useEffect(()=>{if(i!==void 0){const k=He(i),m=[];k.forEach(E=>{const C=P(s,E);C&&m.push(C)}),I(p?m:m.slice(0,1))}},[i,s,p]);const V=e.jsxRuntimeExports.jsx("ul",{id:`${N}-listbox`,"aria-multiselectable":p,className:"max-h-72 space-y-0.5 overflow-hidden overflow-y-auto",role:"listbox",children:s}),H=We(y,O,a),J=y.length-H.length,A=J>0;return e.jsxRuntimeExports.jsx(ae.Provider,{value:{selectedValue:y.map(k=>k.value),multiple:p,onSelect:W,closeDropdown:()=>w(!1)},children:e.jsxRuntimeExports.jsxs("div",{className:n.twMerge("flex w-full flex-col gap-1",o),children:[d&&e.jsxRuntimeExports.jsx(M.OxLabel,{htmlFor:N,required:v,children:d}),e.jsxRuntimeExports.jsx(Y,{align:"start",content:V,contentClassName:"default-border bg-zinc-1000/70 rounded-lg p-1 backdrop-blur-xl animate-dropdown-in-bottom",contentStyle:{minWidth:`${O.current?.offsetWidth||200}px`},disabled:x,open:c,position:"bottom",trigger:"click",onOpenChange:w,children:e.jsxRuntimeExports.jsxs("button",{id:N,"aria-controls":`${N}-listbox`,"aria-describedby":[r?F:"",D?S:""].filter(Boolean).join(" ")||void 0,"aria-disabled":x,"aria-expanded":c,"aria-haspopup":"listbox","aria-invalid":l,"aria-required":v,className:n.twJoin("relative flex h-10 w-full gap-x-2 rounded-lg py-2 ps-3 pe-8 text-start text-sm enabled:cursor-pointer enabled:text-white","default-outset-focus default-disabled",l?"default-error-border":"default-border",c&&"default-active-border"),disabled:x,ref:O,role:"combobox",type:"button",children:[e.jsxRuntimeExports.jsx("span",{className:n.twJoin("w-full overflow-hidden text-ellipsis",a?p&&"flex flex-wrap gap-1":"whitespace-nowrap",x&&a&&"opacity-50"),children:y.length>0?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&p?H.map(k=>e.jsxRuntimeExports.jsx(q,{color:t,size:"sm",children:k.label},String(k.value))):H.map((k,m,E)=>e.jsxRuntimeExports.jsxs(b.Fragment,{children:[k.label,m<E.length-1&&", "]},String(k.value))),A&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[!(a&&p)&&" ",e.jsxRuntimeExports.jsxs(q,{color:t,size:"sm",children:["+",J]})]})]}):j}),e.jsxRuntimeExports.jsx("div",{className:"absolute end-3 top-1/2 -translate-y-1/2",children:e.jsxRuntimeExports.jsx(n.OxIcon,{className:n.twJoin("transition-transform duration-300 ease-in-out",x&&"text-neutral-500",c&&"rotate-180"),icon:"mdiChevronDown",size:.8})})]})}),g&&e.jsxRuntimeExports.jsx("input",{name:g,type:"hidden",value:y.map(k=>k.value).join(",")}),r&&e.jsxRuntimeExports.jsx(M.OxDescription,{id:F,disabled:x,children:r}),D&&e.jsxRuntimeExports.jsx(M.OxErrorMessage,{id:S,children:u})]})})},Je=({children:t,className:s})=>e.jsxRuntimeExports.jsx("div",{className:n.twMerge("px-2 py-1 text-xs font-medium text-neutral-400",s),children:t}),Ve={default:"bg-zinc-800/80",purple:"bg-purple-950/50",blue:"bg-blue-950/50",gray:"bg-gray-800/50"},Ae={rectangle:"rounded-md",circle:"rounded-full"},ce=({animate:t=!0,className:s,color:o="default",fullWidth:i=!1,height:r,shape:x="rectangle",width:a,...l})=>{const u={height:typeof r=="number"?`${r}px`:r,width:typeof a=="number"?`${a}px`:a};return e.jsxRuntimeExports.jsx("div",{"aria-busy":"true","aria-label":"Loading...",className:n.twMerge("relative overflow-hidden",Ve[o],Ae[x],t&&"animate-pulse",i&&"w-full",s),role:"status",style:u,...l})},Ge=({animate:t=!0,className:s,color:o="default",fullWidth:i=!1,gap:r=8,height:x=20,lines:a=1,width:l,...u})=>{const h=g=>g<=1?`${g*100}%`:`${g}px`,d=g=>{if(!i){if(Array.isArray(l)){const f=l[g%l.length];return f==null?void 0:typeof f=="number"?h(f):f}if(typeof l=="number"){if(a>1&&g===a-1){const f=l<=1?l*.6:Math.max(100,l*.6);return h(f)}return h(l)}return"200px"}},p={4:"space-y-1",8:"space-y-2",12:"space-y-3",16:"space-y-4",20:"space-y-5"}[r]||"space-y-2";return e.jsxRuntimeExports.jsx("div",{className:n.twMerge("flex flex-col",p,s),...u,children:Array.from({length:a}).map((g,f)=>e.jsxRuntimeExports.jsx(ce,{animate:t,color:o,fullWidth:i,height:x,width:d(f)},f))})},Ke=({className:t,description:s,disabled:o=!1,error:i=!1,errorMessage:r,id:x,label:a,name:l,onChange:u,placeholder:h="Enter text...",readOnly:d=!1,required:p=!1,rows:g=3,showMaxLength:f=!1,value:j,...v})=>{const R=b.useId(),[O,c]=b.useState(typeof j=="string"?j.length:0),w=x||R,y=`${w}-textarea`,I=`${w}-description`,L=`${w}-error`,N=v.maxLength,F=i&&r;b.useEffect(()=>{typeof j=="string"&&c(j.length)},[j]);const S=P=>{const W=P.target.value.length;c(W),u?.(P)},D=e.jsxRuntimeExports.jsx("textarea",{id:y,"aria-describedby":[s?I:"",F?L:""].filter(Boolean).join(" ")||void 0,"aria-invalid":i,"aria-required":p,className:n.twMerge("flex min-h-10 w-full resize-y rounded-lg bg-transparent px-2 py-2 text-sm text-white","placeholder:text-neutral-500","default-outset-focus","default-disabled",i?"default-error-border":"default-border",t),disabled:o,name:l,placeholder:h,readOnly:d,rows:g,value:j,onChange:S,...v});return e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[a?e.jsxRuntimeExports.jsx(M.OxLabel,{htmlFor:y,required:p,children:a}):null,D,f&&typeof N=="number"?e.jsxRuntimeExports.jsxs("div",{className:"pointer-events-none mt-1 text-right text-xs text-neutral-400",children:[O,"/",N]}):null,s?e.jsxRuntimeExports.jsx(M.OxDescription,{id:I,disabled:o,children:s}):null,F?e.jsxRuntimeExports.jsx(M.OxErrorMessage,{id:L,children:r}):null]})},Ue={default:"default-border backdrop-blur-xl text-white bg-zinc-1000/70",error:"bg-red-900/70 text-red-200 border-red-700",warning:"bg-amber-900/70 text-amber-200 border-amber-700",info:"bg-blue-900/70 text-blue-200 border-blue-700",success:"bg-green-900/70 text-green-200 border-green-700"},_e=({align:t="center",children:s,className:o,content:i,disabled:r=!1,id:x,onOpenChange:a,open:l,position:u="top",trigger:h="hover",variant:d="default"})=>{const p=e.jsxRuntimeExports.jsx("div",{className:n.twMerge("max-w-xs rounded-md border px-2 py-1 text-xs break-words backdrop-blur-sm",Ue[d],o),children:i});return e.jsxRuntimeExports.jsx(Y,{id:x,align:t,content:p,contentRole:"tooltip",disabled:r,offset:8,open:l,position:u,trigger:h,useAriaControls:!1,onOpenChange:a,children:s})},Ye=({children:t,onAuthenticated:s=null,onLoading:o=null})=>{const{isLoggedIn:i,loading:r}=te.useOxAuth();return r?o:i?s:t},Qe=({children:t,onLoading:s=null,onUnauthenticated:o=null})=>{const{isLoggedIn:i,loading:r}=te.useOxAuth();return r?s:i?t:o};exports.OxButton=n.OxButton;exports.OxIcon=n.OxIcon;exports.OxDescription=M.OxDescription;exports.OxErrorMessage=M.OxErrorMessage;exports.OxForm=M.OxForm;exports.OxInput=M.OxInput;exports.OxLabel=M.OxLabel;exports.OxAvatar=me;exports.OxAvatarImage=se;exports.OxAvatarText=he;exports.OxBadge=q;exports.OxCard=Ne;exports.OxCardContent=Ie;exports.OxCardFooter=Me;exports.OxCardHeader=Ce;exports.OxCheckbox=Le;exports.OxDropdown=ie;exports.OxDropdownContent=Q;exports.OxDropdownFooter=re;exports.OxDropdownHeader=X;exports.OxDropdownItem=le;exports.OxDropdownSeparator=Fe;exports.OxDropdownShortcut=De;exports.OxDropdownTrigger=Z;exports.OxGuestRoute=Ye;exports.OxNotificationDropdown=Te;exports.OxProtectedRoute=Qe;exports.OxSelect=qe;exports.OxSelectLabel=Je;exports.OxSelectOption=xe;exports.OxSkeleton=ce;exports.OxSkeletonText=Ge;exports.OxTextarea=Ke;exports.OxTooltip=_e;
package/dist/onyx.es.js CHANGED
@@ -6,7 +6,7 @@ import { O as wt, a as jt } from "./chunks/Input-dfvmdIHi.js";
6
6
  import { createPortal as ce } from "react-dom";
7
7
  import { M as pe } from "./chunks/constants-CDXq37n6.js";
8
8
  import { f as ge } from "./chunks/formatTimestamp-CMxOnPo1.js";
9
- import { u as de } from "./chunks/useAuth-DDRXztKj.js";
9
+ import { u as de } from "./chunks/useAuth-raJH4ydc.js";
10
10
  import './index.css';const tt = ({ children: t, className: s }) => /* @__PURE__ */ e.jsx("div", { className: b("flex items-center gap-3", s), children: t }), Q = {
11
11
  rounded: "rounded-full",
12
12
  square: "rounded-lg"
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/jsx-runtime-CITbqOLs.js");require("react");const o=require("../chunks/Button-D-v4l8ZE.js"),n=require("../chunks/Input-CLi1H63d.js"),a=require("../chunks/useAuth-DPnpY3XC.js"),p=require("../chunks/useForm-DUviJ7xS.js"),g=require("../chunks/errorHelper-DaP_XxEx.js"),h=a.gql`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/jsx-runtime-CITbqOLs.js");require("react");const o=require("../chunks/Button-D-v4l8ZE.js"),n=require("../chunks/Input-CLi1H63d.js"),a=require("../chunks/useAuth-BDiob4Rb.js"),p=require("../chunks/useForm-DUviJ7xS.js"),g=require("../chunks/errorHelper-DaP_XxEx.js"),h=a.gql`
2
2
  mutation Login($input: LoginInput!) {
3
3
  login(input: $input) {
4
- isAuthenticated
4
+ success
5
5
  me {
6
6
  id
7
7
  username
@@ -10,4 +10,4 @@
10
10
  }
11
11
  }
12
12
  }
13
- `,j=({className:i,mutation:u=h,onSubmit:d,subtitle:l="",title:m="noxickon"})=>{const{setUser:x}=a.useOxAuth(),e=p.useForm({initialData:{username:"",password:""},validationRules:{username:["required"],password:["required"]},operation:u}),c=async s=>{s.preventDefault(),e.submit({onError:t=>{g.OxHandleGraphQLFormErrors(t,e)},onSuccess:t=>{x(t.data?t.data.login.me:null),d?.(t)}})};return r.jsxRuntimeExports.jsx("div",{className:o.twMerge("w-80",i),children:r.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl",children:[r.jsxRuntimeExports.jsxs("div",{className:"mb-4 text-center",children:[r.jsxRuntimeExports.jsx("h1",{className:"px-2 font-mono text-2xl text-white",children:m}),r.jsxRuntimeExports.jsx("p",{className:"px-2 py-1 font-mono text-xs text-neutral-400",children:l})]}),r.jsxRuntimeExports.jsxs(n.OxForm,{className:"space-y-6",onSubmit:c,children:[r.jsxRuntimeExports.jsx(n.OxInput,{autoComplete:"off",disabled:e.isLoading,error:e.hasError("username"),icon:"mdiAccount",label:"username",name:"username",placeholder:"Enter your username",required:!0,type:"text",value:e.data.username,onChange:s=>e.setData("username",s.target.value)}),r.jsxRuntimeExports.jsx(n.OxInput,{autoComplete:"off",disabled:e.isLoading,error:e.hasError("password"),icon:"mdiLockOutline",label:"password",name:"password",placeholder:"Enter your password",required:!0,type:"password",value:e.data.password,onChange:s=>e.setData("password",s.target.value)}),e.hasErrors&&r.jsxRuntimeExports.jsx(n.OxErrorMessage,{icon:"mdiAlertCircleOutline",children:"username or password is wrong"}),r.jsxRuntimeExports.jsx(o.OxButton,{disabled:e.isLoading,fullWidth:!0,isLoading:e.isLoading,size:"md",type:"submit",variant:"primary",children:e.isLoading?"Signing in...":"Sign In"})]})]})})};exports.OxLogin=j;
13
+ `,j=({className:i,mutation:u=h,onSubmit:l,subtitle:d="",title:m="noxickon"})=>{const{setUser:x}=a.useOxAuth(),e=p.useForm({initialData:{username:"",password:""},validationRules:{username:["required"],password:["required"]},operation:u}),c=async t=>{t.preventDefault(),e.submit({onError:s=>{g.OxHandleGraphQLFormErrors(s,e)},onSuccess:s=>{s.data&&s.data.login.success?(x(s.data?s.data.login.me:null),l?.(s)):console.error("Something went wrong",s)}})};return r.jsxRuntimeExports.jsx("div",{className:o.twMerge("w-80",i),children:r.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl",children:[r.jsxRuntimeExports.jsxs("div",{className:"mb-4 text-center",children:[r.jsxRuntimeExports.jsx("h1",{className:"px-2 font-mono text-2xl text-white",children:m}),r.jsxRuntimeExports.jsx("p",{className:"px-2 py-1 font-mono text-xs text-neutral-400",children:d})]}),r.jsxRuntimeExports.jsxs(n.OxForm,{className:"space-y-6",onSubmit:c,children:[r.jsxRuntimeExports.jsx(n.OxInput,{autoComplete:"off",disabled:e.isLoading,error:e.hasError("username"),icon:"mdiAccount",label:"username",name:"username",placeholder:"Enter your username",required:!0,type:"text",value:e.data.username,onChange:t=>e.setData("username",t.target.value)}),r.jsxRuntimeExports.jsx(n.OxInput,{autoComplete:"off",disabled:e.isLoading,error:e.hasError("password"),icon:"mdiLockOutline",label:"password",name:"password",placeholder:"Enter your password",required:!0,type:"password",value:e.data.password,onChange:t=>e.setData("password",t.target.value)}),e.hasErrors&&r.jsxRuntimeExports.jsx(n.OxErrorMessage,{icon:"mdiAlertCircleOutline",children:"username or password is wrong"}),r.jsxRuntimeExports.jsx(o.OxButton,{disabled:e.isLoading,fullWidth:!0,isLoading:e.isLoading,size:"md",type:"submit",variant:"primary",children:e.isLoading?"Signing in...":"Sign In"})]})]})})};exports.OxLogin=j;
@@ -1,14 +1,14 @@
1
1
  import { j as r } from "../chunks/jsx-runtime--oOP9f8K.js";
2
2
  import "react";
3
- import { t as p, O as c } from "../chunks/Button-bARrxYyo.js";
3
+ import { t as c, O as p } from "../chunks/Button-bARrxYyo.js";
4
4
  import { O as x, a as o, b as g } from "../chunks/Input-dfvmdIHi.js";
5
- import { g as h, u as b } from "../chunks/useAuth-DDRXztKj.js";
5
+ import { g as h, u as b } from "../chunks/useAuth-raJH4ydc.js";
6
6
  import { u as f } from "../chunks/useForm-D4co95Vn.js";
7
7
  import { b as w } from "../chunks/errorHelper--G-SWQzN.js";
8
8
  const O = h`
9
9
  mutation Login($input: LoginInput!) {
10
10
  login(input: $input) {
11
- isAuthenticated
11
+ success
12
12
  me {
13
13
  id
14
14
  username
@@ -17,7 +17,7 @@ const O = h`
17
17
  }
18
18
  }
19
19
  }
20
- `, A = ({
20
+ `, q = ({
21
21
  className: t,
22
22
  mutation: n = O,
23
23
  onSubmit: i,
@@ -34,17 +34,17 @@ const O = h`
34
34
  password: ["required"]
35
35
  },
36
36
  operation: n
37
- }), m = async (a) => {
38
- a.preventDefault(), e.submit({
39
- onError: (s) => {
40
- w(s, e);
37
+ }), m = async (s) => {
38
+ s.preventDefault(), e.submit({
39
+ onError: (a) => {
40
+ w(a, e);
41
41
  },
42
- onSuccess: (s) => {
43
- u(s.data ? s.data.login.me : null), i?.(s);
42
+ onSuccess: (a) => {
43
+ a.data && a.data.login.success ? (u(a.data ? a.data.login.me : null), i?.(a)) : console.error("Something went wrong", a);
44
44
  }
45
45
  });
46
46
  };
47
- return /* @__PURE__ */ r.jsx("div", { className: p("w-80", t), children: /* @__PURE__ */ r.jsxs("div", { className: "rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl", children: [
47
+ return /* @__PURE__ */ r.jsx("div", { className: c("w-80", t), children: /* @__PURE__ */ r.jsxs("div", { className: "rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl", children: [
48
48
  /* @__PURE__ */ r.jsxs("div", { className: "mb-4 text-center", children: [
49
49
  /* @__PURE__ */ r.jsx("h1", { className: "px-2 font-mono text-2xl text-white", children: l }),
50
50
  /* @__PURE__ */ r.jsx("p", { className: "px-2 py-1 font-mono text-xs text-neutral-400", children: d })
@@ -63,7 +63,7 @@ const O = h`
63
63
  required: !0,
64
64
  type: "text",
65
65
  value: e.data.username,
66
- onChange: (a) => e.setData("username", a.target.value)
66
+ onChange: (s) => e.setData("username", s.target.value)
67
67
  }
68
68
  ),
69
69
  /* @__PURE__ */ r.jsx(
@@ -79,12 +79,12 @@ const O = h`
79
79
  required: !0,
80
80
  type: "password",
81
81
  value: e.data.password,
82
- onChange: (a) => e.setData("password", a.target.value)
82
+ onChange: (s) => e.setData("password", s.target.value)
83
83
  }
84
84
  ),
85
85
  e.hasErrors && /* @__PURE__ */ r.jsx(g, { icon: "mdiAlertCircleOutline", children: "username or password is wrong" }),
86
86
  /* @__PURE__ */ r.jsx(
87
- c,
87
+ p,
88
88
  {
89
89
  disabled: e.isLoading,
90
90
  fullWidth: !0,
@@ -99,5 +99,5 @@ const O = h`
99
99
  ] }) });
100
100
  };
101
101
  export {
102
- A as OxLogin
102
+ q as OxLogin
103
103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxickon/onyx",
3
- "version": "0.0.4-dev.2",
3
+ "version": "0.0.4-dev.4",
4
4
  "type": "module",
5
5
  "readme": "./NPM_README.md",
6
6
  "main": "./dist/onyx.umd.js",