@nswds/app 1.46.1 → 1.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/globals.css CHANGED
@@ -392,6 +392,9 @@
392
392
  .top-\[60\%\] {
393
393
  top: 60%;
394
394
  }
395
+ .top-\[180px\] {
396
+ top: 180px;
397
+ }
395
398
  .top-full {
396
399
  top: 100%;
397
400
  }
@@ -1023,9 +1026,6 @@
1023
1026
  .mr-3 {
1024
1027
  margin-right: calc(var(--spacing) * 3);
1025
1028
  }
1026
- .mr-6 {
1027
- margin-right: calc(var(--spacing) * 6);
1028
- }
1029
1029
  .\!mb-0 {
1030
1030
  margin-bottom: calc(var(--spacing) * 0) !important;
1031
1031
  }
@@ -5510,6 +5510,11 @@
5510
5510
  column-gap: calc(var(--spacing) * 3);
5511
5511
  }
5512
5512
  }
5513
+ .has-\[\>svg\]\:px-3 {
5514
+ &:has(>svg) {
5515
+ padding-inline: calc(var(--spacing) * 3);
5516
+ }
5517
+ }
5513
5518
  .aria-disabled\:opacity-50 {
5514
5519
  &[aria-disabled="true"] {
5515
5520
  opacity: 50%;
@@ -7364,6 +7369,11 @@
7364
7369
  padding-block: calc(calc(var(--spacing) * 4) - 1px);
7365
7370
  }
7366
7371
  }
7372
+ .sm\:pr-2\.5 {
7373
+ @media (width >= 40rem) {
7374
+ padding-right: calc(var(--spacing) * 2.5);
7375
+ }
7376
+ }
7367
7377
  .sm\:pr-3 {
7368
7378
  @media (width >= 40rem) {
7369
7379
  padding-right: calc(var(--spacing) * 3);
@@ -7384,6 +7394,11 @@
7384
7394
  padding-left: calc(var(--spacing) * 1.5);
7385
7395
  }
7386
7396
  }
7397
+ .sm\:pl-2\.5 {
7398
+ @media (width >= 40rem) {
7399
+ padding-left: calc(var(--spacing) * 2.5);
7400
+ }
7401
+ }
7387
7402
  .sm\:pl-\[calc\(--spacing\(4\)-1px\)\] {
7388
7403
  @media (width >= 40rem) {
7389
7404
  padding-left: calc(calc(var(--spacing) * 4) - 1px);
@@ -7698,6 +7713,21 @@
7698
7713
  grid-template-columns: repeat(6, minmax(0, 1fr));
7699
7714
  }
7700
7715
  }
7716
+ .lg\:flex-wrap {
7717
+ @media (width >= 64rem) {
7718
+ flex-wrap: wrap;
7719
+ }
7720
+ }
7721
+ .lg\:items-center {
7722
+ @media (width >= 64rem) {
7723
+ align-items: center;
7724
+ }
7725
+ }
7726
+ .lg\:justify-between {
7727
+ @media (width >= 64rem) {
7728
+ justify-content: space-between;
7729
+ }
7730
+ }
7701
7731
  .lg\:justify-end {
7702
7732
  @media (width >= 64rem) {
7703
7733
  justify-content: flex-end;
@@ -7916,6 +7946,11 @@
7916
7946
  border-color: oklch(0.426426783985819 0.011202235626284581 232.61715023407646);
7917
7947
  }
7918
7948
  }
7949
+ .dark\:border-input {
7950
+ &:where([data-theme=dark], [data-theme=dark] *) {
7951
+ border-color: var(--input);
7952
+ }
7953
+ }
7919
7954
  .dark\:border-slate-800 {
7920
7955
  &:where([data-theme=dark], [data-theme=dark] *) {
7921
7956
  border-color: var(--color-slate-800);
@@ -8764,6 +8799,18 @@
8764
8799
  }
8765
8800
  }
8766
8801
  }
8802
+ .dark\:hover\:bg-accent\/50 {
8803
+ &:where([data-theme=dark], [data-theme=dark] *) {
8804
+ &:hover {
8805
+ @media (hover: hover) {
8806
+ background-color: var(--accent);
8807
+ @supports (color: color-mix(in lab, red, red)) {
8808
+ background-color: color-mix(in oklab, var(--accent) 50%, transparent);
8809
+ }
8810
+ }
8811
+ }
8812
+ }
8813
+ }
8767
8814
  .dark\:hover\:bg-gray-700 {
8768
8815
  &:where([data-theme=dark], [data-theme=dark] *) {
8769
8816
  &:hover {
package/dist/index.cjs CHANGED
@@ -56,13 +56,6 @@ var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
56
56
  var reactDayPicker = require('react-day-picker');
57
57
  var useEmblaCarousel = require('embla-carousel-react');
58
58
  var inputOtp = require('input-otp');
59
- var NextAuth = require('next-auth');
60
- var MicrosoftEntraID = require('next-auth/providers/microsoft-entra-id');
61
- var drizzleOrm = require('drizzle-orm');
62
- var drizzleAdapter = require('@auth/drizzle-adapter');
63
- var libsql = require('drizzle-orm/libsql');
64
- var client$1 = require('@libsql/client');
65
- var sqliteCore = require('drizzle-orm/sqlite-core');
66
59
  var slugify = require('@sindresorhus/slugify');
67
60
  var zustand = require('zustand');
68
61
  var middleware = require('zustand/middleware');
@@ -120,20 +113,13 @@ var RechartsPrimitive__namespace = /*#__PURE__*/_interopNamespace(RechartsPrimit
120
113
  var HoverCardPrimitives__namespace = /*#__PURE__*/_interopNamespace(HoverCardPrimitives);
121
114
  var AlertDialogPrimitive__namespace = /*#__PURE__*/_interopNamespace(AlertDialogPrimitive);
122
115
  var useEmblaCarousel__default = /*#__PURE__*/_interopDefault(useEmblaCarousel);
123
- var NextAuth__default = /*#__PURE__*/_interopDefault(NextAuth);
124
- var MicrosoftEntraID__default = /*#__PURE__*/_interopDefault(MicrosoftEntraID);
125
116
 
126
- var __defProp = Object.defineProperty;
127
117
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
128
118
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
129
119
  }) : x)(function(x) {
130
120
  if (typeof require !== "undefined") return require.apply(this, arguments);
131
121
  throw Error('Dynamic require of "' + x + '" is not supported');
132
122
  });
133
- var __export = (target, all) => {
134
- for (var name in all)
135
- __defProp(target, name, { get: all[name], enumerable: true });
136
- };
137
123
  var Icons = {
138
124
  account_circle: (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { fill: "currentColor", "data-slot": "icon", viewBox: "0 -960 960 960", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M234-276q51-39 114-61.5T480-360q69 0 132 22.5T726-276q35-41 54.5-93T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 59 19.5 111t54.5 93Zm246-164q-59 0-99.5-40.5T340-580q0-59 40.5-99.5T480-720q59 0 99.5 40.5T620-580q0 59-40.5 99.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q53 0 100-15.5t86-44.5q-39-29-86-44.5T480-280q-53 0-100 15.5T294-220q39 29 86 44.5T480-160Zm0-360q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm0-60Zm0 360Z" }) }),
139
125
  add: (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { fill: "currentColor", "data-slot": "icon", viewBox: "0 -960 960 960", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M440-440H240q-17 0-28.5-11.5T200-480q0-17 11.5-28.5T240-520h200v-200q0-17 11.5-28.5T480-760q17 0 28.5 11.5T520-720v200h200q17 0 28.5 11.5T760-480q0 17-11.5 28.5T720-440H520v200q0 17-11.5 28.5T480-200q-17 0-28.5-11.5T440-240v-200Z" }) }),
@@ -242,11 +228,11 @@ var Icons = {
242
228
  function cn(...inputs) {
243
229
  return tailwindMerge.twMerge(clsx21.clsx(inputs));
244
230
  }
245
- function truncate(text4, maxLength) {
246
- if (text4.length <= maxLength) {
247
- return text4;
231
+ function truncate(text, maxLength) {
232
+ if (text.length <= maxLength) {
233
+ return text;
248
234
  }
249
- return text4.slice(0, maxLength) + "...";
235
+ return text.slice(0, maxLength) + "...";
250
236
  }
251
237
  function kebabCase(str) {
252
238
  return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
@@ -7798,7 +7784,7 @@ function Heading({
7798
7784
 
7799
7785
  // package.json
7800
7786
  var package_default = {
7801
- version: "1.46.0"};
7787
+ version: "1.47.0"};
7802
7788
  function Logo(props) {
7803
7789
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
7804
7790
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: "NSW Government" }),
@@ -7942,12 +7928,11 @@ function Header2({
7942
7928
  "data-scrolled": isScrolled,
7943
7929
  id: "nsw-header",
7944
7930
  className: clsx21__default.default(
7945
- "sticky top-0 z-50 flex hidden flex-none flex-wrap items-center justify-between bg-white px-4 py-5 transition duration-500 sm:px-6 lg:flex lg:px-12",
7931
+ "sticky top-0 z-50 hidden bg-white px-4 py-5 transition duration-500 sm:px-6 lg:flex lg:flex-none lg:flex-wrap lg:items-center lg:justify-between lg:px-12",
7946
7932
  shadow && "shadow-md shadow-slate-900/5 dark:shadow-none",
7947
7933
  isScrolled ? "dark:bg-slate-900/95 dark:backdrop-blur-sm dark:[@supports(backdrop-filter:blur(0))]:bg-slate-900/75" : "dark:bg-transparent"
7948
7934
  ),
7949
7935
  children: [
7950
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mr-6 flex lg:hidden" }),
7951
7936
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative flex grow basis-0 items-center", children: [
7952
7937
  /* @__PURE__ */ jsxRuntime.jsxs(Link10__default.default, { href: "/", "aria-label": "Home page", className: "flex items-center justify-between", children: [
7953
7938
  /* @__PURE__ */ jsxRuntime.jsx(Logo, { className: "h-12 w-auto lg:h-14" }),
@@ -13334,7 +13319,7 @@ function distance2D(a, b) {
13334
13319
 
13335
13320
  // node_modules/framer-motion/dist/es/gestures/pan/PanSession.mjs
13336
13321
  var PanSession = class {
13337
- constructor(event, handlers2, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) {
13322
+ constructor(event, handlers, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) {
13338
13323
  this.startEvent = null;
13339
13324
  this.lastMoveEvent = null;
13340
13325
  this.lastMoveEventInfo = null;
@@ -13379,7 +13364,7 @@ var PanSession = class {
13379
13364
  if (!isPrimaryPointer(event))
13380
13365
  return;
13381
13366
  this.dragSnapToOrigin = dragSnapToOrigin;
13382
- this.handlers = handlers2;
13367
+ this.handlers = handlers;
13383
13368
  this.transformPagePoint = transformPagePoint;
13384
13369
  this.contextWindow = contextWindow || window;
13385
13370
  const info = extractEventInfo(event);
@@ -13387,12 +13372,12 @@ var PanSession = class {
13387
13372
  const { point } = initialInfo;
13388
13373
  const { timestamp } = frameData;
13389
13374
  this.history = [{ ...point, timestamp }];
13390
- const { onSessionStart } = handlers2;
13375
+ const { onSessionStart } = handlers;
13391
13376
  onSessionStart && onSessionStart(event, getPanInfo(initialInfo, this.history));
13392
13377
  this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
13393
13378
  }
13394
- updateHandlers(handlers2) {
13395
- this.handlers = handlers2;
13379
+ updateHandlers(handlers) {
13380
+ this.handlers = handlers;
13396
13381
  }
13397
13382
  end() {
13398
13383
  this.removeListeners && this.removeListeners();
@@ -16449,6 +16434,24 @@ function NavigationMenuIndicator({
16449
16434
  }
16450
16435
  );
16451
16436
  }
16437
+ var buttonVariants2 = classVarianceAuthority.cva(
16438
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
16439
+ {
16440
+ variants: {
16441
+ variant: {
16442
+ outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
16443
+ ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"
16444
+ },
16445
+ size: {
16446
+ default: "h-9 px-4 py-2 has-[>svg]:px-3",
16447
+ icon: "size-9"
16448
+ }
16449
+ },
16450
+ defaultVariants: {
16451
+ size: "default"
16452
+ }
16453
+ }
16454
+ );
16452
16455
  function Pagination({ className, ...props }) {
16453
16456
  return /* @__PURE__ */ jsxRuntime.jsx(
16454
16457
  "nav",
@@ -16474,24 +16477,21 @@ function PaginationContent({ className, ...props }) {
16474
16477
  function PaginationItem({ ...props }) {
16475
16478
  return /* @__PURE__ */ jsxRuntime.jsx("li", { "data-slot": "pagination-item", ...props });
16476
16479
  }
16477
- function PaginationLink({
16478
- className,
16479
- isActive,
16480
- children,
16481
- href,
16482
- ...props
16483
- }) {
16480
+ function PaginationLink({ className, isActive, size = "icon", ...props }) {
16484
16481
  return /* @__PURE__ */ jsxRuntime.jsx(
16485
- Button2,
16482
+ "a",
16486
16483
  {
16487
16484
  "aria-current": isActive ? "page" : void 0,
16488
16485
  "data-slot": "pagination-link",
16489
16486
  "data-active": isActive,
16490
- variant: isActive ? "outline" : "ghost",
16491
- className: cn("", className),
16492
- href,
16493
- ...props,
16494
- children
16487
+ className: cn(
16488
+ buttonVariants2({
16489
+ variant: isActive ? "outline" : "ghost",
16490
+ size
16491
+ }),
16492
+ className
16493
+ ),
16494
+ ...props
16495
16495
  }
16496
16496
  );
16497
16497
  }
@@ -16501,10 +16501,10 @@ function PaginationPrevious({ className, ...props }) {
16501
16501
  {
16502
16502
  "aria-label": "Go to previous page",
16503
16503
  size: "default",
16504
- className: cn("", className),
16504
+ className: cn("gap-1 px-2.5 sm:pl-2.5", className),
16505
16505
  ...props,
16506
16506
  children: [
16507
- /* @__PURE__ */ jsxRuntime.jsx(Icons.west, { "aria-hidden": "true" }),
16507
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.west, {}),
16508
16508
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:block", children: "Previous" })
16509
16509
  ]
16510
16510
  }
@@ -16516,11 +16516,11 @@ function PaginationNext({ className, ...props }) {
16516
16516
  {
16517
16517
  "aria-label": "Go to next page",
16518
16518
  size: "default",
16519
- className: cn("", className),
16519
+ className: cn("gap-1 px-2.5 sm:pr-2.5", className),
16520
16520
  ...props,
16521
16521
  children: [
16522
16522
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "hidden sm:block", children: "Next" }),
16523
- /* @__PURE__ */ jsxRuntime.jsx(Icons.east, { "aria-hidden": "true" })
16523
+ /* @__PURE__ */ jsxRuntime.jsx(Icons.east, {})
16524
16524
  ]
16525
16525
  }
16526
16526
  );
@@ -23026,64 +23026,6 @@ function DescriptionDetails({ className, ...props }) {
23026
23026
  function generateLevelId() {
23027
23027
  return `level-${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
23028
23028
  }
23029
- function getMaxDepth(items, currentDepth = 1) {
23030
- if (!items || !Array.isArray(items) || items.length === 0) {
23031
- return currentDepth;
23032
- }
23033
- let maxDepth2 = currentDepth;
23034
- for (const item of items) {
23035
- if (item && item.links && Array.isArray(item.links) && item.links.length > 0) {
23036
- const itemDepth = getMaxDepth(item.links, currentDepth + 1);
23037
- maxDepth2 = Math.max(maxDepth2, itemDepth);
23038
- }
23039
- }
23040
- return maxDepth2;
23041
- }
23042
- function findItemById(items, id3) {
23043
- if (!items || !Array.isArray(items)) {
23044
- return null;
23045
- }
23046
- for (const item of items) {
23047
- if (!item) continue;
23048
- if (item.id === id3) {
23049
- return item;
23050
- }
23051
- if (item.links && Array.isArray(item.links)) {
23052
- const found = findItemById(item.links, id3);
23053
- if (found) return found;
23054
- }
23055
- }
23056
- return null;
23057
- }
23058
- function findPathToItem(items, targetId, path = []) {
23059
- if (!items || !Array.isArray(items)) {
23060
- return null;
23061
- }
23062
- for (const item of items) {
23063
- if (!item) continue;
23064
- const currentPath = [...path, item];
23065
- if (item.id === targetId) {
23066
- return currentPath;
23067
- }
23068
- if (item.links && Array.isArray(item.links)) {
23069
- const found = findPathToItem(item.links, targetId, currentPath);
23070
- if (found) return found;
23071
- }
23072
- }
23073
- return null;
23074
- }
23075
- function getTotalItemCount(items) {
23076
- if (!items || !Array.isArray(items)) {
23077
- return 0;
23078
- }
23079
- let count = items.length;
23080
- for (const item of items) {
23081
- if (item && item.links && Array.isArray(item.links)) {
23082
- count += getTotalItemCount(item.links);
23083
- }
23084
- }
23085
- return count;
23086
- }
23087
23029
  function generateBreadcrumb(levels, maxLength = 50) {
23088
23030
  if (levels.length <= 1) return levels[0]?.title || "Menu";
23089
23031
  const breadcrumb = levels.map((level) => level.title).join(" \u203A ");
@@ -23391,166 +23333,6 @@ function MobileHeader({
23391
23333
  ] })
23392
23334
  ] });
23393
23335
  }
23394
-
23395
- // src/db/schema/users.ts
23396
- var users_exports = {};
23397
- __export(users_exports, {
23398
- users: () => users
23399
- });
23400
- var users = sqliteCore.sqliteTable("user", {
23401
- id: sqliteCore.text("id").primaryKey().$defaultFn(() => crypto.randomUUID()),
23402
- name: sqliteCore.text("name"),
23403
- email: sqliteCore.text("email").unique(),
23404
- emailVerified: sqliteCore.integer("emailVerified", { mode: "timestamp_ms" }),
23405
- image: sqliteCore.text("image"),
23406
- role: sqliteCore.text("role", { enum: ["ADMIN", "USER"] }).default("USER")
23407
- });
23408
-
23409
- // src/db/schema/accounts.ts
23410
- var accounts_exports = {};
23411
- __export(accounts_exports, {
23412
- accounts: () => accounts
23413
- });
23414
- var accounts = sqliteCore.sqliteTable(
23415
- "account",
23416
- {
23417
- userId: sqliteCore.text("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
23418
- type: sqliteCore.text("type").$type().notNull(),
23419
- provider: sqliteCore.text("provider").notNull(),
23420
- providerAccountId: sqliteCore.text("providerAccountId").notNull(),
23421
- refresh_token: sqliteCore.text("refresh_token"),
23422
- access_token: sqliteCore.text("access_token"),
23423
- expires_at: sqliteCore.integer("expires_at"),
23424
- token_type: sqliteCore.text("token_type"),
23425
- scope: sqliteCore.text("scope"),
23426
- id_token: sqliteCore.text("id_token"),
23427
- session_state: sqliteCore.text("session_state")
23428
- },
23429
- (table) => [
23430
- sqliteCore.primaryKey({
23431
- columns: [table.provider, table.providerAccountId],
23432
- name: "accounts_pk"
23433
- })
23434
- ]
23435
- );
23436
-
23437
- // src/db/schema/sessions.ts
23438
- var sessions_exports = {};
23439
- __export(sessions_exports, {
23440
- sessions: () => sessions
23441
- });
23442
- var sessions = sqliteCore.sqliteTable("session", {
23443
- sessionToken: sqliteCore.text("sessionToken").primaryKey(),
23444
- userId: sqliteCore.text("userId").notNull().references(() => users.id, { onDelete: "cascade" }),
23445
- expires: sqliteCore.integer("expires", { mode: "timestamp_ms" }).notNull()
23446
- });
23447
-
23448
- // src/db/index.ts
23449
- var client = client$1.createClient({
23450
- url: process.env.TURSO_CONNECTION_URL,
23451
- authToken: process.env.TURSO_AUTH_TOKEN
23452
- });
23453
- var db = libsql.drizzle(client, {
23454
- schema: {
23455
- ...users_exports,
23456
- ...accounts_exports,
23457
- ...sessions_exports
23458
- }
23459
- });
23460
-
23461
- // src/auth.ts
23462
- var { handlers, signIn, signOut, auth } = NextAuth__default.default({
23463
- adapter: drizzleAdapter.DrizzleAdapter(db),
23464
- providers: [
23465
- MicrosoftEntraID__default.default({
23466
- clientId: process.env.AUTH_MICROSOFT_ENTRA_ID_ID,
23467
- clientSecret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
23468
- issuer: process.env.AUTH_MICROSOFT_ENTRA_ID_ISSUER,
23469
- authorization: {
23470
- params: {
23471
- scope: "openid profile email User.Read offline_access",
23472
- tenant: process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT_ID
23473
- }
23474
- }
23475
- })
23476
- ],
23477
- callbacks: {
23478
- authorized: async ({ auth: auth2, request }) => {
23479
- if (request.nextUrl.pathname.startsWith("/")) {
23480
- return true;
23481
- }
23482
- return !!auth2;
23483
- },
23484
- jwt({ token, user }) {
23485
- if (user) {
23486
- token.id = user.id;
23487
- }
23488
- return token;
23489
- },
23490
- async session({ session, user }) {
23491
- session.user.id = user.id;
23492
- const [microsoftAccount] = await db.select().from(accounts).where(drizzleOrm.and(drizzleOrm.eq(accounts.userId, user.id), drizzleOrm.eq(accounts.provider, "microsoft-entra-id"))).limit(1);
23493
- if (microsoftAccount && microsoftAccount.expires_at && microsoftAccount.expires_at * 1e3 < Date.now()) {
23494
- try {
23495
- const tokenEndpoint = `https://login.microsoftonline.com/${process.env.AUTH_MICROSOFT_ENTRA_ID_TENANT_ID}/oauth2/v2.0/token`;
23496
- const response = await fetch(tokenEndpoint, {
23497
- method: "POST",
23498
- headers: {
23499
- "Content-Type": "application/x-www-form-urlencoded"
23500
- },
23501
- body: new URLSearchParams({
23502
- client_id: process.env.AUTH_MICROSOFT_ENTRA_ID_ID,
23503
- client_secret: process.env.AUTH_MICROSOFT_ENTRA_ID_SECRET,
23504
- grant_type: "refresh_token",
23505
- refresh_token: microsoftAccount.refresh_token,
23506
- scope: "openid profile email offline_access"
23507
- })
23508
- });
23509
- const tokensOrError = await response.json();
23510
- if (!response.ok) throw tokensOrError;
23511
- const newTokens = tokensOrError;
23512
- await db.update(accounts).set({
23513
- access_token: newTokens.access_token,
23514
- expires_at: Math.floor(Date.now() / 1e3 + newTokens.expires_in),
23515
- refresh_token: newTokens.refresh_token ?? microsoftAccount.refresh_token,
23516
- id_token: newTokens.id_token ?? microsoftAccount.id_token
23517
- }).where(
23518
- drizzleOrm.and(
23519
- drizzleOrm.eq(accounts.provider, "microsoft-entra-id"),
23520
- drizzleOrm.eq(accounts.providerAccountId, microsoftAccount.providerAccountId)
23521
- )
23522
- );
23523
- } catch (error) {
23524
- console.error("Error refreshing access_token", error);
23525
- session.error = "RefreshTokenError";
23526
- }
23527
- }
23528
- return session;
23529
- }
23530
- }
23531
- });
23532
-
23533
- // src/actions/auth-actions.ts
23534
- async function signInWithEntra(formData) {
23535
- const redirect = formData.get("redirect")?.toString() || "/dashboard";
23536
- await signIn("microsoft-entra-id", { redirectTo: redirect });
23537
- }
23538
- async function signInGeneric(formData) {
23539
- const redirect = formData.get("redirect")?.toString() || "/dashboard";
23540
- await signIn(void 0, { redirectTo: redirect });
23541
- }
23542
- async function signOutAction() {
23543
- await signOut();
23544
- }
23545
- function SignInButton() {
23546
- return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signInGeneric, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", variant: "outline", children: "Sign in" }) });
23547
- }
23548
- function SignOutButton() {
23549
- return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signOutAction, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", color: "danger", children: "Sign Out" }) });
23550
- }
23551
- function SignInWithEntraButton() {
23552
- return /* @__PURE__ */ jsxRuntime.jsx("form", { action: signInWithEntra, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", children: "Sign in with Entra" }) });
23553
- }
23554
23336
  var MOBILE_BREAKPOINT = 768;
23555
23337
  function useIsMobile() {
23556
23338
  const [isMobile, setIsMobile] = React16__namespace.useState(void 0);
@@ -23581,15 +23363,15 @@ function useDisableToc() {
23581
23363
  }, [setToc]);
23582
23364
  }
23583
23365
  function getNodeText(node) {
23584
- let text4 = "";
23366
+ let text = "";
23585
23367
  for (const child of node.children ?? []) {
23586
23368
  if ("type" in child && child.type === "text") {
23587
- text4 += child.attributes?.content ?? "";
23369
+ text += child.attributes?.content ?? "";
23588
23370
  } else if (child instanceof HTMLElement) {
23589
- text4 += getNodeText(child);
23371
+ text += getNodeText(child);
23590
23372
  }
23591
23373
  }
23592
- return text4;
23374
+ return text;
23593
23375
  }
23594
23376
  function domToSimple(node) {
23595
23377
  if (node.nodeType === Node.TEXT_NODE) {
@@ -23967,9 +23749,6 @@ exports.SheetTitle = SheetTitle;
23967
23749
  exports.SheetTrigger = SheetTrigger;
23968
23750
  exports.SidebarLink = SidebarLink;
23969
23751
  exports.SidebarNavigation = SidebarNavigation;
23970
- exports.SignInButton = SignInButton;
23971
- exports.SignInWithEntraButton = SignInWithEntraButton;
23972
- exports.SignOutButton = SignOutButton;
23973
23752
  exports.SiteSearch = SiteSearch;
23974
23753
  exports.Skeleton = Skeleton;
23975
23754
  exports.Slider = Slider;
@@ -24037,20 +23816,14 @@ exports.createColorData = createColorData;
24037
23816
  exports.createFormStore = createFormStore;
24038
23817
  exports.darkenColor = darkenColor;
24039
23818
  exports.domToSimple = domToSimple;
24040
- exports.findItemById = findItemById;
24041
- exports.findPathToItem = findPathToItem;
24042
23819
  exports.focusInput = focusInput;
24043
23820
  exports.focusRing = focusRing;
24044
- exports.generateBreadcrumb = generateBreadcrumb;
24045
23821
  exports.generateColorThemes = generateColorThemes;
24046
- exports.generateLevelId = generateLevelId;
24047
23822
  exports.getColorClassName = getColorClassName;
24048
23823
  exports.getColorValue = getColorValue;
24049
23824
  exports.getHeadings = getHeadings;
24050
- exports.getMaxDepth = getMaxDepth;
24051
23825
  exports.getNodeText = getNodeText;
24052
23826
  exports.getSurroundingColors = getSurroundingColors;
24053
- exports.getTotalItemCount = getTotalItemCount;
24054
23827
  exports.getYAxisDomain = getYAxisDomain;
24055
23828
  exports.hasErrorInput = hasErrorInput;
24056
23829
  exports.hasOnlyOneValueForKey = hasOnlyOneValueForKey;