1(() => { 2 var __create = Object.create; 3 var __defProp = Object.defineProperty; 4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 5 var __getOwnPropNames = Object.getOwnPropertyNames; 6 var __getProtoOf = Object.getPrototypeOf; 7 var __hasOwnProp = Object.prototype.hasOwnProperty; 8 var __commonJS = (cb, mod) => function __require() { 9 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 10 }; 11 var __copyProps = (to, from, except, desc) => { 12 if (from && typeof from === "object" || typeof from === "function") { 13 for (let key of __getOwnPropNames(from)) 14 if (!__hasOwnProp.call(to, key) && key !== except) 15 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 16 } 17 return to; 18 }; 19 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); 20 21
vendor: 10,237 bytes, lines 21-298
21// node_modules/nprogress/nprogress.js 22 var require_nprogress = __commonJS({ 23 "node_modules/nprogress/nprogress.js"(exports, module) { 24 (function(root, factory) { 25 if (typeof define === "function" && define.amd) { 26 define(factory); 27 } else if (typeof exports === "object") { 28 module.exports = factory(); 29 } else { 30 root.NProgress = factory(); 31 } 32 })(exports, function() { 33 var NProgress2 = {}; 34 NProgress2.version = "0.2.0"; 35 var Settings = NProgress2.settings = { 36 minimum: 0.08, 37 easing: "ease", 38 positionUsing: "", 39 speed: 200, 40 trickle: true, 41 trickleRate: 0.02, 42 trickleSpeed: 800, 43 showSpinner: true, 44 barSelector: '[role="bar"]', 45 spinnerSelector: '[role="spinner"]', 46 parent: "body", 47 template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>' 48 }; 49 NProgress2.configure = function(options) { 50 var key, value; 51 for (key in options) { 52 value = options[key]; 53 if (value !== void 0 && options.hasOwnProperty(key)) 54 Settings[key] = value; 55 } 56 return this; 57 }; 58 NProgress2.status = null; 59 NProgress2.set = function(n) { 60 var started2 = NProgress2.isStarted(); 61 n = clamp2(n, Settings.minimum, 1); 62 NProgress2.status = n === 1 ? null : n; 63 var progress = NProgress2.render(!started2), bar = progress.querySelector(Settings.barSelector), speed = Settings.speed, ease = Settings.easing; 64 progress.offsetWidth; 65 queue2(function(next) { 66 if (Settings.positionUsing === "") 67 Settings.positionUsing = NProgress2.getPositioningCSS(); 68 css(bar, barPositionCSS(n, speed, ease)); 69 if (n === 1) { 70 css(progress, { 71 transition: "none", 72 opacity: 1 73 }); 74 progress.offsetWidth; 75 setTimeout(function() { 76 css(progress, { 77 transition: "all " + speed + "ms linear", 78 opacity: 0 79 }); 80 setTimeout(function() { 81 NProgress2.remove(); 82 next(); 83 }, speed); 84 }, speed); 85 } else { 86 setTimeout(next, speed); 87 } 88 }); 89 return this; 90 }; 91 NProgress2.isStarted = function() { 92 return typeof NProgress2.status === "number"; 93 }; 94 NProgress2.start = function() { 95 if (!NProgress2.status) 96 NProgress2.set(0); 97 var work = function() { 98 setTimeout(function() { 99 if (!NProgress2.status) 100 return; 101 NProgress2.trickle(); 102 work(); 103 }, Settings.trickleSpeed); 104 }; 105 if (Settings.trickle) 106 work(); 107 return this; 108 }; 109 NProgress2.done = function(force) { 110 if (!force && !NProgress2.status) 111 return this; 112 return NProgress2.inc(0.3 + 0.5 * Math.random()).set(1); 113 }; 114 NProgress2.inc = function(amount) { 115 var n = NProgress2.status; 116 if (!n) { 117 return NProgress2.start(); 118 } else { 119 if (typeof amount !== "number") { 120 amount = (1 - n) * clamp2(Math.random() * n, 0.1, 0.95); 121 } 122 n = clamp2(n + amount, 0, 0.994); 123 return NProgress2.set(n); 124 } 125 }; 126 NProgress2.trickle = function() { 127 return NProgress2.inc(Math.random() * Settings.trickleRate); 128 }; 129 (function() { 130 var initial = 0, current = 0; 131 NProgress2.promise = function($promise) { 132 if (!$promise || $promise.state() === "resolved") { 133 return this; 134 } 135 if (current === 0) { 136 NProgress2.start(); 137 } 138 initial++; 139 current++; 140 $promise.always(function() { 141 current--; 142 if (current === 0) { 143 initial = 0; 144 NProgress2.done(); 145 } else { 146 NProgress2.set((initial - current) / initial); 147 } 148 }); 149 return this; 150 }; 151 })(); 152 NProgress2.render = function(fromStart) { 153 if (NProgress2.isRendered()) 154 return document.getElementById("nprogress"); 155 addClass(document.documentElement, "nprogress-busy"); 156 var progress = document.createElement("div"); 157 progress.id = "nprogress"; 158 progress.innerHTML = Settings.template; 159 var bar = progress.querySelector(Settings.barSelector), perc = fromStart ? "-100" : toBarPerc(NProgress2.status || 0), parent = document.querySelector(Settings.parent), spinner; 160 css(bar, { 161 transition: "all 0 linear", 162 transform: "translate3d(" + perc + "%,0,0)" 163 }); 164 if (!Settings.showSpinner) { 165 spinner = progress.querySelector(Settings.spinnerSelector); 166 spinner && removeElement(spinner); 167 } 168 if (parent != document.body) { 169 addClass(parent, "nprogress-custom-parent"); 170 } 171 parent.appendChild(progress); 172 return progress; 173 }; 174 NProgress2.remove = function() { 175 removeClass(document.documentElement, "nprogress-busy"); 176 removeClass(document.querySelector(Settings.parent), "nprogress-custom-parent"); 177 var progress = document.getElementById("nprogress"); 178 progress && removeElement(progress); 179 }; 180 NProgress2.isRendered = function() { 181 return !!document.getElementById("nprogress"); 182 }; 183 NProgress2.getPositioningCSS = function() { 184 var bodyStyle = document.body.style; 185 var vendorPrefix = "WebkitTransform" in bodyStyle ? "Webkit" : "MozTransform" in bodyStyle ? "Moz" : "msTransform" in bodyStyle ? "ms" : "OTransform" in bodyStyle ? "O" : ""; 186 if (vendorPrefix + "Perspective" in bodyStyle) { 187 return "translate3d"; 188 } else if (vendorPrefix + "Transform" in bodyStyle) { 189 return "translate"; 190 } else { 191 return "margin"; 192 } 193 }; 194 function clamp2(n, min2, max2) { 195 if (n < min2) 196 return min2; 197 if (n > max2) 198 return max2; 199 return n; 200 } 201 function toBarPerc(n) { 202 return (-1 + n) * 100; 203 } 204 function barPositionCSS(n, speed, ease) { 205 var barCSS; 206 if (Settings.positionUsing === "translate3d") { 207 barCSS = { transform: "translate3d(" + toBarPerc(n) + "%,0,0)" }; 208 } else if (Settings.positionUsing === "translate") { 209 barCSS = { transform: "translate(" + toBarPerc(n) + "%,0)" }; 210 } else { 211 barCSS = { "margin-left": toBarPerc(n) + "%" }; 212 } 213 barCSS.transition = "all " + speed + "ms " + ease; 214 return barCSS; 215 } 216 var queue2 = function() { 217 var pending = []; 218 function next() { 219 var fn = pending.shift(); 220 if (fn) { 221 fn(next); 222 } 223 } 224 return function(fn) { 225 pending.push(fn); 226 if (pending.length == 1) 227 next(); 228 }; 229 }(); 230 var css = function() { 231 var cssPrefixes = ["Webkit", "O", "Moz", "ms"], cssProps = {}; 232 function camelCase3(string) { 233 return string.replace(/^-ms-/, "ms-").replace(/-([\da-z])/gi, function(match, letter) { 234 return letter.toUpperCase(); 235 }); 236 } 237 function getVendorProp(name) { 238 var style = document.body.style; 239 if (name in style) 240 return name; 241 var i = cssPrefixes.length, capName = name.charAt(0).toUpperCase() + name.slice(1), vendorName; 242 while (i--) { 243 vendorName = cssPrefixes[i] + capName; 244 if (vendorName in style) 245 return vendorName; 246 } 247 return name; 248 } 249 function getStyleProp(name) { 250 name = camelCase3(name); 251 return cssProps[name] || (cssProps[name] = getVendorProp(name)); 252 } 253 function applyCss(element, prop, value) { 254 prop = getStyleProp(prop); 255 element.style[prop] = value; 256 } 257 return function(element, properties2) { 258 var args = arguments, prop, value; 259 if (args.length == 2) { 260 for (prop in properties2) { 261 value = properties2[prop]; 262 if (value !== void 0 && properties2.hasOwnProperty(prop)) 263 applyCss(element, prop, value); 264 } 265 } else { 266 applyCss(element, args[1], args[2]); 267 } 268 }; 269 }(); 270 function hasClass(element, name) { 271 var list = typeof element == "string" ? element : classList(element); 272 return list.indexOf(" " + name + " ") >= 0; 273 } 274 function addClass(element, name) { 275 var oldList = classList(element), newList = oldList + name; 276 if (hasClass(oldList, name)) 277 return; 278 element.className = newList.substring(1); 279 } 280 function removeClass(element, name) { 281 var oldList = classList(element), newList; 282 if (!hasClass(element, name)) 283 return; 284 newList = oldList.replace(" " + name + " ", " "); 285 element.className = newList.substring(1, newList.length - 1); 286 } 287 function classList(element) { 288 return (" " + (element.className || "") + " ").replace(/\s+/gi, " "); 289 } 290 function removeElement(element) { 291 element && element.parentNode && element.parentNode.removeChild(element); 292 } 293 return NProgress2; 294 }); 295 } 296 }); 297 298
298// js/utils.js 299 var Bag = class { 300 constructor() { 301 this.arrays = {}; 302 } 303 add(key, value) { 304 if (!this.arrays[key]) 305 this.arrays[key] = []; 306 this.arrays[key].push(value); 307 } 308 remove(key) { 309 if (this.arrays[key]) 310 delete this.arrays[key]; 311 } 312 get(key) { 313 return this.arrays[key] || []; 314 } 315 each(key, callback) { 316 return this.get(key).forEach(callback); 317 } 318 }; 319 var WeakBag = class { 320 constructor() { 321 this.arrays = /* @__PURE__ */ new WeakMap(); 322 } 323 add(key, value) { 324 if (!this.arrays.has(key)) 325 this.arrays.set(key, []); 326 this.arrays.get(key).push(value); 327 } 328 remove(key) { 329 if (this.arrays.has(key)) 330 this.arrays.delete(key, []); 331 } 332 get(key) { 333 return this.arrays.has(key) ? this.arrays.get(key) : []; 334 } 335 each(key, callback) { 336 return this.get(key).forEach(callback); 337 } 338 }; 339 function dispatch(target, name, detail = {}, bubbles = true) { 340 target.dispatchEvent(new CustomEvent(name, { 341 detail, 342 bubbles, 343 composed: true, 344 cancelable: true 345 })); 346 } 347 function listen(target, name, handler4) { 348 target.addEventListener(name, handler4); 349 return () => target.removeEventListener(name, handler4); 350 } 351 function isObjecty(subject) { 352 return typeof subject === "object" && subject !== null; 353 } 354 function isObject(subject) { 355 return isObjecty(subject) && !isArray(subject); 356 } 357 function isArray(subject) { 358 return Array.isArray(subject); 359 } 360 function isFunction(subject) { 361 return typeof subject === "function"; 362 } 363 function isPrimitive(subject) { 364 return typeof subject !== "object" || subject === null; 365 } 366 function deepClone(obj) { 367 return JSON.parse(JSON.stringify(obj)); 368 } 369 function dataGet(object, key) { 370 if (key === "") 371 return object; 372 return key.split(".").reduce((carry, i) => { 373 return carry?.[i]; 374 }, object); 375 } 376 function dataSet(object, key, value) { 377 let segments = key.split("."); 378 if (segments.length === 1) { 379 return object[key] = value; 380 } 381 let firstSegment = segments.shift(); 382 let restOfSegments = segments.join("."); 383 if (object[firstSegment] === void 0) { 384 object[firstSegment] = {}; 385 } 386 dataSet(object[firstSegment], restOfSegments, value); 387 } 388 function diff(left, right, diffs = {}, path = "") { 389 if (left === right) 390 return diffs; 391 if (typeof left !== typeof right || isObject(left) && isArray(right) || isArray(left) && isObject(right)) { 392 diffs[path] = right; 393 return diffs; 394 } 395 if (isPrimitive(left) || isPrimitive(right)) { 396 diffs[path] = right; 397 return diffs; 398 } 399 let leftKeys = Object.keys(left); 400 let rightKeys = Object.keys(right); 401 if (isObject(left) && leftKeys.length === rightKeys.length && leftKeys.some((key, i) => key !== rightKeys[i])) { 402 diffs[path] = right; 403 return diffs; 404 } 405 Object.entries(right).forEach(([key, value]) => { 406 diffs = { ...diffs, ...diff(left[key], right[key], diffs, path === "" ? key : `${path}.${key}`) }; 407 leftKeys = leftKeys.filter((i) => i !== key); 408 }); 409 leftKeys.forEach((key) => { 410 diffs[`${path}.${key}`] = "__rm__"; 411 }); 412 return diffs; 413 } 414 function extractData(payload) { 415 let value = isSynthetic(payload) ? payload[0] : payload; 416 let meta = isSynthetic(payload) ? payload[1] : void 0; 417 if (isObjecty(value)) { 418 Object.entries(value).forEach(([key, iValue]) => { 419 value[key] = extractData(iValue); 420 }); 421 } 422 return value; 423 } 424 function isSynthetic(subject) { 425 return Array.isArray(subject) && subject.length === 2 && typeof subject[1] === "object" && Object.keys(subject[1]).includes("s"); 426 } 427 function getCsrfToken() { 428 if (document.querySelector('meta[name="csrf-token"]')) { 429 return document.querySelector('meta[name="csrf-token"]').getAttribute("content"); 430 } 431 if (document.querySelector("[data-csrf]")) { 432 return document.querySelector("[data-csrf]").getAttribute("data-csrf"); 433 } 434 if (window.livewireScriptConfig["csrf"] ?? false) { 435 return window.livewireScriptConfig["csrf"]; 436 } 437 throw "Livewire: No CSRF token detected"; 438 } 439 var nonce; 440 function getNonce() { 441 if (nonce) 442 return nonce; 443 if (window.livewireScriptConfig && (window.livewireScriptConfig["nonce"] ?? false)) { 444 nonce = window.livewireScriptConfig["nonce"]; 445 return nonce; 446 } 447 const elWithNonce = document.querySelector("style[data-livewire-style][nonce]"); 448 if (elWithNonce) { 449 nonce = elWithNonce.nonce; 450 return nonce; 451 } 452 return null; 453 } 454 function getUpdateUri() { 455 return document.querySelector("[data-update-uri]")?.getAttribute("data-update-uri") ?? window.livewireScriptConfig["uri"] ?? null; 456 } 457 function contentIsFromDump(content) { 458 return !!content.match(/<script>Sfdump\(".+"\)<\/script>/); 459 } 460 function splitDumpFromContent(content) { 461 let dump = content.match(/.*<script>Sfdump\(".+"\)<\/script>/s); 462 return [dump, content.replace(dump, "")]; 463 } 464 465
465// js/features/supportFileUploads.js 466 var uploadManagers = /* @__PURE__ */ new WeakMap(); 467 function getUploadManager(component) { 468 if (!uploadManagers.has(component)) { 469 let manager = new UploadManager(component); 470 uploadManagers.set(component, manager); 471 manager.registerListeners(); 472 } 473 return uploadManagers.get(component); 474 } 475 function handleFileUpload(el, property, component, cleanup2) { 476 let manager = getUploadManager(component); 477 let start3 = () => el.dispatchEvent(new CustomEvent("livewire-upload-start", { bubbles: true, detail: { id: component.id, property } })); 478 let finish = () => el.dispatchEvent(new CustomEvent("livewire-upload-finish", { bubbles: true, detail: { id: component.id, property } })); 479 let error2 = () => el.dispatchEvent(new CustomEvent("livewire-upload-error", { bubbles: true, detail: { id: component.id, property } })); 480 let cancel = () => el.dispatchEvent(new CustomEvent("livewire-upload-cancel", { bubbles: true, detail: { id: component.id, property } })); 481 let progress = (progressEvent) => { 482 var percentCompleted = Math.round(progressEvent.loaded * 100 / progressEvent.total); 483 el.dispatchEvent(new CustomEvent("livewire-upload-progress", { 484 bubbles: true, 485 detail: { progress: percentCompleted } 486 })); 487 }; 488 let eventHandler = (e) => { 489 if (e.target.files.length === 0) 490 return; 491 start3(); 492 if (e.target.multiple) { 493 let append = ["ui-file-upload"].includes(e.target.tagName.toLowerCase()); 494 manager.uploadMultiple(property, e.target.files, finish, error2, progress, cancel, append); 495 } else { 496 manager.upload(property, e.target.files[0], finish, error2, progress, cancel); 497 } 498 }; 499 el.addEventListener("change", eventHandler); 500 component.$wire.$watch(property, (value) => { 501 if (!el.isConnected) 502 return; 503 if (value === null || value === "") { 504 el.value = ""; 505 } 506 if (el.multiple && Array.isArray(value) && value.length === 0) { 507 el.value = ""; 508 } 509 }); 510 let clearFileInputValue = () => { 511 el.value = null; 512 }; 513 el.addEventListener("click", clearFileInputValue); 514 el.addEventListener("livewire-upload-cancel", clearFileInputValue); 515 cleanup2(() => { 516 el.removeEventListener("change", eventHandler); 517 el.removeEventListener("click", clearFileInputValue); 518 }); 519 } 520 var UploadManager = class { 521 constructor(component) { 522 this.component = component; 523 this.uploadBag = new MessageBag(); 524 this.removeBag = new MessageBag(); 525 } 526 registerListeners() { 527 this.component.$wire.$on("upload:generatedSignedUrl", ({ name, url }) => { 528 setUploadLoading(this.component, name); 529 this.handleSignedUrl(name, url); 530 }); 531 this.component.$wire.$on("upload:generatedSignedUrlForS3", ({ name, payload }) => { 532 setUploadLoading(this.component, name); 533 this.handleS3PreSignedUrl(name, payload); 534 }); 535 this.component.$wire.$on("upload:finished", ({ name, tmpFilenames }) => this.markUploadFinished(name, tmpFilenames)); 536 this.component.$wire.$on("upload:errored", ({ name }) => this.markUploadErrored(name)); 537 this.component.$wire.$on("upload:removed", ({ name, tmpFilename }) => this.removeBag.shift(name).finishCallback(tmpFilename)); 538 } 539 upload(name, file, finishCallback, errorCallback, progressCallback, cancelledCallback) { 540 this.setUpload(name, { 541 files: [file], 542 multiple: false, 543 finishCallback, 544 errorCallback, 545 progressCallback, 546 cancelledCallback, 547 append: false 548 }); 549 } 550 uploadMultiple(name, files, finishCallback, errorCallback, progressCallback, cancelledCallback, append = false) { 551 this.setUpload(name, { 552 files: Array.from(files), 553 multiple: true, 554 finishCallback, 555 errorCallback, 556 progressCallback, 557 cancelledCallback, 558 append 559 }); 560 } 561 removeUpload(name, tmpFilename, finishCallback) { 562 this.removeBag.push(name, { 563 tmpFilename, 564 finishCallback 565 }); 566 this.component.$wire.call("_removeUpload", name, tmpFilename); 567 } 568 setUpload(name, uploadObject) { 569 this.uploadBag.add(name, uploadObject); 570 if (this.uploadBag.get(name).length === 1) { 571 this.startUpload(name, uploadObject); 572 } 573 } 574 handleSignedUrl(name, url) { 575 let formData = new FormData();
576 Array.from(this.uploadBag.first(name).files).forEach((file) => formData.append("files[]", file, file.name)); 577 let headers = { 578 "Accept": "application/json" 579 }; 580 let csrfToken = getCsrfToken(); 581 if (csrfToken) 582 headers["X-CSRF-TOKEN"] = csrfToken; 583 this.makeRequest(name, formData, "post", url, headers, (response) => { 584 return response.paths; 585 }); 586 } 587 handleS3PreSignedUrl(name, payload) { 588 let formData = this.uploadBag.first(name).files[0]; 589 let headers = payload.headers; 590 if ("Host" in headers) 591 delete headers.Host; 592 let url = payload.url; 593 this.makeRequest(name, formData, "put", url, headers, (response) => { 594 return [payload.path]; 595 }); 596 } 597 makeRequest(name, formData, method, url, headers, retrievePaths) { 598 let request = new XMLHttpRequest(); 599 request.open(method, url); 600 Object.entries(headers).forEach(([key, value]) => { 601 request.setRequestHeader(key, value); 602 }); 603 request.upload.addEventListener("progress", (e) => { 604 e.detail = {}; 605 e.detail.progress = Math.floor(e.loaded * 100 / e.total); 606 this.uploadBag.first(name).progressCallback(e); 607 }); 608 request.addEventListener("load", () => { 609 if ((request.status + "")[0] === "2") { 610 let paths = retrievePaths(request.response && JSON.parse(request.response)); 611 this.component.$wire.call("_finishUpload", name, paths, this.uploadBag.first(name).multiple, this.uploadBag.first(name).append); 612 return; 613 } 614 let errors = null; 615 if (request.status === 422) { 616 errors = request.response; 617 } 618 this.component.$wire.call("_uploadErrored", name, errors, this.uploadBag.first(name).multiple); 619 }); 620 this.uploadBag.first(name).request = request; 621 request.send(formData); 622 } 623 startUpload(name, uploadObject) { 624 let fileInfos = uploadObject.files.map((file) => { 625 return { name: file.name, size: file.size, type: file.type }; 626 }); 627 this.component.$wire.call("_startUpload", name, fileInfos, uploadObject.multiple); 628 setUploadLoading(this.component, name); 629 } 630 markUploadFinished(name, tmpFilenames) { 631 unsetUploadLoading(this.component); 632 let uploadObject = this.uploadBag.shift(name); 633 uploadObject.finishCallback(uploadObject.multiple ? tmpFilenames : tmpFilenames[0]); 634 if (this.uploadBag.get(name).length > 0) 635 this.startUpload(name, this.uploadBag.last(name)); 636 } 637 markUploadErrored(name) { 638 unsetUploadLoading(this.component); 639 this.uploadBag.shift(name).errorCallback(); 640 if (this.uploadBag.get(name).length > 0) 641 this.startUpload(name, this.uploadBag.last(name)); 642 } 643 cancelUpload(name, cancelledCallback = null) { 644 unsetUploadLoading(this.component); 645 let uploadItem = this.uploadBag.first(name); 646 if (uploadItem) { 647 if (uploadItem.request) { 648 uploadItem.request.abort(); 649 } 650 this.uploadBag.shift(name).cancelledCallback(); 651 if (cancelledCallback) 652 cancelledCallback(); 653 } 654 } 655 }; 656 var MessageBag = class { 657 constructor() { 658 this.bag = {}; 659 } 660 add(name, thing) { 661 if (!this.bag[name]) { 662 this.bag[name] = []; 663 } 664 this.bag[name].push(thing); 665 } 666 push(name, thing) { 667 this.add(name, thing); 668 } 669 first(name) { 670 if (!this.bag[name]) 671 return null; 672 return this.bag[name][0]; 673 } 674 last(name) { 675 return this.bag[name].slice(-1)[0]; 676 } 677 get(name) { 678 return this.bag[name]; 679 } 680 shift(name) { 681 return this.bag[name].shift(); 682 } 683 call(name, ...params) { 684 (this.listeners[name] || []).forEach((callback) => { 685 callback(...params); 686 }); 687 } 688 has(name) { 689 return Object.keys(this.listeners).includes(name); 690 } 691 }; 692 function setUploadLoading() { 693 } 694 function unsetUploadLoading() { 695 } 696 function upload(component, name, file, finishCallback = () => { 697 }, errorCallback = () => { 698 }, progressCallback = () => { 699 }, cancelledCallback = () => { 700 }) { 701 let uploadManager = getUploadManager(component); 702 uploadManager.upload(name, file, finishCallback, errorCallback, progressCallback, cancelledCallback); 703 } 704 function uploadMultiple(component, name, files, finishCallback = () => { 705 }, errorCallback = () => { 706 }, progressCallback = () => { 707 }, cancelledCallback = () => { 708 }, append = false) { 709 let uploadManager = getUploadManager(component); 710 uploadManager.uploadMultiple(name, files, finishCallback, errorCallback, progressCallback, cancelledCallback, append); 711 } 712 function removeUpload(component, name, tmpFilename, finishCallback = () => { 713 }, errorCallback = () => { 714 }) { 715 let uploadManager = getUploadManager(component); 716 uploadManager.removeUpload(name, tmpFilename, finishCallback, errorCallback); 717 } 718 function cancelUpload(component, name, cancelledCallback = () => { 719 }) { 720 let uploadManager = getUploadManager(component); 721 uploadManager.cancelUpload(name, cancelledCallback); 722 } 723 724
vendor: 109,180 bytes, lines 724-4018
724// node_modules/alpinejs/dist/module.esm.js 725 var flushPending = false; 726 var flushing = false; 727 var queue = []; 728 var lastFlushedIndex = -1; 729 var transactionActive = false; 730 function scheduler(callback) { 731 queueJob(callback); 732 } 733 function startTransaction() { 734 transactionActive = true; 735 } 736 function commitTransaction() { 737 transactionActive = false; 738 queueFlush(); 739 } 740 function queueJob(job) { 741 if (!queue.includes(job)) 742 queue.push(job); 743 queueFlush(); 744 } 745 function dequeueJob(job) { 746 let index = queue.indexOf(job); 747 if (index !== -1 && index > lastFlushedIndex) 748 queue.splice(index, 1); 749 } 750 function queueFlush() { 751 if (!flushing && !flushPending) { 752 if (transactionActive) 753 return; 754 flushPending = true; 755 queueMicrotask(flushJobs); 756 } 757 } 758 function flushJobs() { 759 flushPending = false; 760 flushing = true; 761 for (let i = 0; i < queue.length; i++) { 762 queue[i](); 763 lastFlushedIndex = i; 764 } 765 queue.length = 0; 766 lastFlushedIndex = -1; 767 flushing = false; 768 } 769 var reactive; 770 var effect; 771 var release; 772 var raw; 773 var shouldSchedule = true; 774 function disableEffectScheduling(callback) { 775 shouldSchedule = false; 776 callback(); 777 shouldSchedule = true; 778 } 779 function setReactivityEngine(engine) { 780 reactive = engine.reactive; 781 release = engine.release; 782 effect = (callback) => engine.effect(callback, { scheduler: (task) => { 783 if (shouldSchedule) { 784 scheduler(task); 785 } else { 786 task(); 787 } 788 } }); 789 raw = engine.raw; 790 } 791 function overrideEffect(override) { 792 effect = override; 793 } 794 function elementBoundEffect(el) { 795 let cleanup2 = () => { 796 }; 797 let wrappedEffect = (callback) => { 798 let effectReference = effect(callback); 799 if (!el._x_effects) { 800 el._x_effects = /* @__PURE__ */ new Set(); 801 el._x_runEffects = () => { 802 el._x_effects.forEach((i) => i()); 803 }; 804 } 805 el._x_effects.add(effectReference); 806 cleanup2 = () => { 807 if (effectReference === void 0) 808 return; 809 el._x_effects.delete(effectReference); 810 release(effectReference); 811 }; 812 return effectReference; 813 }; 814 return [wrappedEffect, () => { 815 cleanup2(); 816 }]; 817 } 818 function watch(getter, callback) { 819 let firstTime = true; 820 let oldValue; 821 let oldValueJSON; 822 let effectReference = effect(() => { 823 let value = getter(); 824 let newJSON = JSON.stringify(value); 825 if (!firstTime) { 826 if (typeof value === "object" || value !== oldValue) { 827 let previousValue = typeof oldValue === "object" ? JSON.parse(oldValueJSON) : oldValue; 828 queueMicrotask(() => { 829 callback(value, previousValue); 830 }); 831 } 832 } 833 oldValue = value; 834 oldValueJSON = newJSON; 835 firstTime = false; 836 }); 837 return () => release(effectReference); 838 } 839 async function transaction(callback) { 840 startTransaction(); 841 try { 842 await callback(); 843 await Promise.resolve(); 844 } finally { 845 commitTransaction(); 846 } 847 } 848 var onAttributeAddeds = []; 849 var onElRemoveds = []; 850 var onElAddeds = []; 851 function onElAdded(callback) { 852 onElAddeds.push(callback); 853 } 854 function onElRemoved(el, callback) { 855 if (typeof callback === "function") { 856 if (!el._x_cleanups) 857 el._x_cleanups = []; 858 el._x_cleanups.push(callback); 859 } else { 860 callback = el; 861 onElRemoveds.push(callback); 862 } 863 } 864 function onAttributesAdded(callback) { 865 onAttributeAddeds.push(callback); 866 } 867 function onAttributeRemoved(el, name, callback) { 868 if (!el._x_attributeCleanups) 869 el._x_attributeCleanups = {}; 870 if (!el._x_attributeCleanups[name]) 871 el._x_attributeCleanups[name] = []; 872 el._x_attributeCleanups[name].push(callback); 873 } 874 function cleanupAttributes(el, names) { 875 if (!el._x_attributeCleanups) 876 return; 877 Object.entries(el._x_attributeCleanups).forEach(([name, value]) => { 878 if (names === void 0 || names.includes(name)) { 879 value.forEach((i) => i()); 880 delete el._x_attributeCleanups[name]; 881 } 882 }); 883 } 884 function cleanupElement(el) { 885 el._x_effects?.forEach(dequeueJob); 886 while (el._x_cleanups?.length) 887 el._x_cleanups.pop()(); 888 } 889 var observer = new MutationObserver(onMutate); 890 var currentlyObserving = false; 891 function startObservingMutations() { 892 observer.observe(document, { subtree: true, childList: true, attributes: true, attributeOldValue: true }); 893 currentlyObserving = true; 894 } 895 function stopObservingMutations() { 896 flushObserver(); 897 observer.disconnect(); 898 currentlyObserving = false; 899 } 900 var queuedMutations = []; 901 function flushObserver() { 902 let records = observer.takeRecords(); 903 queuedMutations.push(() => records.length > 0 && onMutate(records)); 904 let queueLengthWhenTriggered = queuedMutations.length; 905 queueMicrotask(() => { 906 if (queuedMutations.length === queueLengthWhenTriggered) { 907 while (queuedMutations.length > 0) 908 queuedMutations.shift()(); 909 } 910 }); 911 } 912 function mutateDom(callback) { 913 if (!currentlyObserving) 914 return callback(); 915 stopObservingMutations(); 916 let result = callback(); 917 startObservingMutations(); 918 return result; 919 } 920 var isCollecting = false; 921 var deferredMutations = []; 922 function deferMutations() { 923 isCollecting = true; 924 } 925 function flushAndStopDeferringMutations() { 926 isCollecting = false; 927 onMutate(deferredMutations); 928 deferredMutations = []; 929 } 930 function onMutate(mutations) { 931 if (isCollecting) { 932 deferredMutations = deferredMutations.concat(mutations); 933 return; 934 } 935 let addedNodes = []; 936 let removedNodes = /* @__PURE__ */ new Set(); 937 let addedAttributes = /* @__PURE__ */ new Map(); 938 let removedAttributes = /* @__PURE__ */ new Map(); 939 for (let i = 0; i < mutations.length; i++) { 940 if (mutations[i].target._x_ignoreMutationObserver) 941 continue; 942 if (mutations[i].type === "childList") { 943 mutations[i].removedNodes.forEach((node) => { 944 if (node.nodeType !== 1) 945 return; 946 if (!node._x_marker) 947 return; 948 removedNodes.add(node); 949 }); 950 mutations[i].addedNodes.forEach((node) => { 951 if (node.nodeType !== 1) 952 return; 953 if (removedNodes.has(node)) { 954 removedNodes.delete(node); 955 return; 956 } 957 if (node._x_marker) 958 return; 959 addedNodes.push(node); 960 }); 961 } 962 if (mutations[i].type === "attributes") { 963 let el = mutations[i].target; 964 let name = mutations[i].attributeName; 965 let oldValue = mutations[i].oldValue; 966 let add2 = () => { 967 if (!addedAttributes.has(el)) 968 addedAttributes.set(el, []); 969 addedAttributes.get(el).push({ name, value: el.getAttribute(name) }); 970 }; 971 let remove = () => { 972 if (!removedAttributes.has(el)) 973 removedAttributes.set(el, []); 974 removedAttributes.get(el).push(name); 975 }; 976 if (el.hasAttribute(name) && oldValue === null) { 977 add2(); 978 } else if (el.hasAttribute(name)) { 979 remove(); 980 add2(); 981 } else { 982 remove(); 983 } 984 } 985 } 986 removedAttributes.forEach((attrs, el) => { 987 cleanupAttributes(el, attrs); 988 }); 989 addedAttributes.forEach((attrs, el) => { 990 onAttributeAddeds.forEach((i) => i(el, attrs)); 991 }); 992 for (let node of removedNodes) { 993 if (addedNodes.some((i) => i.contains(node))) 994 continue; 995 onElRemoveds.forEach((i) => i(node)); 996 } 997 for (let node of addedNodes) { 998 if (!node.isConnected) 999 continue; 1000 onElAddeds.forEach((i) => i(node)); 1001 } 1002 addedNodes = null; 1003 removedNodes = null; 1004 addedAttributes = null; 1005 removedAttributes = null; 1006 } 1007 function scope(node) { 1008 return mergeProxies(closestDataStack(node)); 1009 } 1010 function addScopeToNode(node, data2, referenceNode) { 1011 node._x_dataStack = [data2, ...closestDataStack(referenceNode || node)]; 1012 return () => { 1013 node._x_dataStack = node._x_dataStack.filter((i) => i !== data2); 1014 }; 1015 } 1016 function closestDataStack(node) { 1017 if (node._x_dataStack) 1018 return node._x_dataStack; 1019 if (typeof ShadowRoot === "function" && node instanceof ShadowRoot) { 1020 return closestDataStack(node.host); 1021 } 1022 if (!node.parentNode) { 1023 return []; 1024 } 1025 return closestDataStack(node.parentNode); 1026 } 1027 function mergeProxies(objects) { 1028 return new Proxy({ objects }, mergeProxyTrap); 1029 } 1030 function keyInPrototypeChain(obj, key) { 1031 if (obj === null || obj === Object.prototype) 1032 return null; 1033 if (Object.prototype.hasOwnProperty.call(obj, key)) 1034 return obj; 1035 return keyInPrototypeChain(Object.getPrototypeOf(obj), key); 1036 } 1037 var mergeProxyTrap = { 1038 ownKeys({ objects }) { 1039 return Array.from(new Set(objects.flatMap((i) => Object.keys(i)))); 1040 }, 1041 has({ objects }, name) { 1042 if (name == Symbol.unscopables) 1043 return false; 1044 return objects.some((obj) => Object.prototype.hasOwnProperty.call(obj, name) || Reflect.has(obj, name)); 1045 }, 1046 get({ objects }, name, thisProxy) { 1047 if (name == "toJSON") 1048 return collapseProxies; 1049 return Reflect.get(objects.find((obj) => Reflect.has(obj, name)) || {}, name, thisProxy); 1050 }, 1051 set({ objects }, name, value, thisProxy) { 1052 let target; 1053 for (const obj of objects) { 1054 target = keyInPrototypeChain(obj, name); 1055 if (target) 1056 break; 1057 } 1058 if (!target) 1059 target = objects[objects.length - 1]; 1060 const descriptor = Object.getOwnPropertyDescriptor(target, name); 1061 if (descriptor?.set && descriptor?.get) 1062 return descriptor.set.call(thisProxy, value) || true; 1063 return Reflect.set(target, name, value); 1064 } 1065 }; 1066 function collapseProxies() { 1067 let keys = Reflect.ownKeys(this); 1068 return keys.reduce((acc, key) => { 1069 acc[key] = Reflect.get(this, key); 1070 return acc; 1071 }, {}); 1072 } 1073 function initInterceptors(data2) { 1074 let isObject3 = (val) => typeof val === "object" && !Array.isArray(val) && val !== null; 1075 let recurse = (obj, basePath = "") => { 1076 Object.entries(Object.getOwnPropertyDescriptors(obj)).forEach(([key, { value, enumerable }]) => { 1077 if (enumerable === false || value === void 0) 1078 return; 1079 if (typeof value === "object" && value !== null && value.__v_skip) 1080 return; 1081 let path = basePath === "" ? key : `${basePath}.${key}`; 1082 if (typeof value === "object" && value !== null && value._x_interceptor) { 1083 obj[key] = value.initialize(data2, path, key); 1084 } else { 1085 if (isObject3(value) && value !== obj && !(value instanceof Element)) { 1086 recurse(value, path); 1087 } 1088 } 1089 }); 1090 }; 1091 return recurse(data2); 1092 } 1093 function interceptor(callback, mutateObj = () => { 1094 }) { 1095 let obj = { 1096 initialValue: void 0, 1097 _x_interceptor: true, 1098 initialize(data2, path, key) { 1099 return callback(this.initialValue, () => get(data2, path), (value) => set(data2, path, value), path, key); 1100 } 1101 }; 1102 mutateObj(obj); 1103 return (initialValue) => { 1104 if (typeof initialValue === "object" && initialValue !== null && initialValue._x_interceptor) { 1105 let initialize = obj.initialize.bind(obj); 1106 obj.initialize = (data2, path, key) => { 1107 let innerValue = initialValue.initialize(data2, path, key); 1108 obj.initialValue = innerValue; 1109 return initialize(data2, path, key); 1110 }; 1111 } else { 1112 obj.initialValue = initialValue; 1113 } 1114 return obj; 1115 }; 1116 } 1117 function get(obj, path) { 1118 return path.split(".").reduce((carry, segment) => carry[segment], obj); 1119 } 1120 function set(obj, path, value) { 1121 if (typeof path === "string") 1122 path = path.split("."); 1123 if (path.length === 1) 1124 obj[path[0]] = value; 1125 else if (path.length === 0) 1126 throw error; 1127 else { 1128 if (obj[path[0]]) 1129 return set(obj[path[0]], path.slice(1), value); 1130 else { 1131 obj[path[0]] = {}; 1132 return set(obj[path[0]], path.slice(1), value); 1133 } 1134 } 1135 } 1136 var magics = {}; 1137 function magic(name, callback) { 1138 magics[name] = callback; 1139 } 1140 function injectMagics(obj, el) { 1141 let memoizedUtilities = getUtilities(el); 1142 Object.entries(magics).forEach(([name, callback]) => { 1143 Object.defineProperty(obj, `$${name}`, { 1144 get() { 1145 return callback(el, memoizedUtilities); 1146 }, 1147 enumerable: false 1148 }); 1149 }); 1150 return obj; 1151 } 1152 function getUtilities(el) { 1153 let [utilities, cleanup2] = getElementBoundUtilities(el); 1154 let utils = { interceptor, ...utilities }; 1155 onElRemoved(el, cleanup2); 1156 return utils; 1157 } 1158 function tryCatch(el, expression, callback, ...args) { 1159 try { 1160 return callback(...args); 1161 } catch (e) { 1162 handleError(e, el, expression); 1163 } 1164 } 1165 function handleError(...args) { 1166 return errorHandler(...args); 1167 } 1168 var errorHandler = normalErrorHandler; 1169 function setErrorHandler(handler4) { 1170 errorHandler = handler4; 1171 } 1172 function normalErrorHandler(error2, el, expression = void 0) { 1173 error2 = Object.assign(error2 ?? { message: "No error message given." }, { el, expression }); 1174 console.warn(`Alpine Expression Error: ${error2.message} 1175 1176${expression ? 'Expression: "' + expression + '"\n\n' : ""}`, el); 1177 setTimeout(() => { 1178 throw error2; 1179 }, 0); 1180 } 1181 var shouldAutoEvaluateFunctions = true; 1182 function dontAutoEvaluateFunctions(callback) { 1183 let cache = shouldAutoEvaluateFunctions; 1184 shouldAutoEvaluateFunctions = false; 1185 let result = callback(); 1186 shouldAutoEvaluateFunctions = cache; 1187 return result; 1188 } 1189 function evaluate(el, expression, extras = {}) { 1190 let result; 1191 evaluateLater(el, expression)((value) => result = value, extras); 1192 return result; 1193 } 1194 function evaluateLater(...args) { 1195 return theEvaluatorFunction(...args); 1196 } 1197 var theEvaluatorFunction = () => { 1198 }; 1199 function setEvaluator(newEvaluator) { 1200 theEvaluatorFunction = newEvaluator; 1201 } 1202 var theRawEvaluatorFunction; 1203 function setRawEvaluator(newEvaluator) { 1204 theRawEvaluatorFunction = newEvaluator; 1205 } 1206 function normalEvaluator(el, expression) { 1207 let overriddenMagics = {}; 1208 injectMagics(overriddenMagics, el); 1209 let dataStack = [overriddenMagics, ...closestDataStack(el)]; 1210 let evaluator = typeof expression === "function" ? generateEvaluatorFromFunction(dataStack, expression) : generateEvaluatorFromString(dataStack, expression, el); 1211 return tryCatch.bind(null, el, expression, evaluator); 1212 } 1213 function generateEvaluatorFromFunction(dataStack, func) { 1214 return (receiver = () => { 1215 }, { scope: scope2 = {}, params = [], context } = {}) => { 1216 if (!shouldAutoEvaluateFunctions) { 1217 runIfTypeOfFunction(receiver, func, mergeProxies([scope2, ...dataStack]), params); 1218 return; 1219 } 1220 let result = func.apply(mergeProxies([scope2, ...dataStack]), params); 1221 runIfTypeOfFunction(receiver, result); 1222 }; 1223 } 1224 var evaluatorMemo = {}; 1225 function generateFunctionFromString(expression, el) { 1226 if (evaluatorMemo[expression]) { 1227 return evaluatorMemo[expression]; 1228 } 1229 let AsyncFunction = Object.getPrototypeOf(async function() { 1230 }).constructor; 1231 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; 1232 const safeAsyncFunction = () => { 1233 try { 1234 let func2 = new AsyncFunction(["__self", "scope"], `with (scope) { __self.result = ${rightSideSafeExpression} }; __self.finished = true; return __self.result;`); 1235 Object.defineProperty(func2, "name", { 1236 value: `[Alpine] ${expression}` 1237 }); 1238 return func2; 1239 } catch (error2) { 1240 handleError(error2, el, expression); 1241 return Promise.resolve(); 1242 } 1243 }; 1244 let func = safeAsyncFunction(); 1245 evaluatorMemo[expression] = func; 1246 return func; 1247 } 1248 function generateEvaluatorFromString(dataStack, expression, el) { 1249 let func = generateFunctionFromString(expression, el); 1250 return (receiver = () => { 1251 }, { scope: scope2 = {}, params = [], context } = {}) => { 1252 func.result = void 0; 1253 func.finished = false; 1254 let completeScope = mergeProxies([scope2, ...dataStack]); 1255 if (typeof func === "function") { 1256 let promise = func.call(context, func, completeScope).catch((error2) => handleError(error2, el, expression)); 1257 if (func.finished) { 1258 runIfTypeOfFunction(receiver, func.result, completeScope, params, el); 1259 func.result = void 0; 1260 } else { 1261 promise.then((result) => { 1262 runIfTypeOfFunction(receiver, result, completeScope, params, el); 1263 }).catch((error2) => handleError(error2, el, expression)).finally(() => func.result = void 0); 1264 } 1265 } 1266 }; 1267 } 1268 function runIfTypeOfFunction(receiver, value, scope2, params, el) { 1269 if (shouldAutoEvaluateFunctions && typeof value === "function") { 1270 let result = value.apply(scope2, params); 1271 if (result instanceof Promise) { 1272 result.then((i) => runIfTypeOfFunction(receiver, i, scope2, params)).catch((error2) => handleError(error2, el, value)); 1273 } else { 1274 receiver(result); 1275 } 1276 } else if (typeof value === "object" && value instanceof Promise) { 1277 value.then((i) => receiver(i)); 1278 } else { 1279 receiver(value); 1280 } 1281 } 1282 function evaluateRaw(...args) { 1283 return theRawEvaluatorFunction(...args); 1284 } 1285 function normalRawEvaluator(el, expression, extras = {}) { 1286 let overriddenMagics = {}; 1287 injectMagics(overriddenMagics, el); 1288 let dataStack = [overriddenMagics, ...closestDataStack(el)]; 1289 let scope2 = mergeProxies([extras.scope ?? {}, ...dataStack]); 1290 let params = extras.params ?? []; 1291 if (expression.includes("await")) { 1292 let AsyncFunction = Object.getPrototypeOf(async function() { 1293 }).constructor; 1294 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(async()=>{ ${expression} })()` : expression; 1295 let func = new AsyncFunction(["scope"], `with (scope) { let __result = ${rightSideSafeExpression}; return __result }`); 1296 let result = func.call(extras.context, scope2); 1297 return result; 1298 } else { 1299 let rightSideSafeExpression = /^[\n\s]*if.*\(.*\)/.test(expression.trim()) || /^(let|const)\s/.test(expression.trim()) ? `(()=>{ ${expression} })()` : expression; 1300 let func = new Function(["scope"], `with (scope) { let __result = ${rightSideSafeExpression}; return __result }`); 1301 let result = func.call(extras.context, scope2); 1302 if (typeof result === "function" && shouldAutoEvaluateFunctions) { 1303 return result.apply(scope2, params); 1304 } 1305 return result; 1306 } 1307 } 1308 var prefixAsString = "x-"; 1309 function prefix(subject = "") { 1310 return prefixAsString + subject; 1311 } 1312 function setPrefix(newPrefix) { 1313 prefixAsString = newPrefix; 1314 } 1315 var directiveHandlers = {}; 1316 function directive(name, callback) { 1317 directiveHandlers[name] = callback; 1318 return { 1319 before(directive22) { 1320 if (!directiveHandlers[directive22]) { 1321 console.warn(String.raw`Cannot find directive \`${directive22}\`. \`${name}\` will use the default order of execution`); 1322 return; 1323 } 1324 const pos = directiveOrder.indexOf(directive22); 1325 directiveOrder.splice(pos >= 0 ? pos : directiveOrder.indexOf("DEFAULT"), 0, name); 1326 } 1327 }; 1328 } 1329 function directiveExists(name) { 1330 return Object.keys(directiveHandlers).includes(name); 1331 } 1332 function directives(el, attributes, originalAttributeOverride) { 1333 attributes = Array.from(attributes); 1334 if (el._x_virtualDirectives) { 1335 let vAttributes = Object.entries(el._x_virtualDirectives).map(([name, value]) => ({ name, value })); 1336 let staticAttributes = attributesOnly(vAttributes); 1337 vAttributes = vAttributes.map((attribute) => { 1338 if (staticAttributes.find((attr) => attr.name === attribute.name)) { 1339 return { 1340 name: `x-bind:${attribute.name}`, 1341 value: `"${attribute.value}"` 1342 }; 1343 } 1344 return attribute; 1345 }); 1346 attributes = attributes.concat(vAttributes); 1347 } 1348 let transformedAttributeMap = {}; 1349 let directives2 = attributes.map(toTransformedAttributes((newName, oldName) => transformedAttributeMap[newName] = oldName)).filter(outNonAlpineAttributes).map(toParsedDirectives(transformedAttributeMap, originalAttributeOverride)).sort(byPriority); 1350 return directives2.map((directive22) => { 1351 return getDirectiveHandler(el, directive22); 1352 }); 1353 } 1354 function attributesOnly(attributes) { 1355 return Array.from(attributes).map(toTransformedAttributes()).filter((attr) => !outNonAlpineAttributes(attr)); 1356 } 1357 var isDeferringHandlers = false; 1358 var directiveHandlerStacks = /* @__PURE__ */ new Map(); 1359 var currentHandlerStackKey = Symbol(); 1360 function deferHandlingDirectives(callback) { 1361 isDeferringHandlers = true; 1362 let key = Symbol(); 1363 currentHandlerStackKey = key; 1364 directiveHandlerStacks.set(key, []); 1365 let flushHandlers = () => { 1366 while (directiveHandlerStacks.get(key).length) 1367 directiveHandlerStacks.get(key).shift()(); 1368 directiveHandlerStacks.delete(key); 1369 }; 1370 let stopDeferring = () => { 1371 isDeferringHandlers = false; 1372 flushHandlers(); 1373 }; 1374 callback(flushHandlers); 1375 stopDeferring(); 1376 } 1377 function getElementBoundUtilities(el) { 1378 let cleanups2 = []; 1379 let cleanup2 = (callback) => cleanups2.push(callback); 1380 let [effect3, cleanupEffect] = elementBoundEffect(el); 1381 cleanups2.push(cleanupEffect); 1382 let utilities = { 1383 Alpine: alpine_default, 1384 effect: effect3, 1385 cleanup: cleanup2, 1386 evaluateLater: evaluateLater.bind(evaluateLater, el), 1387 evaluate: evaluate.bind(evaluate, el) 1388 }; 1389 let doCleanup = () => cleanups2.forEach((i) => i()); 1390 return [utilities, doCleanup]; 1391 } 1392 function getDirectiveHandler(el, directive22) { 1393 let noop = () => { 1394 }; 1395 let handler4 = directiveHandlers[directive22.type] || noop; 1396 let [utilities, cleanup2] = getElementBoundUtilities(el); 1397 onAttributeRemoved(el, directive22.original, cleanup2); 1398 let fullHandler = () => { 1399 if (el._x_ignore || el._x_ignoreSelf) 1400 return; 1401 handler4.inline && handler4.inline(el, directive22, utilities); 1402 handler4 = handler4.bind(handler4, el, directive22, utilities); 1403 isDeferringHandlers ? directiveHandlerStacks.get(currentHandlerStackKey).push(handler4) : handler4(); 1404 }; 1405 fullHandler.runCleanups = cleanup2; 1406 return fullHandler; 1407 } 1408 var startingWith = (subject, replacement) => ({ name, value }) => { 1409 if (name.startsWith(subject)) 1410 name = name.replace(subject, replacement); 1411 return { name, value }; 1412 }; 1413 var into = (i) => i; 1414 function toTransformedAttributes(callback = () => { 1415 }) { 1416 return ({ name, value }) => { 1417 let { name: newName, value: newValue } = attributeTransformers.reduce((carry, transform) => { 1418 return transform(carry); 1419 }, { name, value }); 1420 if (newName !== name) 1421 callback(newName, name); 1422 return { name: newName, value: newValue }; 1423 }; 1424 } 1425 var attributeTransformers = []; 1426 function mapAttributes(callback) { 1427 attributeTransformers.push(callback); 1428 } 1429 function outNonAlpineAttributes({ name }) { 1430 return alpineAttributeRegex().test(name); 1431 } 1432 var alpineAttributeRegex = () => new RegExp(`^${prefixAsString}([^:^.]+)\\b`); 1433 function toParsedDirectives(transformedAttributeMap, originalAttributeOverride) { 1434 return ({ name, value }) => { 1435 if (name === value) 1436 value = ""; 1437 let typeMatch = name.match(alpineAttributeRegex()); 1438 let valueMatch = name.match(/:([a-zA-Z0-9\-_:]+)/); 1439 let modifiers = name.match(/\.[^.\]]+(?=[^\]]*$)/g) || []; 1440 let original = originalAttributeOverride || transformedAttributeMap[name] || name; 1441 return { 1442 type: typeMatch ? typeMatch[1] : null, 1443 value: valueMatch ? valueMatch[1] : null, 1444 modifiers: modifiers.map((i) => i.replace(".", "")), 1445 expression: value, 1446 original 1447 }; 1448 }; 1449 } 1450 var DEFAULT = "DEFAULT"; 1451 var directiveOrder = [ 1452 "ignore", 1453 "ref", 1454 "data", 1455 "id", 1456 "anchor", 1457 "bind", 1458 "init", 1459 "for", 1460 "model", 1461 "modelable", 1462 "transition", 1463 "show", 1464 "if", 1465 DEFAULT, 1466 "teleport" 1467 ]; 1468 function byPriority(a, b) { 1469 let typeA = directiveOrder.indexOf(a.type) === -1 ? DEFAULT : a.type; 1470 let typeB = directiveOrder.indexOf(b.type) === -1 ? DEFAULT : b.type; 1471 return directiveOrder.indexOf(typeA) - directiveOrder.indexOf(typeB); 1472 } 1473 function dispatch2(el, name, detail = {}, options = {}) { 1474 return el.dispatchEvent(new CustomEvent(name, { 1475 detail, 1476 bubbles: true, 1477 composed: true, 1478 cancelable: true, 1479 ...options 1480 })); 1481 } 1482 function walk(el, callback) { 1483 if (typeof ShadowRoot === "function" && el instanceof ShadowRoot) { 1484 Array.from(el.children).forEach((el2) => walk(el2, callback)); 1485 return; 1486 } 1487 let skip = false; 1488 callback(el, () => skip = true); 1489 if (skip) 1490 return; 1491 let node = el.firstElementChild; 1492 while (node) { 1493 walk(node, callback, false); 1494 node = node.nextElementSibling; 1495 } 1496 } 1497 function warn(message, ...args) { 1498 console.warn(`Alpine Warning: ${message}`, ...args); 1499 } 1500 var started = false; 1501 function start() { 1502 if (started) 1503 warn("Alpine has already been initialized on this page. Calling Alpine.start() more than once can cause problems."); 1504 started = true; 1505 if (!document.body) 1506 warn("Unable to initialize. Trying to load Alpine before `<body>` is available. Did you forget to add `defer` in Alpine's `<script>` tag?"); 1507 dispatch2(document, "alpine:init"); 1508 dispatch2(document, "alpine:initializing"); 1509 startObservingMutations(); 1510 onElAdded((el) => initTree(el, walk)); 1511 onElRemoved((el) => destroyTree(el)); 1512 onAttributesAdded((el, attrs) => { 1513 directives(el, attrs).forEach((handle) => handle()); 1514 }); 1515 let outNestedComponents = (el) => !closestRoot(el.parentElement, true); 1516 Array.from(document.querySelectorAll(allSelectors().join(","))).filter(outNestedComponents).forEach((el) => { 1517 initTree(el); 1518 }); 1519 dispatch2(document, "alpine:initialized"); 1520 setTimeout(() => { 1521 warnAboutMissingPlugins(); 1522 }); 1523 } 1524 var rootSelectorCallbacks = []; 1525 var initSelectorCallbacks = []; 1526 function rootSelectors() { 1527 return rootSelectorCallbacks.map((fn) => fn()); 1528 } 1529 function allSelectors() { 1530 return rootSelectorCallbacks.concat(initSelectorCallbacks).map((fn) => fn()); 1531 } 1532 function addRootSelector(selectorCallback) { 1533 rootSelectorCallbacks.push(selectorCallback); 1534 } 1535 function addInitSelector(selectorCallback) { 1536 initSelectorCallbacks.push(selectorCallback); 1537 } 1538 function closestRoot(el, includeInitSelectors = false) { 1539 return findClosest(el, (element) => { 1540 const selectors = includeInitSelectors ? allSelectors() : rootSelectors(); 1541 if (selectors.some((selector) => element.matches(selector))) 1542 return true; 1543 }); 1544 } 1545 function findClosest(el, callback) { 1546 if (!el) 1547 return; 1548 if (callback(el)) 1549 return el; 1550 if (el._x_teleportBack) 1551 return findClosest(el._x_teleportBack, callback); 1552 if (el.parentNode instanceof ShadowRoot) { 1553 return findClosest(el.parentNode.host, callback); 1554 } 1555 if (!el.parentElement) 1556 return; 1557 return findClosest(el.parentElement, callback); 1558 } 1559 function isRoot(el) { 1560 return rootSelectors().some((selector) => el.matches(selector)); 1561 } 1562 var initInterceptors2 = []; 1563 function interceptInit(callback) { 1564 initInterceptors2.push(callback); 1565 } 1566 var markerDispenser = 1; 1567 function initTree(el, walker = walk, intercept = () => { 1568 }) { 1569 if (findClosest(el, (i) => i._x_ignore)) 1570 return; 1571 deferHandlingDirectives(() => { 1572 walker(el, (el2, skip) => { 1573 if (el2._x_marker) 1574 return; 1575 intercept(el2, skip); 1576 initInterceptors2.forEach((i) => i(el2, skip)); 1577 directives(el2, el2.attributes).forEach((handle) => handle()); 1578 if (!el2._x_ignore) 1579 el2._x_marker = markerDispenser++; 1580 el2._x_ignore && skip(); 1581 }); 1582 }); 1583 } 1584 function destroyTree(root, walker = walk) { 1585 walker(root, (el) => { 1586 cleanupElement(el); 1587 cleanupAttributes(el); 1588 delete el._x_marker; 1589 }); 1590 } 1591 function warnAboutMissingPlugins() { 1592 let pluginDirectives = [ 1593 ["ui", "dialog", ["[x-dialog], [x-popover]"]], 1594 ["anchor", "anchor", ["[x-anchor]"]], 1595 ["sort", "sort", ["[x-sort]"]] 1596 ]; 1597 pluginDirectives.forEach(([plugin2, directive22, selectors]) => { 1598 if (directiveExists(directive22)) 1599 return; 1600 selectors.some((selector) => { 1601 if (document.querySelector(selector)) { 1602 warn(`found "${selector}", but missing ${plugin2} plugin`); 1603 return true; 1604 } 1605 }); 1606 }); 1607 } 1608 var tickStack = []; 1609 var isHolding = false; 1610 function nextTick(callback = () => { 1611 }) { 1612 queueMicrotask(() => { 1613 isHolding || setTimeout(() => { 1614 releaseNextTicks(); 1615 }); 1616 }); 1617 return new Promise((res) => { 1618 tickStack.push(() => { 1619 callback(); 1620 res(); 1621 }); 1622 }); 1623 } 1624 function releaseNextTicks() { 1625 isHolding = false; 1626 while (tickStack.length) 1627 tickStack.shift()(); 1628 } 1629 function holdNextTicks() { 1630 isHolding = true; 1631 } 1632 function setClasses(el, value) { 1633 if (Array.isArray(value)) { 1634 return setClassesFromString(el, value.join(" ")); 1635 } else if (typeof value === "object" && value !== null) { 1636 return setClassesFromObject(el, value); 1637 } else if (typeof value === "function") { 1638 return setClasses(el, value()); 1639 } 1640 return setClassesFromString(el, value); 1641 } 1642 function splitClasses(classString) { 1643 return classString.split(/\s/).filter(Boolean); 1644 } 1645 function setClassesFromString(el, classString) { 1646 let missingClasses = (classString2) => splitClasses(classString2).filter((i) => !el.classList.contains(i)).filter(Boolean); 1647 let addClassesAndReturnUndo = (classes) => { 1648 el.classList.add(...classes); 1649 return () => { 1650 el.classList.remove(...classes); 1651 }; 1652 }; 1653 classString = classString === true ? classString = "" : classString || ""; 1654 return addClassesAndReturnUndo(missingClasses(classString)); 1655 } 1656 function setClassesFromObject(el, classObject) { 1657 let forAdd = Object.entries(classObject).flatMap(([classString, bool]) => bool ? splitClasses(classString) : false).filter(Boolean); 1658 let forRemove = Object.entries(classObject).flatMap(([classString, bool]) => !bool ? splitClasses(classString) : false).filter(Boolean); 1659 let added = []; 1660 let removed = []; 1661 forRemove.forEach((i) => { 1662 if (el.classList.contains(i)) { 1663 el.classList.remove(i); 1664 removed.push(i); 1665 } 1666 }); 1667 forAdd.forEach((i) => { 1668 if (!el.classList.contains(i)) { 1669 el.classList.add(i); 1670 added.push(i); 1671 } 1672 }); 1673 return () => { 1674 removed.forEach((i) => el.classList.add(i)); 1675 added.forEach((i) => el.classList.remove(i)); 1676 }; 1677 } 1678 function setStyles(el, value) { 1679 if (typeof value === "object" && value !== null) { 1680 return setStylesFromObject(el, value); 1681 } 1682 return setStylesFromString(el, value); 1683 } 1684 function setStylesFromObject(el, value) { 1685 let previousStyles = {}; 1686 Object.entries(value).forEach(([key, value2]) => { 1687 previousStyles[key] = el.style[key]; 1688 if (!key.startsWith("--")) { 1689 key = kebabCase(key); 1690 } 1691 el.style.setProperty(key, value2); 1692 }); 1693 setTimeout(() => { 1694 if (el.style.length === 0) { 1695 el.removeAttribute("style"); 1696 } 1697 }); 1698 return () => { 1699 setStyles(el, previousStyles); 1700 }; 1701 } 1702 function setStylesFromString(el, value) { 1703 let cache = el.getAttribute("style", value); 1704 el.setAttribute("style", value); 1705 return () => { 1706 el.setAttribute("style", cache || ""); 1707 }; 1708 } 1709 function kebabCase(subject) { 1710 return subject.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(); 1711 } 1712 function once(callback, fallback2 = () => { 1713 }) { 1714 let called = false; 1715 return function() { 1716 if (!called) { 1717 called = true; 1718 callback.apply(this, arguments); 1719 } else { 1720 fallback2.apply(this, arguments); 1721 } 1722 }; 1723 } 1724 directive("transition", (el, { value, modifiers, expression }, { evaluate: evaluate22 }) => { 1725 if (typeof expression === "function") 1726 expression = evaluate22(expression); 1727 if (expression === false) 1728 return; 1729 if (!expression || typeof expression === "boolean") { 1730 registerTransitionsFromHelper(el, modifiers, value); 1731 } else { 1732 registerTransitionsFromClassString(el, expression, value); 1733 } 1734 }); 1735 function registerTransitionsFromClassString(el, classString, stage) { 1736 registerTransitionObject(el, setClasses, ""); 1737 let directiveStorageMap = { 1738 "enter": (classes) => { 1739 el._x_transition.enter.during = classes; 1740 }, 1741 "enter-start": (classes) => { 1742 el._x_transition.enter.start = classes; 1743 }, 1744 "enter-end": (classes) => { 1745 el._x_transition.enter.end = classes; 1746 }, 1747 "leave": (classes) => { 1748 el._x_transition.leave.during = classes; 1749 }, 1750 "leave-start": (classes) => { 1751 el._x_transition.leave.start = classes; 1752 }, 1753 "leave-end": (classes) => { 1754 el._x_transition.leave.end = classes; 1755 } 1756 }; 1757 directiveStorageMap[stage](classString); 1758 } 1759 function registerTransitionsFromHelper(el, modifiers, stage) { 1760 registerTransitionObject(el, setStyles); 1761 let doesntSpecify = !modifiers.includes("in") && !modifiers.includes("out") && !stage; 1762 let transitioningIn = doesntSpecify || modifiers.includes("in") || ["enter"].includes(stage); 1763 let transitioningOut = doesntSpecify || modifiers.includes("out") || ["leave"].includes(stage); 1764 if (modifiers.includes("in") && !doesntSpecify) { 1765 modifiers = modifiers.filter((i, index) => index < modifiers.indexOf("out")); 1766 } 1767 if (modifiers.includes("out") && !doesntSpecify) { 1768 modifiers = modifiers.filter((i, index) => index > modifiers.indexOf("out")); 1769 } 1770 let wantsAll = !modifiers.includes("opacity") && !modifiers.includes("scale"); 1771 let wantsOpacity = wantsAll || modifiers.includes("opacity"); 1772 let wantsScale = wantsAll || modifiers.includes("scale"); 1773 let opacityValue = wantsOpacity ? 0 : 1; 1774 let scaleValue = wantsScale ? modifierValue(modifiers, "scale", 95) / 100 : 1; 1775 let delay3 = modifierValue(modifiers, "delay", 0) / 1e3; 1776 let origin = modifierValue(modifiers, "origin", "center"); 1777 let property = "opacity, transform"; 1778 let durationIn = modifierValue(modifiers, "duration", 150) / 1e3; 1779 let durationOut = modifierValue(modifiers, "duration", 75) / 1e3; 1780 let easing = `cubic-bezier(0.4, 0.0, 0.2, 1)`; 1781 if (transitioningIn) { 1782 el._x_transition.enter.during = { 1783 transformOrigin: origin, 1784 transitionDelay: `${delay3}s`, 1785 transitionProperty: property, 1786 transitionDuration: `${durationIn}s`, 1787 transitionTimingFunction: easing 1788 }; 1789 el._x_transition.enter.start = { 1790 opacity: opacityValue, 1791 transform: `scale(${scaleValue})` 1792 }; 1793 el._x_transition.enter.end = { 1794 opacity: 1, 1795 transform: `scale(1)` 1796 }; 1797 } 1798 if (transitioningOut) { 1799 el._x_transition.leave.during = { 1800 transformOrigin: origin, 1801 transitionDelay: `${delay3}s`, 1802 transitionProperty: property, 1803 transitionDuration: `${durationOut}s`, 1804 transitionTimingFunction: easing 1805 }; 1806 el._x_transition.leave.start = { 1807 opacity: 1, 1808 transform: `scale(1)` 1809 }; 1810 el._x_transition.leave.end = { 1811 opacity: opacityValue, 1812 transform: `scale(${scaleValue})` 1813 }; 1814 } 1815 } 1816 function registerTransitionObject(el, setFunction, defaultValue = {}) { 1817 if (!el._x_transition) 1818 el._x_transition = { 1819 enter: { during: defaultValue, start: defaultValue, end: defaultValue }, 1820 leave: { during: defaultValue, start: defaultValue, end: defaultValue }, 1821 in(before = () => { 1822 }, after = () => { 1823 }) { 1824 transition(el, setFunction, { 1825 during: this.enter.during, 1826 start: this.enter.start, 1827 end: this.enter.end 1828 }, before, after); 1829 }, 1830 out(before = () => { 1831 }, after = () => { 1832 }) { 1833 transition(el, setFunction, { 1834 during: this.leave.during, 1835 start: this.leave.start, 1836 end: this.leave.end 1837 }, before, after); 1838 } 1839 }; 1840 } 1841 window.Element.prototype._x_toggleAndCascadeWithTransitions = function(el, value, show, hide) { 1842 const nextTick2 = document.visibilityState === "visible" ? requestAnimationFrame : setTimeout; 1843 let clickAwayCompatibleShow = () => nextTick2(show); 1844 if (value) { 1845 if (el._x_transition && (el._x_transition.enter || el._x_transition.leave)) { 1846 el._x_transition.enter && (Object.entries(el._x_transition.enter.during).length || Object.entries(el._x_transition.enter.start).length || Object.entries(el._x_transition.enter.end).length) ? el._x_transition.in(show) : clickAwayCompatibleShow(); 1847 } else { 1848 el._x_transition ? el._x_transition.in(show) : clickAwayCompatibleShow(); 1849 } 1850 return; 1851 } 1852 el._x_hidePromise = el._x_transition ? new Promise((resolve, reject) => { 1853 el._x_transition.out(() => { 1854 }, () => resolve(hide)); 1855 el._x_transitioning && el._x_transitioning.beforeCancel(() => reject({ isFromCancelledTransition: true })); 1856 }) : Promise.resolve(hide); 1857 queueMicrotask(() => { 1858 let closest = closestHide(el); 1859 if (closest) { 1860 if (!closest._x_hideChildren) 1861 closest._x_hideChildren = []; 1862 closest._x_hideChildren.push(el); 1863 } else { 1864 nextTick2(() => { 1865 let hideAfterChildren = (el2) => { 1866 let carry = Promise.all([ 1867 el2._x_hidePromise, 1868 ...(el2._x_hideChildren || []).map(hideAfterChildren) 1869 ]).then(([i]) => i?.()); 1870 delete el2._x_hidePromise; 1871 delete el2._x_hideChildren; 1872 return carry; 1873 }; 1874 hideAfterChildren(el).catch((e) => { 1875 if (!e.isFromCancelledTransition) 1876 throw e; 1877 }); 1878 }); 1879 } 1880 }); 1881 }; 1882 function closestHide(el) { 1883 let parent = el.parentNode; 1884 if (!parent) 1885 return; 1886 return parent._x_hidePromise ? parent : closestHide(parent); 1887 } 1888 function transition(el, setFunction, { during, start: start22, end } = {}, before = () => { 1889 }, after = () => { 1890 }) { 1891 if (el._x_transitioning) 1892 el._x_transitioning.cancel(); 1893 if (Object.keys(during).length === 0 && Object.keys(start22).length === 0 && Object.keys(end).length === 0) { 1894 before(); 1895 after(); 1896 return; 1897 } 1898 let undoStart, undoDuring, undoEnd; 1899 performTransition(el, { 1900 start() { 1901 undoStart = setFunction(el, start22); 1902 }, 1903 during() { 1904 undoDuring = setFunction(el, during); 1905 }, 1906 before, 1907 end() { 1908 undoStart(); 1909 undoEnd = setFunction(el, end); 1910 }, 1911 after, 1912 cleanup() { 1913 undoDuring(); 1914 undoEnd(); 1915 } 1916 }); 1917 } 1918 function performTransition(el, stages) { 1919 let interrupted, reachedBefore, reachedEnd; 1920 let finish = once(() => { 1921 mutateDom(() => { 1922 interrupted = true; 1923 if (!reachedBefore) 1924 stages.before(); 1925 if (!reachedEnd) { 1926 stages.end(); 1927 releaseNextTicks(); 1928 } 1929 stages.after(); 1930 if (el.isConnected) 1931 stages.cleanup(); 1932 delete el._x_transitioning; 1933 }); 1934 }); 1935 el._x_transitioning = { 1936 beforeCancels: [], 1937 beforeCancel(callback) { 1938 this.beforeCancels.push(callback); 1939 }, 1940 cancel: once(function() { 1941 while (this.beforeCancels.length) { 1942 this.beforeCancels.shift()(); 1943 } 1944 ; 1945 finish(); 1946 }), 1947 finish 1948 }; 1949 mutateDom(() => { 1950 stages.start(); 1951 stages.during(); 1952 }); 1953 holdNextTicks(); 1954 requestAnimationFrame(() => { 1955 if (interrupted) 1956 return; 1957 let duration = Number(getComputedStyle(el).transitionDuration.replace(/,.*/, "").replace("s", "")) * 1e3; 1958 let delay3 = Number(getComputedStyle(el).transitionDelay.replace(/,.*/, "").replace("s", "")) * 1e3; 1959 if (duration === 0) 1960 duration = Number(getComputedStyle(el).animationDuration.replace("s", "")) * 1e3; 1961 mutateDom(() => { 1962 stages.before(); 1963 }); 1964 reachedBefore = true; 1965 requestAnimationFrame(() => { 1966 if (interrupted) 1967 return; 1968 mutateDom(() => { 1969 stages.end(); 1970 }); 1971 releaseNextTicks(); 1972 setTimeout(el._x_transitioning.finish, duration + delay3); 1973 reachedEnd = true; 1974 }); 1975 }); 1976 } 1977 function modifierValue(modifiers, key, fallback2) { 1978 if (modifiers.indexOf(key) === -1) 1979 return fallback2; 1980 const rawValue = modifiers[modifiers.indexOf(key) + 1]; 1981 if (!rawValue) 1982 return fallback2; 1983 if (key === "scale") { 1984 if (isNaN(rawValue)) 1985 return fallback2; 1986 } 1987 if (key === "duration" || key === "delay") { 1988 let match = rawValue.match(/([0-9]+)ms/); 1989 if (match) 1990 return match[1]; 1991 } 1992 if (key === "origin") { 1993 if (["top", "right", "left", "center", "bottom"].includes(modifiers[modifiers.indexOf(key) + 2])) { 1994 return [rawValue, modifiers[modifiers.indexOf(key) + 2]].join(" "); 1995 } 1996 } 1997 return rawValue; 1998 } 1999 var isCloning = false; 2000 function skipDuringClone(callback, fallback2 = () => { 2001 }) { 2002 return (...args) => isCloning ? fallback2(...args) : callback(...args); 2003 } 2004 function onlyDuringClone(callback) { 2005 return (...args) => isCloning && callback(...args); 2006 } 2007 var interceptors = []; 2008 function interceptClone(callback) { 2009 interceptors.push(callback); 2010 } 2011 function cloneNode(from, to) { 2012 interceptors.forEach((i) => i(from, to)); 2013 isCloning = true; 2014 dontRegisterReactiveSideEffects(() => { 2015 initTree(to, (el, callback) => { 2016 callback(el, () => { 2017 }); 2018 }); 2019 }); 2020 isCloning = false; 2021 } 2022 var isCloningLegacy = false; 2023 function clone(oldEl, newEl) { 2024 if (!newEl._x_dataStack) 2025 newEl._x_dataStack = oldEl._x_dataStack; 2026 isCloning = true; 2027 isCloningLegacy = true; 2028 dontRegisterReactiveSideEffects(() => { 2029 cloneTree(newEl); 2030 }); 2031 isCloning = false; 2032 isCloningLegacy = false; 2033 } 2034 function cloneTree(el) { 2035 let hasRunThroughFirstEl = false; 2036 let shallowWalker = (el2, callback) => { 2037 walk(el2, (el3, skip) => { 2038 if (hasRunThroughFirstEl && isRoot(el3)) 2039 return skip(); 2040 hasRunThroughFirstEl = true; 2041 callback(el3, skip); 2042 }); 2043 }; 2044 initTree(el, shallowWalker); 2045 } 2046 function dontRegisterReactiveSideEffects(callback) { 2047 let cache = effect; 2048 overrideEffect((callback2, el) => { 2049 let storedEffect = cache(callback2); 2050 release(storedEffect); 2051 return () => { 2052 }; 2053 }); 2054 callback(); 2055 overrideEffect(cache); 2056 } 2057 function bind(el, name, value, modifiers = []) { 2058 if (!el._x_bindings) 2059 el._x_bindings = reactive({}); 2060 el._x_bindings[name] = value; 2061 name = modifiers.includes("camel") ? camelCase(name) : name; 2062 switch (name) { 2063 case "value": 2064 bindInputValue(el, value); 2065 break; 2066 case "style": 2067 bindStyles(el, value); 2068 break; 2069 case "class": 2070 bindClasses(el, value); 2071 break; 2072 case "selected": 2073 case "checked": 2074 bindAttributeAndProperty(el, name, value); 2075 break; 2076 default: 2077 bindAttribute(el, name, value); 2078 break; 2079 } 2080 } 2081 function bindInputValue(el, value) { 2082 if (isRadio(el)) { 2083 if (el.attributes.value === void 0) { 2084 el.value = value; 2085 } 2086 } else if (isCheckbox(el)) { 2087 if (Number.isInteger(value)) { 2088 el.value = value; 2089 } else if (!Array.isArray(value) && typeof value !== "boolean" && ![null, void 0].includes(value)) { 2090 el.value = String(value); 2091 } else { 2092 if (Array.isArray(value)) { 2093 el.checked = value.some((val) => checkedAttrLooseCompare(val, el.value)); 2094 } else { 2095 el.checked = !!value; 2096 } 2097 } 2098 } else if (el.tagName === "SELECT") { 2099 updateSelect(el, value); 2100 } else { 2101 if (el.value === value) 2102 return; 2103 el.value = value === void 0 ? "" : value; 2104 } 2105 } 2106 function bindClasses(el, value) { 2107 if (el._x_undoAddedClasses) 2108 el._x_undoAddedClasses(); 2109 el._x_undoAddedClasses = setClasses(el, value); 2110 } 2111 function bindStyles(el, value) { 2112 if (el._x_undoAddedStyles) 2113 el._x_undoAddedStyles(); 2114 el._x_undoAddedStyles = setStyles(el, value); 2115 } 2116 function bindAttributeAndProperty(el, name, value) { 2117 bindAttribute(el, name, value); 2118 setPropertyIfChanged(el, name, value); 2119 } 2120 function bindAttribute(el, name, value) { 2121 if ([null, void 0, false].includes(value) && attributeShouldntBePreservedIfFalsy(name)) { 2122 el.removeAttribute(name); 2123 } else { 2124 if (isBooleanAttr(name)) 2125 value = name; 2126 setIfChanged(el, name, value); 2127 } 2128 } 2129 function setIfChanged(el, attrName, value) { 2130 if (el.getAttribute(attrName) != value) { 2131 el.setAttribute(attrName, value); 2132 } 2133 } 2134 function setPropertyIfChanged(el, propName, value) { 2135 if (el[propName] !== value) { 2136 el[propName] = value; 2137 } 2138 } 2139 function updateSelect(el, value) { 2140 const arrayWrappedValue = [].concat(value).map((value2) => { 2141 return value2 + ""; 2142 }); 2143 Array.from(el.options).forEach((option) => { 2144 option.selected = arrayWrappedValue.includes(option.value); 2145 }); 2146 } 2147 function camelCase(subject) { 2148 return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase()); 2149 } 2150 function checkedAttrLooseCompare(valueA, valueB) { 2151 return valueA == valueB; 2152 } 2153 function safeParseBoolean(rawValue) { 2154 if ([1, "1", "true", "on", "yes", true].includes(rawValue)) { 2155 return true; 2156 } 2157 if ([0, "0", "false", "off", "no", false].includes(rawValue)) { 2158 return false; 2159 } 2160 return rawValue ? Boolean(rawValue) : null; 2161 } 2162 var booleanAttributes = /* @__PURE__ */ new Set([ 2163 "allowfullscreen", 2164 "async", 2165 "autofocus", 2166 "autoplay", 2167 "checked", 2168 "controls", 2169 "default", 2170 "defer", 2171 "disabled", 2172 "formnovalidate", 2173 "inert", 2174 "ismap", 2175 "itemscope", 2176 "loop", 2177 "multiple", 2178 "muted", 2179 "nomodule", 2180 "novalidate", 2181 "open", 2182 "playsinline", 2183 "readonly", 2184 "required", 2185 "reversed", 2186 "selected", 2187 "shadowrootclonable", 2188 "shadowrootdelegatesfocus", 2189 "shadowrootserializable" 2190 ]); 2191 function isBooleanAttr(attrName) { 2192 return booleanAttributes.has(attrName); 2193 } 2194 function attributeShouldntBePreservedIfFalsy(name) { 2195 return !["aria-pressed", "aria-checked", "aria-expanded", "aria-selected"].includes(name); 2196 } 2197 function getBinding(el, name, fallback2) { 2198 if (el._x_bindings && el._x_bindings[name] !== void 0) 2199 return el._x_bindings[name]; 2200 return getAttributeBinding(el, name, fallback2); 2201 } 2202 function extractProp(el, name, fallback2, extract = true) { 2203 if (el._x_bindings && el._x_bindings[name] !== void 0) 2204 return el._x_bindings[name]; 2205 if (el._x_inlineBindings && el._x_inlineBindings[name] !== void 0) { 2206 let binding = el._x_inlineBindings[name]; 2207 binding.extract = extract; 2208 return dontAutoEvaluateFunctions(() => { 2209 return evaluate(el, binding.expression); 2210 }); 2211 } 2212 return getAttributeBinding(el, name, fallback2); 2213 } 2214 function getAttributeBinding(el, name, fallback2) { 2215 let attr = el.getAttribute(name); 2216 if (attr === null) 2217 return typeof fallback2 === "function" ? fallback2() : fallback2; 2218 if (attr === "") 2219 return true; 2220 if (isBooleanAttr(name)) { 2221 return !![name, "true"].includes(attr); 2222 } 2223 return attr; 2224 } 2225 function isCheckbox(el) { 2226 return el.type === "checkbox" || el.localName === "ui-checkbox" || el.localName === "ui-switch"; 2227 } 2228 function isRadio(el) { 2229 return el.type === "radio" || el.localName === "ui-radio"; 2230 } 2231 function debounce(func, wait) { 2232 let timeout; 2233 return function() { 2234 const context = this, args = arguments; 2235 const later = function() { 2236 timeout = null; 2237 func.apply(context, args); 2238 }; 2239 clearTimeout(timeout); 2240 timeout = setTimeout(later, wait); 2241 }; 2242 } 2243 function throttle(func, limit) { 2244 let inThrottle; 2245 return function() { 2246 let context = this, args = arguments; 2247 if (!inThrottle) { 2248 func.apply(context, args); 2249 inThrottle = true; 2250 setTimeout(() => inThrottle = false, limit); 2251 } 2252 }; 2253 } 2254 function entangle({ get: outerGet, set: outerSet }, { get: innerGet, set: innerSet }) { 2255 let firstRun = true; 2256 let outerHash; 2257 let innerHash; 2258 let reference = effect(() => { 2259 let outer = outerGet(); 2260 let inner = innerGet(); 2261 if (firstRun) { 2262 innerSet(cloneIfObject(outer)); 2263 firstRun = false; 2264 } else { 2265 let outerHashLatest = JSON.stringify(outer); 2266 let innerHashLatest = JSON.stringify(inner); 2267 if (outerHashLatest !== outerHash) { 2268 innerSet(cloneIfObject(outer)); 2269 } else if (outerHashLatest !== innerHashLatest) { 2270 outerSet(cloneIfObject(inner)); 2271 } else { 2272 } 2273 } 2274 outerHash = JSON.stringify(outerGet()); 2275 innerHash = JSON.stringify(innerGet()); 2276 }); 2277 return () => { 2278 release(reference); 2279 }; 2280 } 2281 function cloneIfObject(value) { 2282 return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; 2283 } 2284 function plugin(callback) { 2285 let callbacks = Array.isArray(callback) ? callback : [callback]; 2286 callbacks.forEach((i) => i(alpine_default)); 2287 } 2288 var stores = {}; 2289 var isReactive = false; 2290 function store(name, value) { 2291 if (!isReactive) { 2292 stores = reactive(stores); 2293 isReactive = true; 2294 } 2295 if (value === void 0) { 2296 return stores[name]; 2297 } 2298 stores[name] = value; 2299 initInterceptors(stores[name]); 2300 if (typeof value === "object" && value !== null && value.hasOwnProperty("init") && typeof value.init === "function") { 2301 stores[name].init(); 2302 } 2303 } 2304 function getStores() { 2305 return stores; 2306 } 2307 var binds = {}; 2308 function bind2(name, bindings) { 2309 let getBindings = typeof bindings !== "function" ? () => bindings : bindings; 2310 if (name instanceof Element) { 2311 return applyBindingsObject(name, getBindings()); 2312 } else { 2313 binds[name] = getBindings; 2314 } 2315 return () => { 2316 }; 2317 } 2318 function injectBindingProviders(obj) { 2319 Object.entries(binds).forEach(([name, callback]) => { 2320 Object.defineProperty(obj, name, { 2321 get() { 2322 return (...args) => { 2323 return callback(...args); 2324 }; 2325 } 2326 }); 2327 }); 2328 return obj; 2329 } 2330 function applyBindingsObject(el, obj, original) { 2331 let cleanupRunners = []; 2332 while (cleanupRunners.length) 2333 cleanupRunners.pop()(); 2334 let attributes = Object.entries(obj).map(([name, value]) => ({ name, value })); 2335 let staticAttributes = attributesOnly(attributes); 2336 attributes = attributes.map((attribute) => { 2337 if (staticAttributes.find((attr) => attr.name === attribute.name)) { 2338 return { 2339 name: `x-bind:${attribute.name}`, 2340 value: `"${attribute.value}"` 2341 }; 2342 } 2343 return attribute; 2344 }); 2345 directives(el, attributes, original).map((handle) => { 2346 cleanupRunners.push(handle.runCleanups); 2347 handle(); 2348 }); 2349 return () => { 2350 while (cleanupRunners.length) 2351 cleanupRunners.pop()(); 2352 }; 2353 } 2354 var datas = {}; 2355 function data(name, callback) { 2356 datas[name] = callback; 2357 } 2358 function injectDataProviders(obj, context) { 2359 Object.entries(datas).forEach(([name, callback]) => { 2360 Object.defineProperty(obj, name, { 2361 get() { 2362 return (...args) => { 2363 return callback.bind(context)(...args); 2364 }; 2365 }, 2366 enumerable: false 2367 }); 2368 }); 2369 return obj; 2370 } 2371 var Alpine2 = { 2372 get reactive() { 2373 return reactive; 2374 }, 2375 get release() { 2376 return release; 2377 }, 2378 get effect() { 2379 return effect; 2380 }, 2381 get raw() { 2382 return raw; 2383 }, 2384 get transaction() { 2385 return transaction; 2386 }, 2387 version: "3.15.11", 2388 flushAndStopDeferringMutations, 2389 dontAutoEvaluateFunctions, 2390 disableEffectScheduling, 2391 startObservingMutations, 2392 stopObservingMutations, 2393 setReactivityEngine, 2394 onAttributeRemoved, 2395 onAttributesAdded, 2396 closestDataStack, 2397 skipDuringClone, 2398 onlyDuringClone, 2399 addRootSelector, 2400 addInitSelector, 2401 setErrorHandler, 2402 interceptClone, 2403 addScopeToNode, 2404 deferMutations, 2405 mapAttributes, 2406 evaluateLater, 2407 interceptInit, 2408 initInterceptors, 2409 injectMagics, 2410 setEvaluator, 2411 setRawEvaluator, 2412 mergeProxies, 2413 extractProp, 2414 findClosest, 2415 onElRemoved, 2416 closestRoot, 2417 destroyTree, 2418 interceptor, 2419 transition, 2420 setStyles, 2421 mutateDom, 2422 directive, 2423 entangle, 2424 throttle, 2425 debounce, 2426 evaluate, 2427 evaluateRaw, 2428 initTree, 2429 nextTick, 2430 prefixed: prefix, 2431 prefix: setPrefix, 2432 plugin, 2433 magic, 2434 store, 2435 start, 2436 clone, 2437 cloneNode, 2438 bound: getBinding, 2439 $data: scope, 2440 watch, 2441 walk, 2442 data, 2443 bind: bind2 2444 }; 2445 var alpine_default = Alpine2; 2446 function makeMap(str, expectsLowerCase) { 2447 const map = /* @__PURE__ */ Object.create(null); 2448 const list = str.split(","); 2449 for (let i = 0; i < list.length; i++) { 2450 map[list[i]] = true; 2451 } 2452 return expectsLowerCase ? (val) => !!map[val.toLowerCase()] : (val) => !!map[val]; 2453 } 2454 var specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`; 2455 var isBooleanAttr2 = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`); 2456 var EMPTY_OBJ = true ? Object.freeze({}) : {}; 2457 var EMPTY_ARR = true ? Object.freeze([]) : []; 2458 var hasOwnProperty = Object.prototype.hasOwnProperty; 2459 var hasOwn = (val, key) => hasOwnProperty.call(val, key); 2460 var isArray2 = Array.isArray; 2461 var isMap = (val) => toTypeString(val) === "[object Map]"; 2462 var isString = (val) => typeof val === "string"; 2463 var isSymbol = (val) => typeof val === "symbol"; 2464 var isObject2 = (val) => val !== null && typeof val === "object"; 2465 var objectToString = Object.prototype.toString; 2466 var toTypeString = (value) => objectToString.call(value); 2467 var toRawType = (value) => { 2468 return toTypeString(value).slice(8, -1); 2469 }; 2470 var isIntegerKey = (key) => isString(key) && key !== "NaN" && key[0] !== "-" && "" + parseInt(key, 10) === key; 2471 var cacheStringFunction = (fn) => { 2472 const cache = /* @__PURE__ */ Object.create(null); 2473 return (str) => { 2474 const hit = cache[str]; 2475 return hit || (cache[str] = fn(str)); 2476 }; 2477 }; 2478 var camelizeRE = /-(\w)/g; 2479 var camelize = cacheStringFunction((str) => { 2480 return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : ""); 2481 }); 2482 var hyphenateRE = /\B([A-Z])/g; 2483 var hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase()); 2484 var capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1)); 2485 var toHandlerKey = cacheStringFunction((str) => str ? `on${capitalize(str)}` : ``); 2486 var hasChanged = (value, oldValue) => value !== oldValue && (value === value || oldValue === oldValue); 2487 var targetMap = /* @__PURE__ */ new WeakMap(); 2488 var effectStack = []; 2489 var activeEffect; 2490 var ITERATE_KEY = Symbol(true ? "iterate" : ""); 2491 var MAP_KEY_ITERATE_KEY = Symbol(true ? "Map key iterate" : ""); 2492 function isEffect(fn) { 2493 return fn && fn._isEffect === true; 2494 } 2495 function effect2(fn, options = EMPTY_OBJ) { 2496 if (isEffect(fn)) { 2497 fn = fn.raw; 2498 } 2499 const effect3 = createReactiveEffect(fn, options); 2500 if (!options.lazy) { 2501 effect3(); 2502 } 2503 return effect3; 2504 } 2505 function stop(effect3) { 2506 if (effect3.active) { 2507 cleanup(effect3); 2508 if (effect3.options.onStop) { 2509 effect3.options.onStop(); 2510 } 2511 effect3.active = false; 2512 } 2513 } 2514 var uid = 0; 2515 function createReactiveEffect(fn, options) { 2516 const effect3 = function reactiveEffect() { 2517 if (!effect3.active) { 2518 return fn(); 2519 } 2520 if (!effectStack.includes(effect3)) { 2521 cleanup(effect3); 2522 try { 2523 enableTracking(); 2524 effectStack.push(effect3); 2525 activeEffect = effect3; 2526 return fn(); 2527 } finally { 2528 effectStack.pop(); 2529 resetTracking(); 2530 activeEffect = effectStack[effectStack.length - 1]; 2531 } 2532 } 2533 }; 2534 effect3.id = uid++; 2535 effect3.allowRecurse = !!options.allowRecurse; 2536 effect3._isEffect = true; 2537 effect3.active = true; 2538 effect3.raw = fn; 2539 effect3.deps = []; 2540 effect3.options = options; 2541 return effect3; 2542 } 2543 function cleanup(effect3) { 2544 const { deps } = effect3; 2545 if (deps.length) { 2546 for (let i = 0; i < deps.length; i++) { 2547 deps[i].delete(effect3); 2548 } 2549 deps.length = 0; 2550 } 2551 } 2552 var shouldTrack = true; 2553 var trackStack = []; 2554 function pauseTracking() { 2555 trackStack.push(shouldTrack); 2556 shouldTrack = false; 2557 } 2558 function enableTracking() { 2559 trackStack.push(shouldTrack); 2560 shouldTrack = true; 2561 } 2562 function resetTracking() { 2563 const last = trackStack.pop(); 2564 shouldTrack = last === void 0 ? true : last; 2565 } 2566 function track(target, type, key) { 2567 if (!shouldTrack || activeEffect === void 0) { 2568 return; 2569 } 2570 let depsMap = targetMap.get(target); 2571 if (!depsMap) { 2572 targetMap.set(target, depsMap = /* @__PURE__ */ new Map()); 2573 } 2574 let dep = depsMap.get(key); 2575 if (!dep) { 2576 depsMap.set(key, dep = /* @__PURE__ */ new Set()); 2577 } 2578 if (!dep.has(activeEffect)) { 2579 dep.add(activeEffect); 2580 activeEffect.deps.push(dep); 2581 if (activeEffect.options.onTrack) { 2582 activeEffect.options.onTrack({ 2583 effect: activeEffect, 2584 target, 2585 type, 2586 key 2587 }); 2588 } 2589 } 2590 } 2591 function trigger(target, type, key, newValue, oldValue, oldTarget) { 2592 const depsMap = targetMap.get(target); 2593 if (!depsMap) { 2594 return; 2595 } 2596 const effects = /* @__PURE__ */ new Set(); 2597 const add2 = (effectsToAdd) => { 2598 if (effectsToAdd) { 2599 effectsToAdd.forEach((effect3) => { 2600 if (effect3 !== activeEffect || effect3.allowRecurse) { 2601 effects.add(effect3); 2602 } 2603 }); 2604 } 2605 }; 2606 if (type === "clear") { 2607 depsMap.forEach(add2); 2608 } else if (key === "length" && isArray2(target)) { 2609 depsMap.forEach((dep, key2) => { 2610 if (key2 === "length" || key2 >= newValue) { 2611 add2(dep); 2612 } 2613 }); 2614 } else { 2615 if (key !== void 0) { 2616 add2(depsMap.get(key)); 2617 } 2618 switch (type) { 2619 case "add": 2620 if (!isArray2(target)) { 2621 add2(depsMap.get(ITERATE_KEY)); 2622 if (isMap(target)) { 2623 add2(depsMap.get(MAP_KEY_ITERATE_KEY)); 2624 } 2625 } else if (isIntegerKey(key)) { 2626 add2(depsMap.get("length")); 2627 } 2628 break; 2629 case "delete": 2630 if (!isArray2(target)) { 2631 add2(depsMap.get(ITERATE_KEY)); 2632 if (isMap(target)) { 2633 add2(depsMap.get(MAP_KEY_ITERATE_KEY)); 2634 } 2635 } 2636 break; 2637 case "set": 2638 if (isMap(target)) { 2639 add2(depsMap.get(ITERATE_KEY)); 2640 } 2641 break; 2642 } 2643 } 2644 const run = (effect3) => { 2645 if (effect3.options.onTrigger) { 2646 effect3.options.onTrigger({ 2647 effect: effect3, 2648 target, 2649 key, 2650 type, 2651 newValue, 2652 oldValue, 2653 oldTarget 2654 }); 2655 } 2656 if (effect3.options.scheduler) { 2657 effect3.options.scheduler(effect3); 2658 } else { 2659 effect3(); 2660 } 2661 }; 2662 effects.forEach(run); 2663 } 2664 var isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`); 2665 var builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol).map((key) => Symbol[key]).filter(isSymbol)); 2666 var get2 = /* @__PURE__ */ createGetter(); 2667 var readonlyGet = /* @__PURE__ */ createGetter(true); 2668 var arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations(); 2669 function createArrayInstrumentations() { 2670 const instrumentations = {}; 2671 ["includes", "indexOf", "lastIndexOf"].forEach((key) => { 2672 instrumentations[key] = function(...args) { 2673 const arr = toRaw(this); 2674 for (let i = 0, l = this.length; i < l; i++) { 2675 track(arr, "get", i + ""); 2676 } 2677 const res = arr[key](...args); 2678 if (res === -1 || res === false) { 2679 return arr[key](...args.map(toRaw)); 2680 } else { 2681 return res; 2682 } 2683 }; 2684 }); 2685 ["push", "pop", "shift", "unshift", "splice"].forEach((key) => { 2686 instrumentations[key] = function(...args) { 2687 pauseTracking(); 2688 const res = toRaw(this)[key].apply(this, args); 2689 resetTracking(); 2690 return res; 2691 }; 2692 }); 2693 return instrumentations; 2694 } 2695 function createGetter(isReadonly = false, shallow = false) { 2696 return function get3(target, key, receiver) { 2697 if (key === "__v_isReactive") { 2698 return !isReadonly; 2699 } else if (key === "__v_isReadonly") { 2700 return isReadonly; 2701 } else if (key === "__v_raw" && receiver === (isReadonly ? shallow ? shallowReadonlyMap : readonlyMap : shallow ? shallowReactiveMap : reactiveMap).get(target)) { 2702 return target; 2703 } 2704 const targetIsArray = isArray2(target); 2705 if (!isReadonly && targetIsArray && hasOwn(arrayInstrumentations, key)) { 2706 return Reflect.get(arrayInstrumentations, key, receiver); 2707 } 2708 const res = Reflect.get(target, key, receiver); 2709 if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) { 2710 return res; 2711 } 2712 if (!isReadonly) { 2713 track(target, "get", key); 2714 } 2715 if (shallow) { 2716 return res; 2717 } 2718 if (isRef(res)) { 2719 const shouldUnwrap = !targetIsArray || !isIntegerKey(key); 2720 return shouldUnwrap ? res.value : res; 2721 } 2722 if (isObject2(res)) { 2723 return isReadonly ? readonly(res) : reactive2(res); 2724 } 2725 return res; 2726 }; 2727 } 2728 var set2 = /* @__PURE__ */ createSetter(); 2729 function createSetter(shallow = false) { 2730 return function set3(target, key, value, receiver) { 2731 let oldValue = target[key]; 2732 if (!shallow) { 2733 value = toRaw(value); 2734 oldValue = toRaw(oldValue); 2735 if (!isArray2(target) && isRef(oldValue) && !isRef(value)) { 2736 oldValue.value = value; 2737 return true; 2738 } 2739 } 2740 const hadKey = isArray2(target) && isIntegerKey(key) ? Number(key) < target.length : hasOwn(target, key); 2741 const result = Reflect.set(target, key, value, receiver); 2742 if (target === toRaw(receiver)) { 2743 if (!hadKey) { 2744 trigger(target, "add", key, value); 2745 } else if (hasChanged(value, oldValue)) { 2746 trigger(target, "set", key, value, oldValue); 2747 } 2748 } 2749 return result; 2750 }; 2751 } 2752 function deleteProperty(target, key) { 2753 const hadKey = hasOwn(target, key); 2754 const oldValue = target[key]; 2755 const result = Reflect.deleteProperty(target, key); 2756 if (result && hadKey) { 2757 trigger(target, "delete", key, void 0, oldValue); 2758 } 2759 return result; 2760 } 2761 function has(target, key) { 2762 const result = Reflect.has(target, key); 2763 if (!isSymbol(key) || !builtInSymbols.has(key)) { 2764 track(target, "has", key); 2765 } 2766 return result; 2767 } 2768 function ownKeys(target) { 2769 track(target, "iterate", isArray2(target) ? "length" : ITERATE_KEY); 2770 return Reflect.ownKeys(target); 2771 } 2772 var mutableHandlers = { 2773 get: get2, 2774 set: set2, 2775 deleteProperty, 2776 has, 2777 ownKeys 2778 }; 2779 var readonlyHandlers = { 2780 get: readonlyGet, 2781 set(target, key) { 2782 if (true) { 2783 console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target); 2784 } 2785 return true; 2786 }, 2787 deleteProperty(target, key) { 2788 if (true) { 2789 console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target); 2790 } 2791 return true; 2792 } 2793 }; 2794 var toReactive = (value) => isObject2(value) ? reactive2(value) : value; 2795 var toReadonly = (value) => isObject2(value) ? readonly(value) : value; 2796 var toShallow = (value) => value; 2797 var getProto = (v) => Reflect.getPrototypeOf(v); 2798 function get$1(target, key, isReadonly = false, isShallow = false) { 2799 target = target["__v_raw"]; 2800 const rawTarget = toRaw(target); 2801 const rawKey = toRaw(key); 2802 if (key !== rawKey) { 2803 !isReadonly && track(rawTarget, "get", key); 2804 } 2805 !isReadonly && track(rawTarget, "get", rawKey); 2806 const { has: has2 } = getProto(rawTarget); 2807 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 2808 if (has2.call(rawTarget, key)) { 2809 return wrap(target.get(key)); 2810 } else if (has2.call(rawTarget, rawKey)) { 2811 return wrap(target.get(rawKey)); 2812 } else if (target !== rawTarget) { 2813 target.get(key); 2814 } 2815 } 2816 function has$1(key, isReadonly = false) { 2817 const target = this["__v_raw"]; 2818 const rawTarget = toRaw(target); 2819 const rawKey = toRaw(key); 2820 if (key !== rawKey) { 2821 !isReadonly && track(rawTarget, "has", key); 2822 } 2823 !isReadonly && track(rawTarget, "has", rawKey); 2824 return key === rawKey ? target.has(key) : target.has(key) || target.has(rawKey); 2825 } 2826 function size(target, isReadonly = false) { 2827 target = target["__v_raw"]; 2828 !isReadonly && track(toRaw(target), "iterate", ITERATE_KEY); 2829 return Reflect.get(target, "size", target); 2830 } 2831 function add(value) { 2832 value = toRaw(value); 2833 const target = toRaw(this); 2834 const proto = getProto(target); 2835 const hadKey = proto.has.call(target, value); 2836 if (!hadKey) { 2837 target.add(value); 2838 trigger(target, "add", value, value); 2839 } 2840 return this; 2841 } 2842 function set$1(key, value) { 2843 value = toRaw(value); 2844 const target = toRaw(this); 2845 const { has: has2, get: get3 } = getProto(target); 2846 let hadKey = has2.call(target, key); 2847 if (!hadKey) { 2848 key = toRaw(key); 2849 hadKey = has2.call(target, key); 2850 } else if (true) { 2851 checkIdentityKeys(target, has2, key); 2852 } 2853 const oldValue = get3.call(target, key); 2854 target.set(key, value); 2855 if (!hadKey) { 2856 trigger(target, "add", key, value); 2857 } else if (hasChanged(value, oldValue)) { 2858 trigger(target, "set", key, value, oldValue); 2859 } 2860 return this; 2861 } 2862 function deleteEntry(key) { 2863 const target = toRaw(this); 2864 const { has: has2, get: get3 } = getProto(target); 2865 let hadKey = has2.call(target, key); 2866 if (!hadKey) { 2867 key = toRaw(key); 2868 hadKey = has2.call(target, key); 2869 } else if (true) { 2870 checkIdentityKeys(target, has2, key); 2871 } 2872 const oldValue = get3 ? get3.call(target, key) : void 0; 2873 const result = target.delete(key); 2874 if (hadKey) { 2875 trigger(target, "delete", key, void 0, oldValue); 2876 } 2877 return result; 2878 } 2879 function clear() { 2880 const target = toRaw(this); 2881 const hadItems = target.size !== 0; 2882 const oldTarget = true ? isMap(target) ? new Map(target) : new Set(target) : void 0; 2883 const result = target.clear(); 2884 if (hadItems) { 2885 trigger(target, "clear", void 0, void 0, oldTarget); 2886 } 2887 return result; 2888 } 2889 function createForEach(isReadonly, isShallow) { 2890 return function forEach(callback, thisArg) { 2891 const observed = this; 2892 const target = observed["__v_raw"]; 2893 const rawTarget = toRaw(target); 2894 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 2895 !isReadonly && track(rawTarget, "iterate", ITERATE_KEY); 2896 return target.forEach((value, key) => { 2897 return callback.call(thisArg, wrap(value), wrap(key), observed); 2898 }); 2899 }; 2900 } 2901 function createIterableMethod(method, isReadonly, isShallow) { 2902 return function(...args) { 2903 const target = this["__v_raw"]; 2904 const rawTarget = toRaw(target); 2905 const targetIsMap = isMap(rawTarget); 2906 const isPair = method === "entries" || method === Symbol.iterator && targetIsMap; 2907 const isKeyOnly = method === "keys" && targetIsMap; 2908 const innerIterator = target[method](...args); 2909 const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive; 2910 !isReadonly && track(rawTarget, "iterate", isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY); 2911 return { 2912 next() { 2913 const { value, done } = innerIterator.next(); 2914 return done ? { value, done } : { 2915 value: isPair ? [wrap(value[0]), wrap(value[1])] : wrap(value), 2916 done 2917 }; 2918 }, 2919 [Symbol.iterator]() { 2920 return this; 2921 } 2922 }; 2923 }; 2924 } 2925 function createReadonlyMethod(type) { 2926 return function(...args) { 2927 if (true) { 2928 const key = args[0] ? `on key "${args[0]}" ` : ``; 2929 console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this)); 2930 } 2931 return type === "delete" ? false : this; 2932 }; 2933 } 2934 function createInstrumentations() { 2935 const mutableInstrumentations2 = { 2936 get(key) { 2937 return get$1(this, key); 2938 }, 2939 get size() { 2940 return size(this); 2941 }, 2942 has: has$1, 2943 add, 2944 set: set$1, 2945 delete: deleteEntry, 2946 clear, 2947 forEach: createForEach(false, false) 2948 }; 2949 const shallowInstrumentations2 = { 2950 get(key) { 2951 return get$1(this, key, false, true); 2952 }, 2953 get size() { 2954 return size(this); 2955 }, 2956 has: has$1, 2957 add, 2958 set: set$1, 2959 delete: deleteEntry, 2960 clear, 2961 forEach: createForEach(false, true) 2962 }; 2963 const readonlyInstrumentations2 = { 2964 get(key) { 2965 return get$1(this, key, true); 2966 }, 2967 get size() { 2968 return size(this, true); 2969 }, 2970 has(key) { 2971 return has$1.call(this, key, true); 2972 }, 2973 add: createReadonlyMethod("add"), 2974 set: createReadonlyMethod("set"), 2975 delete: createReadonlyMethod("delete"), 2976 clear: createReadonlyMethod("clear"), 2977 forEach: createForEach(true, false) 2978 }; 2979 const shallowReadonlyInstrumentations2 = { 2980 get(key) { 2981 return get$1(this, key, true, true); 2982 }, 2983 get size() { 2984 return size(this, true); 2985 }, 2986 has(key) { 2987 return has$1.call(this, key, true); 2988 }, 2989 add: createReadonlyMethod("add"), 2990 set: createReadonlyMethod("set"), 2991 delete: createReadonlyMethod("delete"), 2992 clear: createReadonlyMethod("clear"), 2993 forEach: createForEach(true, true) 2994 }; 2995 const iteratorMethods = ["keys", "values", "entries", Symbol.iterator]; 2996 iteratorMethods.forEach((method) => { 2997 mutableInstrumentations2[method] = createIterableMethod(method, false, false); 2998 readonlyInstrumentations2[method] = createIterableMethod(method, true, false); 2999 shallowInstrumentations2[method] = createIterableMethod(method, false, true); 3000 shallowReadonlyInstrumentations2[method] = createIterableMethod(method, true, true); 3001 }); 3002 return [ 3003 mutableInstrumentations2, 3004 readonlyInstrumentations2, 3005 shallowInstrumentations2, 3006 shallowReadonlyInstrumentations2 3007 ]; 3008 } 3009 var [mutableInstrumentations, readonlyInstrumentations, shallowInstrumentations, shallowReadonlyInstrumentations] = /* @__PURE__ */ createInstrumentations(); 3010 function createInstrumentationGetter(isReadonly, shallow) { 3011 const instrumentations = shallow ? isReadonly ? shallowReadonlyInstrumentations : shallowInstrumentations : isReadonly ? readonlyInstrumentations : mutableInstrumentations; 3012 return (target, key, receiver) => { 3013 if (key === "__v_isReactive") { 3014 return !isReadonly; 3015 } else if (key === "__v_isReadonly") { 3016 return isReadonly; 3017 } else if (key === "__v_raw") { 3018 return target; 3019 } 3020 return Reflect.get(hasOwn(instrumentations, key) && key in target ? instrumentations : target, key, receiver); 3021 }; 3022 } 3023 var mutableCollectionHandlers = { 3024 get: /* @__PURE__ */ createInstrumentationGetter(false, false) 3025 }; 3026 var readonlyCollectionHandlers = { 3027 get: /* @__PURE__ */ createInstrumentationGetter(true, false) 3028 }; 3029 function checkIdentityKeys(target, has2, key) { 3030 const rawKey = toRaw(key); 3031 if (rawKey !== key && has2.call(target, rawKey)) { 3032 const type = toRawType(target); 3033 console.warn(`Reactive ${type} contains both the raw and reactive versions of the same object${type === `Map` ? ` as keys` : ``}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`); 3034 } 3035 } 3036 var reactiveMap = /* @__PURE__ */ new WeakMap(); 3037 var shallowReactiveMap = /* @__PURE__ */ new WeakMap(); 3038 var readonlyMap = /* @__PURE__ */ new WeakMap(); 3039 var shallowReadonlyMap = /* @__PURE__ */ new WeakMap(); 3040 function targetTypeMap(rawType) { 3041 switch (rawType) { 3042 case "Object": 3043 case "Array": 3044 return 1; 3045 case "Map": 3046 case "Set": 3047 case "WeakMap": 3048 case "WeakSet": 3049 return 2; 3050 default: 3051 return 0; 3052 } 3053 } 3054 function getTargetType(value) { 3055 return value["__v_skip"] || !Object.isExtensible(value) ? 0 : targetTypeMap(toRawType(value)); 3056 } 3057 function reactive2(target) { 3058 if (target && target["__v_isReadonly"]) { 3059 return target; 3060 } 3061 return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap); 3062 } 3063 function readonly(target) { 3064 return createReactiveObject(target, true, readonlyHandlers, readonlyCollectionHandlers, readonlyMap); 3065 } 3066 function createReactiveObject(target, isReadonly, baseHandlers, collectionHandlers, proxyMap) { 3067 if (!isObject2(target)) { 3068 if (true) { 3069 console.warn(`value cannot be made reactive: ${String(target)}`); 3070 } 3071 return target; 3072 } 3073 if (target["__v_raw"] && !(isReadonly && target["__v_isReactive"])) { 3074 return target; 3075 } 3076 const existingProxy = proxyMap.get(target); 3077 if (existingProxy) { 3078 return existingProxy; 3079 } 3080 const targetType = getTargetType(target); 3081 if (targetType === 0) { 3082 return target; 3083 } 3084 const proxy = new Proxy(target, targetType === 2 ? collectionHandlers : baseHandlers); 3085 proxyMap.set(target, proxy); 3086 return proxy; 3087 } 3088 function toRaw(observed) { 3089 return observed && toRaw(observed["__v_raw"]) || observed; 3090 } 3091 function isRef(r) { 3092 return Boolean(r && r.__v_isRef === true); 3093 } 3094 magic("nextTick", () => nextTick); 3095 magic("dispatch", (el) => dispatch2.bind(dispatch2, el)); 3096 magic("watch", (el, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => (key, callback) => { 3097 let evaluate22 = evaluateLater2(key); 3098 let getter = () => { 3099 let value; 3100 evaluate22((i) => value = i); 3101 return value; 3102 }; 3103 let unwatch = watch(getter, callback); 3104 cleanup2(unwatch); 3105 }); 3106 magic("store", getStores); 3107 magic("data", (el) => scope(el)); 3108 magic("root", (el) => closestRoot(el)); 3109 magic("refs", (el) => { 3110 if (el._x_refs_proxy) 3111 return el._x_refs_proxy; 3112 el._x_refs_proxy = mergeProxies(getArrayOfRefObject(el)); 3113 return el._x_refs_proxy; 3114 }); 3115 function getArrayOfRefObject(el) { 3116 let refObjects = []; 3117 findClosest(el, (i) => { 3118 if (i._x_refs) 3119 refObjects.push(i._x_refs); 3120 }); 3121 return refObjects; 3122 } 3123 var globalIdMemo = {}; 3124 function findAndIncrementId(name) { 3125 if (!globalIdMemo[name]) 3126 globalIdMemo[name] = 0; 3127 return ++globalIdMemo[name]; 3128 } 3129 function closestIdRoot(el, name) { 3130 return findClosest(el, (element) => { 3131 if (element._x_ids && element._x_ids[name]) 3132 return true; 3133 }); 3134 } 3135 function setIdRoot(el, name) { 3136 if (!el._x_ids) 3137 el._x_ids = {}; 3138 if (!el._x_ids[name]) 3139 el._x_ids[name] = findAndIncrementId(name); 3140 } 3141 magic("id", (el, { cleanup: cleanup2 }) => (name, key = null) => { 3142 let cacheKey = `${name}${key ? `-${key}` : ""}`; 3143 return cacheIdByNameOnElement(el, cacheKey, cleanup2, () => { 3144 let root = closestIdRoot(el, name); 3145 let id = root ? root._x_ids[name] : findAndIncrementId(name); 3146 return key ? `${name}-${id}-${key}` : `${name}-${id}`; 3147 }); 3148 }); 3149 interceptClone((from, to) => { 3150 if (from._x_id) { 3151 to._x_id = from._x_id; 3152 } 3153 }); 3154 function cacheIdByNameOnElement(el, cacheKey, cleanup2, callback) { 3155 if (!el._x_id) 3156 el._x_id = {}; 3157 if (el._x_id[cacheKey]) 3158 return el._x_id[cacheKey]; 3159 let output = callback(); 3160 el._x_id[cacheKey] = output; 3161 cleanup2(() => { 3162 delete el._x_id[cacheKey]; 3163 }); 3164 return output; 3165 } 3166 magic("el", (el) => el); 3167 warnMissingPluginMagic("Focus", "focus", "focus"); 3168 warnMissingPluginMagic("Persist", "persist", "persist"); 3169 function warnMissingPluginMagic(name, magicName, slug) { 3170 magic(magicName, (el) => warn(`You can't use [$${magicName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); 3171 } 3172 directive("modelable", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 3173 let func = evaluateLater2(expression); 3174 let innerGet = () => { 3175 let result; 3176 func((i) => result = i); 3177 return result; 3178 }; 3179 let evaluateInnerSet = evaluateLater2(`${expression} = __placeholder`); 3180 let innerSet = (val) => evaluateInnerSet(() => { 3181 }, { scope: { "__placeholder": val } }); 3182 let initialValue = innerGet(); 3183 innerSet(initialValue); 3184 queueMicrotask(() => { 3185 if (!el._x_model) 3186 return; 3187 el._x_removeModelListeners["default"](); 3188 let outerGet = el._x_model.get; 3189 let outerSet = el._x_model.setWithModifiers; 3190 let releaseEntanglement = entangle({ 3191 get() { 3192 return outerGet(); 3193 }, 3194 set(value) { 3195 outerSet(value); 3196 } 3197 }, { 3198 get() { 3199 return innerGet(); 3200 }, 3201 set(value) { 3202 innerSet(value); 3203 } 3204 }); 3205 cleanup2(releaseEntanglement); 3206 }); 3207 }); 3208 directive("teleport", (el, { modifiers, expression }, { cleanup: cleanup2 }) => { 3209 if (el.tagName.toLowerCase() !== "template") 3210 warn("x-teleport can only be used on a <template> tag", el); 3211 let target = getTarget(expression); 3212 let clone2 = el.content.cloneNode(true).firstElementChild; 3213 el._x_teleport = clone2; 3214 clone2._x_teleportBack = el; 3215 el.setAttribute("data-teleport-template", true); 3216 clone2.setAttribute("data-teleport-target", true); 3217 if (el._x_forwardEvents) { 3218 el._x_forwardEvents.forEach((eventName) => { 3219 clone2.addEventListener(eventName, (e) => { 3220 e.stopPropagation(); 3221 el.dispatchEvent(new e.constructor(e.type, e)); 3222 }); 3223 }); 3224 } 3225 addScopeToNode(clone2, {}, el); 3226 let placeInDom = (clone3, target2, modifiers2) => { 3227 if (modifiers2.includes("prepend")) { 3228 target2.parentNode.insertBefore(clone3, target2); 3229 } else if (modifiers2.includes("append")) { 3230 target2.parentNode.insertBefore(clone3, target2.nextSibling); 3231 } else { 3232 target2.appendChild(clone3); 3233 } 3234 }; 3235 mutateDom(() => { 3236 placeInDom(clone2, target, modifiers); 3237 skipDuringClone(() => { 3238 initTree(clone2); 3239 })(); 3240 }); 3241 el._x_teleportPutBack = () => { 3242 let target2 = getTarget(expression); 3243 mutateDom(() => { 3244 placeInDom(el._x_teleport, target2, modifiers); 3245 }); 3246 }; 3247 cleanup2(() => mutateDom(() => { 3248 clone2.remove(); 3249 destroyTree(clone2); 3250 })); 3251 }); 3252 var teleportContainerDuringClone = document.createElement("div"); 3253 function getTarget(expression) { 3254 let target = skipDuringClone(() => { 3255 return document.querySelector(expression); 3256 }, () => { 3257 return teleportContainerDuringClone; 3258 })(); 3259 if (!target) 3260 warn(`Cannot find x-teleport element for selector: "${expression}"`); 3261 return target; 3262 } 3263 var handler = () => { 3264 }; 3265 handler.inline = (el, { modifiers }, { cleanup: cleanup2 }) => { 3266 modifiers.includes("self") ? el._x_ignoreSelf = true : el._x_ignore = true; 3267 cleanup2(() => { 3268 modifiers.includes("self") ? delete el._x_ignoreSelf : delete el._x_ignore; 3269 }); 3270 }; 3271 directive("ignore", handler); 3272 directive("effect", skipDuringClone((el, { expression }, { effect: effect3 }) => { 3273 effect3(evaluateLater(el, expression)); 3274 })); 3275 function on(el, event, modifiers, callback) { 3276 let listenerTarget = el; 3277 let handler4 = (e) => callback(e); 3278 let options = {}; 3279 let wrapHandler = (callback2, wrapper) => (e) => wrapper(callback2, e); 3280 if (modifiers.includes("dot")) 3281 event = dotSyntax(event); 3282 if (modifiers.includes("camel")) 3283 event = camelCase2(event); 3284 if (modifiers.includes("capture")) 3285 options.capture = true; 3286 if (modifiers.includes("window")) 3287 listenerTarget = window; 3288 if (modifiers.includes("document")) 3289 listenerTarget = document; 3290 if (modifiers.includes("passive")) { 3291 options.passive = modifiers[modifiers.indexOf("passive") + 1] !== "false"; 3292 } 3293 handler4 = addDebounceOrThrottle(modifiers, handler4); 3294 if (modifiers.includes("prevent")) 3295 handler4 = wrapHandler(handler4, (next, e) => { 3296 e.preventDefault(); 3297 next(e); 3298 }); 3299 if (modifiers.includes("stop")) 3300 handler4 = wrapHandler(handler4, (next, e) => { 3301 e.stopPropagation(); 3302 next(e); 3303 }); 3304 if (modifiers.includes("once")) { 3305 handler4 = wrapHandler(handler4, (next, e) => { 3306 next(e); 3307 listenerTarget.removeEventListener(event, handler4, options); 3308 }); 3309 } 3310 if (modifiers.includes("away") || modifiers.includes("outside")) { 3311 listenerTarget = document; 3312 handler4 = wrapHandler(handler4, (next, e) => { 3313 if (el.contains(e.target)) 3314 return; 3315 if (e.target.isConnected === false) 3316 return; 3317 if (el.offsetWidth < 1 && el.offsetHeight < 1) 3318 return; 3319 if (el._x_isShown === false) 3320 return; 3321 next(e); 3322 }); 3323 } 3324 if (modifiers.includes("self")) 3325 handler4 = wrapHandler(handler4, (next, e) => { 3326 e.target === el && next(e); 3327 }); 3328 if (event === "submit") { 3329 handler4 = wrapHandler(handler4, (next, e) => { 3330 if (e.target._x_pendingModelUpdates) { 3331 e.target._x_pendingModelUpdates.forEach((fn) => fn()); 3332 } 3333 next(e); 3334 }); 3335 } 3336 if (isKeyEvent(event) || isClickEvent(event)) { 3337 handler4 = wrapHandler(handler4, (next, e) => { 3338 if (isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers)) { 3339 return; 3340 } 3341 next(e); 3342 }); 3343 } 3344 listenerTarget.addEventListener(event, handler4, options); 3345 return () => { 3346 listenerTarget.removeEventListener(event, handler4, options); 3347 }; 3348 } 3349 function addDebounceOrThrottle(modifiers, handler4) { 3350 if (modifiers.includes("debounce")) { 3351 let nextModifier = modifiers[modifiers.indexOf("debounce") + 1] || "invalid-wait"; 3352 let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250; 3353 handler4 = debounce(handler4, wait); 3354 } 3355 if (modifiers.includes("throttle")) { 3356 let nextModifier = modifiers[modifiers.indexOf("throttle") + 1] || "invalid-wait"; 3357 let wait = isNumeric(nextModifier.split("ms")[0]) ? Number(nextModifier.split("ms")[0]) : 250; 3358 handler4 = throttle(handler4, wait); 3359 } 3360 return handler4; 3361 } 3362 function dotSyntax(subject) { 3363 return subject.replace(/-/g, "."); 3364 } 3365 function camelCase2(subject) { 3366 return subject.toLowerCase().replace(/-(\w)/g, (match, char) => char.toUpperCase()); 3367 } 3368 function isNumeric(subject) { 3369 return !Array.isArray(subject) && !isNaN(subject); 3370 } 3371 function kebabCase2(subject) { 3372 if ([" ", "_"].includes(subject)) 3373 return subject; 3374 return subject.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]/, "-").toLowerCase(); 3375 } 3376 function isKeyEvent(event) { 3377 return ["keydown", "keyup"].includes(event); 3378 } 3379 function isClickEvent(event) { 3380 return ["contextmenu", "click", "mouse"].some((i) => event.includes(i)); 3381 } 3382 function isListeningForASpecificKeyThatHasntBeenPressed(e, modifiers) { 3383 let keyModifiers = modifiers.filter((i) => { 3384 return !["window", "document", "prevent", "stop", "once", "capture", "self", "away", "outside", "passive", "preserve-scroll", "blur", "change", "lazy"].includes(i); 3385 }); 3386 if (keyModifiers.includes("debounce")) { 3387 let debounceIndex = keyModifiers.indexOf("debounce"); 3388 keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1); 3389 } 3390 if (keyModifiers.includes("throttle")) { 3391 let debounceIndex = keyModifiers.indexOf("throttle"); 3392 keyModifiers.splice(debounceIndex, isNumeric((keyModifiers[debounceIndex + 1] || "invalid-wait").split("ms")[0]) ? 2 : 1); 3393 } 3394 if (keyModifiers.length === 0) 3395 return false; 3396 if (keyModifiers.length === 1 && keyToModifiers(e.key).includes(keyModifiers[0])) 3397 return false; 3398 const systemKeyModifiers = ["ctrl", "shift", "alt", "meta", "cmd", "super"]; 3399 const selectedSystemKeyModifiers = systemKeyModifiers.filter((modifier) => keyModifiers.includes(modifier)); 3400 keyModifiers = keyModifiers.filter((i) => !selectedSystemKeyModifiers.includes(i)); 3401 if (selectedSystemKeyModifiers.length > 0) { 3402 const activelyPressedKeyModifiers = selectedSystemKeyModifiers.filter((modifier) => { 3403 if (modifier === "cmd" || modifier === "super") 3404 modifier = "meta"; 3405 return e[`${modifier}Key`]; 3406 }); 3407 if (activelyPressedKeyModifiers.length === selectedSystemKeyModifiers.length) { 3408 if (isClickEvent(e.type)) 3409 return false; 3410 if (keyToModifiers(e.key).includes(keyModifiers[0])) 3411 return false; 3412 } 3413 } 3414 return true; 3415 } 3416 function keyToModifiers(key) { 3417 if (!key) 3418 return []; 3419 key = kebabCase2(key); 3420 let modifierToKeyMap = { 3421 "ctrl": "control", 3422 "slash": "/", 3423 "space": " ", 3424 "spacebar": " ", 3425 "cmd": "meta", 3426 "esc": "escape", 3427 "up": "arrow-up", 3428 "down": "arrow-down", 3429 "left": "arrow-left", 3430 "right": "arrow-right", 3431 "period": ".", 3432 "comma": ",", 3433 "equal": "=", 3434 "minus": "-", 3435 "underscore": "_" 3436 }; 3437 modifierToKeyMap[key] = key; 3438 return Object.keys(modifierToKeyMap).map((modifier) => { 3439 if (modifierToKeyMap[modifier] === key) 3440 return modifier; 3441 }).filter((modifier) => modifier); 3442 } 3443 directive("model", (el, { modifiers, expression }, { effect: effect3, cleanup: cleanup2 }) => { 3444 let scopeTarget = el; 3445 if (modifiers.includes("parent")) { 3446 scopeTarget = findClosest(el, (element) => element !== el); 3447 } 3448 let evaluateGet = evaluateLater(scopeTarget, expression); 3449 let evaluateSet; 3450 if (typeof expression === "string") { 3451 evaluateSet = evaluateLater(scopeTarget, `${expression} = __placeholder`); 3452 } else if (typeof expression === "function" && typeof expression() === "string") { 3453 evaluateSet = evaluateLater(scopeTarget, `${expression()} = __placeholder`); 3454 } else { 3455 evaluateSet = () => { 3456 }; 3457 } 3458 let getValue = () => { 3459 let result; 3460 evaluateGet((value) => result = value); 3461 return isGetterSetter(result) ? result.get() : result; 3462 }; 3463 let setValue = (value) => { 3464 let result; 3465 evaluateGet((value2) => result = value2); 3466 if (isGetterSetter(result)) { 3467 result.set(value); 3468 } else { 3469 evaluateSet(() => { 3470 }, { 3471 scope: { "__placeholder": value } 3472 }); 3473 } 3474 }; 3475 if (typeof expression === "string" && el.type === "radio") { 3476 mutateDom(() => { 3477 if (!el.hasAttribute("name")) 3478 el.setAttribute("name", expression); 3479 }); 3480 } 3481 let hasChangeModifier = modifiers.includes("change") || modifiers.includes("lazy"); 3482 let hasBlurModifier = modifiers.includes("blur"); 3483 let hasEnterModifier = modifiers.includes("enter"); 3484 let hasExplicitEventModifiers = hasChangeModifier || hasBlurModifier || hasEnterModifier; 3485 let removeListener; 3486 if (isCloning) { 3487 removeListener = () => { 3488 }; 3489 } else if (hasExplicitEventModifiers) { 3490 let listeners2 = []; 3491 let syncValue = (e) => setValue(getInputValue(el, modifiers, e, getValue())); 3492 if (hasChangeModifier) { 3493 listeners2.push(on(el, "change", modifiers, syncValue)); 3494 } 3495 if (hasBlurModifier) { 3496 listeners2.push(on(el, "blur", modifiers, syncValue)); 3497 if (el.form) { 3498 let form = el.form; 3499 let syncCallback = () => syncValue({ target: el }); 3500 if (!form._x_pendingModelUpdates) 3501 form._x_pendingModelUpdates = []; 3502 form._x_pendingModelUpdates.push(syncCallback); 3503 cleanup2(() => { 3504 if (form._x_pendingModelUpdates) { 3505 form._x_pendingModelUpdates.splice(form._x_pendingModelUpdates.indexOf(syncCallback), 1); 3506 } 3507 }); 3508 } 3509 } 3510 if (hasEnterModifier) { 3511 listeners2.push(on(el, "keydown", modifiers, (e) => { 3512 if (e.key === "Enter") 3513 syncValue(e); 3514 })); 3515 } 3516 removeListener = () => listeners2.forEach((remove) => remove()); 3517 } else { 3518 let event = el.tagName.toLowerCase() === "select" || ["checkbox", "radio"].includes(el.type) ? "change" : "input"; 3519 removeListener = on(el, event, modifiers, (e) => { 3520 setValue(getInputValue(el, modifiers, e, getValue())); 3521 }); 3522 } 3523 if (modifiers.includes("fill")) { 3524 if ([void 0, null, ""].includes(getValue()) || isCheckbox(el) && Array.isArray(getValue()) || el.tagName.toLowerCase() === "select" && el.multiple) { 3525 setValue(getInputValue(el, modifiers, { target: el }, getValue())); 3526 } 3527 } 3528 if (!el._x_removeModelListeners) 3529 el._x_removeModelListeners = {}; 3530 el._x_removeModelListeners["default"] = removeListener; 3531 cleanup2(() => el._x_removeModelListeners["default"]()); 3532 if (el.form) { 3533 let removeResetListener = on(el.form, "reset", [], (e) => { 3534 nextTick(() => el._x_model && el._x_model.set(getInputValue(el, modifiers, { target: el }, getValue()))); 3535 }); 3536 cleanup2(() => removeResetListener()); 3537 } 3538 el._x_model = { 3539 get() { 3540 return getValue(); 3541 }, 3542 set(value) { 3543 setValue(value); 3544 }, 3545 setWithModifiers: addDebounceOrThrottle(modifiers, setValue) 3546 }; 3547 el._x_forceModelUpdate = (value) => { 3548 if (value === void 0 && typeof expression === "string" && expression.match(/\./)) 3549 value = ""; 3550 mutateDom(() => { 3551 if (isCheckbox(el)) { 3552 if (Array.isArray(value)) { 3553 el.checked = value.some((val) => val == el.value); 3554 } else { 3555 el.checked = !!value; 3556 } 3557 } else if (isRadio(el)) { 3558 if (typeof value === "boolean") { 3559 el.checked = safeParseBoolean(el.value) === value; 3560 } else { 3561 el.checked = el.value == value; 3562 } 3563 } else { 3564 bind(el, "value", value); 3565 } 3566 }); 3567 }; 3568 effect3(() => { 3569 let value = getValue(); 3570 if (modifiers.includes("unintrusive") && document.activeElement.isSameNode(el)) 3571 return; 3572 el._x_forceModelUpdate(value); 3573 }); 3574 }); 3575 function getInputValue(el, modifiers, event, currentValue) { 3576 return mutateDom(() => { 3577 if (event instanceof CustomEvent && event.detail !== void 0) 3578 return event.detail !== null && event.detail !== void 0 ? event.detail : event.target.value; 3579 else if (isCheckbox(el)) { 3580 if (Array.isArray(currentValue)) { 3581 let newValue = null; 3582 if (modifiers.includes("number")) { 3583 newValue = safeParseNumber(event.target.value); 3584 } else if (modifiers.includes("boolean")) { 3585 newValue = safeParseBoolean(event.target.value); 3586 } else { 3587 newValue = event.target.value; 3588 } 3589 return event.target.checked ? currentValue.includes(newValue) ? currentValue : currentValue.concat([newValue]) : currentValue.filter((el2) => !checkedAttrLooseCompare2(el2, newValue)); 3590 } else { 3591 return event.target.checked; 3592 } 3593 } else if (el.tagName.toLowerCase() === "select" && el.multiple) { 3594 if (modifiers.includes("number")) { 3595 return Array.from(event.target.selectedOptions).map((option) => { 3596 let rawValue = option.value || option.text; 3597 return safeParseNumber(rawValue); 3598 }); 3599 } else if (modifiers.includes("boolean")) { 3600 return Array.from(event.target.selectedOptions).map((option) => { 3601 let rawValue = option.value || option.text; 3602 return safeParseBoolean(rawValue); 3603 }); 3604 } 3605 return Array.from(event.target.selectedOptions).map((option) => { 3606 return option.value || option.text; 3607 }); 3608 } else { 3609 let newValue; 3610 if (isRadio(el)) { 3611 if (event.target.checked) { 3612 newValue = event.target.value; 3613 } else { 3614 newValue = currentValue; 3615 } 3616 } else { 3617 newValue = event.target.value; 3618 } 3619 if (modifiers.includes("number")) { 3620 return safeParseNumber(newValue); 3621 } else if (modifiers.includes("boolean")) { 3622 return safeParseBoolean(newValue); 3623 } else if (modifiers.includes("trim")) { 3624 return newValue.trim(); 3625 } else { 3626 return newValue; 3627 } 3628 } 3629 }); 3630 } 3631 function safeParseNumber(rawValue) { 3632 let number = rawValue ? parseFloat(rawValue) : null; 3633 return isNumeric2(number) ? number : rawValue; 3634 } 3635 function checkedAttrLooseCompare2(valueA, valueB) { 3636 return valueA == valueB; 3637 } 3638 function isNumeric2(subject) { 3639 return !Array.isArray(subject) && !isNaN(subject); 3640 } 3641 function isGetterSetter(value) { 3642 return value !== null && typeof value === "object" && typeof value.get === "function" && typeof value.set === "function"; 3643 } 3644 directive("cloak", (el) => queueMicrotask(() => mutateDom(() => el.removeAttribute(prefix("cloak"))))); 3645 addInitSelector(() => `[${prefix("init")}]`); 3646 directive("init", skipDuringClone((el, { expression }, { evaluate: evaluate22 }) => { 3647 if (typeof expression === "string") { 3648 return !!expression.trim() && evaluate22(expression, {}, false); 3649 } 3650 return evaluate22(expression, {}, false); 3651 })); 3652 directive("text", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => { 3653 let evaluate22 = evaluateLater2(expression); 3654 effect3(() => { 3655 evaluate22((value) => { 3656 mutateDom(() => { 3657 el.textContent = value; 3658 }); 3659 }); 3660 }); 3661 }); 3662 directive("html", (el, { expression }, { effect: effect3, evaluateLater: evaluateLater2 }) => { 3663 let evaluate22 = evaluateLater2(expression); 3664 effect3(() => { 3665 evaluate22((value) => { 3666 mutateDom(() => { 3667 el.innerHTML = value ?? ""; 3668 el._x_ignoreSelf = true; 3669 initTree(el); 3670 delete el._x_ignoreSelf; 3671 }); 3672 }); 3673 }); 3674 }); 3675 mapAttributes(startingWith(":", into(prefix("bind:")))); 3676 var handler2 = (el, { value, modifiers, expression, original }, { effect: effect3, cleanup: cleanup2 }) => { 3677 if (!value) { 3678 let bindingProviders = {}; 3679 injectBindingProviders(bindingProviders); 3680 let getBindings = evaluateLater(el, expression); 3681 getBindings((bindings) => { 3682 applyBindingsObject(el, bindings, original); 3683 }, { scope: bindingProviders }); 3684 return; 3685 } 3686 if (value === "key") 3687 return storeKeyForXFor(el, expression); 3688 if (el._x_inlineBindings && el._x_inlineBindings[value] && el._x_inlineBindings[value].extract) { 3689 return; 3690 } 3691 let evaluate22 = evaluateLater(el, expression); 3692 effect3(() => evaluate22((result) => { 3693 if (result === void 0 && typeof expression === "string" && expression.match(/\./)) { 3694 result = ""; 3695 } 3696 mutateDom(() => bind(el, value, result, modifiers)); 3697 })); 3698 cleanup2(() => { 3699 el._x_undoAddedClasses && el._x_undoAddedClasses(); 3700 el._x_undoAddedStyles && el._x_undoAddedStyles(); 3701 }); 3702 }; 3703 handler2.inline = (el, { value, modifiers, expression }) => { 3704 if (!value) 3705 return; 3706 if (!el._x_inlineBindings) 3707 el._x_inlineBindings = {}; 3708 el._x_inlineBindings[value] = { expression, extract: false }; 3709 }; 3710 directive("bind", handler2); 3711 function storeKeyForXFor(el, expression) { 3712 el._x_keyExpression = expression; 3713 } 3714 addRootSelector(() => `[${prefix("data")}]`); 3715 directive("data", (el, { expression }, { cleanup: cleanup2 }) => { 3716 if (shouldSkipRegisteringDataDuringClone(el)) 3717 return; 3718 expression = expression === "" ? "{}" : expression; 3719 let magicContext = {}; 3720 injectMagics(magicContext, el); 3721 let dataProviderContext = {}; 3722 injectDataProviders(dataProviderContext, magicContext); 3723 let data2 = evaluate(el, expression, { scope: dataProviderContext }); 3724 if (data2 === void 0 || data2 === true) 3725 data2 = {}; 3726 injectMagics(data2, el); 3727 let reactiveData = reactive(data2); 3728 initInterceptors(reactiveData); 3729 let undo = addScopeToNode(el, reactiveData); 3730 reactiveData["init"] && evaluate(el, reactiveData["init"]); 3731 cleanup2(() => { 3732 reactiveData["destroy"] && evaluate(el, reactiveData["destroy"]); 3733 undo(); 3734 }); 3735 }); 3736 interceptClone((from, to) => { 3737 if (from._x_dataStack) { 3738 to._x_dataStack = from._x_dataStack; 3739 to.setAttribute("data-has-alpine-state", true); 3740 } 3741 }); 3742 function shouldSkipRegisteringDataDuringClone(el) { 3743 if (!isCloning) 3744 return false; 3745 if (isCloningLegacy) 3746 return true; 3747 return el.hasAttribute("data-has-alpine-state"); 3748 } 3749 directive("show", (el, { modifiers, expression }, { effect: effect3 }) => { 3750 let evaluate22 = evaluateLater(el, expression); 3751 if (!el._x_doHide) 3752 el._x_doHide = () => { 3753 mutateDom(() => { 3754 el.style.setProperty("display", "none", modifiers.includes("important") ? "important" : void 0); 3755 }); 3756 }; 3757 if (!el._x_doShow) 3758 el._x_doShow = () => { 3759 mutateDom(() => { 3760 if (el.style.length === 1 && el.style.display === "none") { 3761 el.removeAttribute("style"); 3762 } else { 3763 el.style.removeProperty("display"); 3764 } 3765 }); 3766 }; 3767 let hide = () => { 3768 el._x_doHide(); 3769 el._x_isShown = false; 3770 }; 3771 let show = () => { 3772 el._x_doShow(); 3773 el._x_isShown = true; 3774 }; 3775 let clickAwayCompatibleShow = () => setTimeout(show); 3776 let toggle = once((value) => value ? show() : hide(), (value) => { 3777 if (typeof el._x_toggleAndCascadeWithTransitions === "function") { 3778 el._x_toggleAndCascadeWithTransitions(el, value, show, hide); 3779 } else { 3780 value ? clickAwayCompatibleShow() : hide(); 3781 } 3782 }); 3783 let oldValue; 3784 let firstTime = true; 3785 effect3(() => evaluate22((value) => { 3786 if (!firstTime && value === oldValue) 3787 return; 3788 if (modifiers.includes("immediate")) 3789 value ? clickAwayCompatibleShow() : hide(); 3790 toggle(value); 3791 oldValue = value; 3792 firstTime = false; 3793 })); 3794 }); 3795 directive("for", (el, { expression }, { effect: effect3, cleanup: cleanup2 }) => { 3796 let iteratorNames = parseForExpression(expression); 3797 let evaluateItems = evaluateLater(el, iteratorNames.items); 3798 let evaluateKey = evaluateLater(el, el._x_keyExpression || "index"); 3799 el._x_lookup = /* @__PURE__ */ new Map(); 3800 effect3(() => loop(el, iteratorNames, evaluateItems, evaluateKey)); 3801 cleanup2(() => { 3802 el._x_lookup.forEach((el2) => mutateDom(() => { 3803 destroyTree(el2); 3804 el2.remove(); 3805 })); 3806 delete el._x_lookup; 3807 }); 3808 }); 3809 function refreshScope(scope2) { 3810 return (newScope) => { 3811 Object.entries(newScope).forEach(([key, value]) => { 3812 scope2[key] = value; 3813 }); 3814 }; 3815 } 3816 function loop(templateEl, iteratorNames, evaluateItems, evaluateKey) { 3817 evaluateItems((items) => { 3818 if (isNumeric3(items)) 3819 items = Array.from({ length: items }, (_, i) => i + 1); 3820 if (items === void 0) 3821 items = []; 3822 if (items instanceof Set) 3823 items = Array.from(items); 3824 if (items instanceof Map) 3825 items = Array.from(items); 3826 let oldLookup = templateEl._x_lookup; 3827 let lookup = /* @__PURE__ */ new Map(); 3828 templateEl._x_lookup = lookup; 3829 let hasStringKeys = isObject22(items); 3830 let scopeEntries = Object.entries(items).map(([index, item]) => { 3831 if (!hasStringKeys) 3832 index = parseInt(index); 3833 let scope2 = getIterationScopeVariables(iteratorNames, item, index, items); 3834 let key; 3835 evaluateKey((innerKey) => { 3836 if (typeof innerKey === "object") 3837 warn("x-for key cannot be an object, it must be a string or an integer", templateEl); 3838 if (oldLookup.has(innerKey)) { 3839 lookup.set(innerKey, oldLookup.get(innerKey)); 3840 oldLookup.delete(innerKey); 3841 } 3842 key = innerKey; 3843 }, { scope: { index, ...scope2 } }); 3844 return [key, scope2]; 3845 }); 3846 mutateDom(() => { 3847 oldLookup.forEach((el) => { 3848 destroyTree(el); 3849 el.remove(); 3850 }); 3851 let added = /* @__PURE__ */ new Set(); 3852 let prev = templateEl; 3853 scopeEntries.forEach(([key, scope2]) => { 3854 if (lookup.has(key)) { 3855 let el = lookup.get(key); 3856 el._x_refreshXForScope(scope2); 3857 if (prev.nextElementSibling !== el) { 3858 if (prev.nextElementSibling) 3859 el.replaceWith(prev.nextElementSibling); 3860 prev.after(el); 3861 } 3862 prev = el; 3863 if (el._x_currentIfEl) { 3864 if (el.nextElementSibling !== el._x_currentIfEl) 3865 prev.after(el._x_currentIfEl); 3866 prev = el._x_currentIfEl; 3867 } 3868 return; 3869 } 3870 if (templateEl.content.children.length > 1) 3871 warn("x-for templates require a single root element, additional elements will be ignored.", templateEl); 3872 let clone2 = document.importNode(templateEl.content, true).firstElementChild; 3873 let reactiveScope = reactive(scope2); 3874 addScopeToNode(clone2, reactiveScope, templateEl); 3875 clone2._x_refreshXForScope = refreshScope(reactiveScope); 3876 lookup.set(key, clone2); 3877 added.add(clone2); 3878 prev.after(clone2); 3879 prev = clone2; 3880 }); 3881 skipDuringClone(() => added.forEach((clone2) => initTree(clone2)))(); 3882 }); 3883 }); 3884 } 3885 function parseForExpression(expression) { 3886 let forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/; 3887 let stripParensRE = /^\s*\(|\)\s*$/g; 3888 let forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/; 3889 let inMatch = expression.match(forAliasRE); 3890 if (!inMatch) 3891 return; 3892 let res = {}; 3893 res.items = inMatch[2].trim(); 3894 let item = inMatch[1].replace(stripParensRE, "").trim(); 3895 let iteratorMatch = item.match(forIteratorRE); 3896 if (iteratorMatch) { 3897 res.item = item.replace(forIteratorRE, "").trim(); 3898 res.index = iteratorMatch[1].trim(); 3899 if (iteratorMatch[2]) { 3900 res.collection = iteratorMatch[2].trim(); 3901 } 3902 } else { 3903 res.item = item; 3904 } 3905 return res; 3906 } 3907 function getIterationScopeVariables(iteratorNames, item, index, items) { 3908 let scopeVariables = {}; 3909 if (/^\[.*\]$/.test(iteratorNames.item) && Array.isArray(item)) { 3910 let names = iteratorNames.item.replace("[", "").replace("]", "").split(",").map((i) => i.trim()); 3911 names.forEach((name, i) => { 3912 scopeVariables[name] = item[i]; 3913 }); 3914 } else if (/^\{.*\}$/.test(iteratorNames.item) && !Array.isArray(item) && typeof item === "object") { 3915 let names = iteratorNames.item.replace("{", "").replace("}", "").split(",").map((i) => i.trim()); 3916 names.forEach((name) => { 3917 scopeVariables[name] = item[name]; 3918 }); 3919 } else { 3920 scopeVariables[iteratorNames.item] = item; 3921 } 3922 if (iteratorNames.index) 3923 scopeVariables[iteratorNames.index] = index; 3924 if (iteratorNames.collection) 3925 scopeVariables[iteratorNames.collection] = items; 3926 return scopeVariables; 3927 } 3928 function isNumeric3(subject) { 3929 return !Array.isArray(subject) && !isNaN(subject); 3930 } 3931 function isObject22(subject) { 3932 return typeof subject === "object" && !Array.isArray(subject); 3933 } 3934 function handler3() { 3935 } 3936 handler3.inline = (el, { expression }, { cleanup: cleanup2 }) => { 3937 let root = closestRoot(el); 3938 if (!root) 3939 return; 3940 if (!root._x_refs) 3941 root._x_refs = {}; 3942 root._x_refs[expression] = el; 3943 cleanup2(() => delete root._x_refs[expression]); 3944 }; 3945 directive("ref", handler3); 3946 directive("if", (el, { expression }, { effect: effect3, cleanup: cleanup2 }) => { 3947 if (el.tagName.toLowerCase() !== "template") 3948 warn("x-if can only be used on a <template> tag", el); 3949 let evaluate22 = evaluateLater(el, expression); 3950 let show = () => { 3951 if (el._x_currentIfEl) 3952 return el._x_currentIfEl; 3953 let clone2 = el.content.cloneNode(true).firstElementChild; 3954 addScopeToNode(clone2, {}, el); 3955 mutateDom(() => { 3956 el.after(clone2); 3957 skipDuringClone(() => initTree(clone2))(); 3958 }); 3959 el._x_currentIfEl = clone2; 3960 el._x_undoIf = () => { 3961 mutateDom(() => { 3962 destroyTree(clone2); 3963 clone2.remove(); 3964 }); 3965 delete el._x_currentIfEl; 3966 }; 3967 return clone2; 3968 }; 3969 let hide = () => { 3970 if (!el._x_undoIf) 3971 return; 3972 el._x_undoIf(); 3973 delete el._x_undoIf; 3974 }; 3975 effect3(() => evaluate22((value) => { 3976 value ? show() : hide(); 3977 })); 3978 cleanup2(() => el._x_undoIf && el._x_undoIf()); 3979 }); 3980 directive("id", (el, { expression }, { evaluate: evaluate22 }) => { 3981 let names = evaluate22(expression); 3982 names.forEach((name) => setIdRoot(el, name)); 3983 }); 3984 interceptClone((from, to) => { 3985 if (from._x_ids) { 3986 to._x_ids = from._x_ids; 3987 } 3988 }); 3989 mapAttributes(startingWith("@", into(prefix("on:")))); 3990 directive("on", skipDuringClone((el, { value, modifiers, expression }, { cleanup: cleanup2 }) => { 3991 let evaluate22 = expression ? evaluateLater(el, expression) : () => { 3992 }; 3993 if (el.tagName.toLowerCase() === "template") { 3994 if (!el._x_forwardEvents) 3995 el._x_forwardEvents = []; 3996 if (!el._x_forwardEvents.includes(value)) 3997 el._x_forwardEvents.push(value); 3998 } 3999 let removeListener = on(el, value, modifiers, (e) => { 4000 evaluate22(() => { 4001 }, { scope: { "$event": e }, params: [e] }); 4002 }); 4003 cleanup2(() => removeListener()); 4004 })); 4005 warnMissingPluginDirective("Collapse", "collapse", "collapse"); 4006 warnMissingPluginDirective("Intersect", "intersect", "intersect"); 4007 warnMissingPluginDirective("Focus", "trap", "focus"); 4008 warnMissingPluginDirective("Mask", "mask", "mask"); 4009 function warnMissingPluginDirective(name, directiveName, slug) { 4010 directive(directiveName, (el) => warn(`You can't use [x-${directiveName}] without first installing the "${name}" plugin here: https://alpinejs.dev/plugins/${slug}`, el)); 4011 } 4012 alpine_default.setEvaluator(normalEvaluator); 4013 alpine_default.setRawEvaluator(normalRawEvaluator); 4014 alpine_default.setReactivityEngine({ reactive: reactive2, effect: effect2, release: stop, raw: toRaw }); 4015 var src_default = alpine_default; 4016 var module_default = src_default; 4017 4018
4018// js/features/supportEntangle.js 4019 function generateEntangleFunction(component, cleanup2) { 4020 if (!cleanup2) 4021 cleanup2 = () => { 4022 }; 4023 return (name, live = false) => { 4024 let isLive = live; 4025 let livewireProperty = name; 4026 let livewireComponent = component.$wire; 4027 let livewirePropertyValue = livewireComponent.get(livewireProperty); 4028 let interceptor2 = module_default.interceptor((initialValue, getter, setter, path, key) => { 4029 if (typeof livewirePropertyValue === "undefined") { 4030 console.error(`Livewire Entangle Error: Livewire property ['${livewireProperty}'] cannot be found on component: ['${component.name}']`); 4031 return; 4032 } 4033 let release2 = module_default.entangle({ 4034 get() { 4035 return livewireComponent.get(name); 4036 }, 4037 set(value) { 4038 livewireComponent.set(name, value, isLive); 4039 } 4040 }, { 4041 get() { 4042 return getter(); 4043 }, 4044 set(value) { 4045 setter(value); 4046 } 4047 }); 4048 cleanup2(() => release2()); 4049 return cloneIfObject2(livewireComponent.get(name)); 4050 }, (obj) => { 4051 Object.defineProperty(obj, "live", { 4052 get() { 4053 isLive = true; 4054 return obj; 4055 } 4056 }); 4057 }); 4058 return interceptor2(livewirePropertyValue); 4059 }; 4060 } 4061 function cloneIfObject2(value) { 4062 return typeof value === "object" ? JSON.parse(JSON.stringify(value)) : value; 4063 } 4064 4065
4065// js/hooks.js 4066 var listeners = []; 4067 function on2(name, callback) { 4068 if (!listeners[name]) 4069 listeners[name] = []; 4070 listeners[name].push(callback); 4071 return () => { 4072 listeners[name] = listeners[name].filter((i) => i !== callback); 4073 }; 4074 } 4075 function trigger2(name, ...params) { 4076 let callbacks = listeners[name] || []; 4077 let finishers = []; 4078 for (let i = 0; i < callbacks.length; i++) { 4079 let finisher = callbacks[i](...params); 4080 if (isFunction(finisher)) 4081 finishers.push(finisher); 4082 } 4083 return (result) => { 4084 return runFinishers(finishers, result); 4085 }; 4086 } 4087 async function triggerAsync(name, ...params) { 4088 let callbacks = listeners[name] || []; 4089 let finishers = []; 4090 for (let i = 0; i < callbacks.length; i++) { 4091 let finisher = await callbacks[i](...params); 4092 if (isFunction(finisher)) 4093 finishers.push(finisher); 4094 } 4095 return (result) => { 4096 return runFinishers(finishers, result); 4097 }; 4098 } 4099 function runFinishers(finishers, result) { 4100 let latest = result; 4101 for (let i = 0; i < finishers.length; i++) { 4102 let iResult = finishers[i](latest); 4103 if (iResult !== void 0) { 4104 latest = iResult; 4105 } 4106 } 4107 return latest; 4108 } 4109 4110
4110// js/request/modal.js 4111 function showHtmlModal(html) { 4112 let page = document.createElement("html"); 4113 page.innerHTML = html; 4114 page.querySelectorAll("a").forEach((a) => a.setAttribute("target", "_top")); 4115 let modal = document.getElementById("livewire-error"); 4116 if (typeof modal != "undefined" && modal != null) { 4117 modal.innerHTML = ""; 4118 } else { 4119 modal = document.createElement("dialog"); 4120 modal.id = "livewire-error"; 4121 modal.style.margin = "50px"; 4122 modal.style.width = "calc(100% - 100px)"; 4123 modal.style.height = "calc(100% - 100px)"; 4124 modal.style.borderRadius = "5px"; 4125 modal.style.padding = "0px"; 4126 } 4127 let iframe = document.createElement("iframe"); 4128 iframe.style.backgroundColor = "#17161A"; 4129 iframe.style.borderRadius = "5px"; 4130 iframe.style.width = "100%"; 4131 iframe.style.height = "100%"; 4132 modal.appendChild(iframe); 4133 document.body.prepend(modal); 4134 document.body.style.overflow = "hidden"; 4135 iframe.contentWindow.document.open(); 4136 iframe.contentWindow.document.write(page.outerHTML); 4137 iframe.contentWindow.document.close(); 4138 modal.addEventListener("click", () => hideHtmlModal(modal)); 4139 modal.addEventListener("close", () => cleanupModal(modal)); 4140 modal.showModal(); 4141 modal.focus(); 4142 modal.blur(); 4143 } 4144 function hideHtmlModal(modal) { 4145 modal.close(); 4146 } 4147 function cleanupModal(modal) { 4148 modal.outerHTML = ""; 4149 document.body.style.overflow = "visible"; 4150 } 4151 4152
4152// js/request/pool.js 4153 var RequestPool = class { 4154 constructor() { 4155 this.commits = /* @__PURE__ */ new Set(); 4156 } 4157 add(commit) { 4158 this.commits.add(commit); 4159 } 4160 delete(commit) { 4161 this.commits.delete(commit); 4162 } 4163 hasCommitFor(component) { 4164 return !!this.findCommitByComponent(component); 4165 } 4166 findCommitByComponent(component) { 4167 for (let [idx, commit] of this.commits.entries()) { 4168 if (commit.component === component) 4169 return commit; 4170 } 4171 } 4172 shouldHoldCommit(commit) { 4173 return !commit.isolate; 4174 } 4175 empty() { 4176 return this.commits.size === 0; 4177 } 4178 async send() { 4179 this.prepare(); 4180 await sendRequest(this); 4181 } 4182 prepare() { 4183 this.commits.forEach((i) => i.prepare()); 4184 } 4185 payload() { 4186 let commitPayloads = []; 4187 let successReceivers = []; 4188 let failureReceivers = []; 4189 this.commits.forEach((commit) => { 4190 let [payload, succeed2, fail2] = commit.toRequestPayload(); 4191 commitPayloads.push(payload); 4192 successReceivers.push(succeed2); 4193 failureReceivers.push(fail2); 4194 }); 4195 let succeed = (components2) => successReceivers.forEach((receiver) => receiver(components2.shift())); 4196 let fail = () => failureReceivers.forEach((receiver) => receiver()); 4197 return [commitPayloads, succeed, fail]; 4198 } 4199 }; 4200 4201
4201// js/request/commit.js 4202 var Commit = class { 4203 constructor(component) { 4204 this.component = component; 4205 this.isolate = false; 4206 this.calls = []; 4207 this.receivers = []; 4208 this.resolvers = []; 4209 } 4210 addResolver(resolver) { 4211 this.resolvers.push(resolver); 4212 } 4213 addCall(method, params, receiver) { 4214 this.calls.push({ 4215 path: "", 4216 method, 4217 params, 4218 handleReturn(value) { 4219 receiver(value); 4220 } 4221 }); 4222 } 4223 prepare() { 4224 trigger2("commit.prepare", { component: this.component }); 4225 } 4226 getEncodedSnapshotWithLatestChildrenMergedIn() { 4227 let { snapshotEncoded, children, snapshot } = this.component; 4228 let childIds = children.map((child) => child.id); 4229 let filteredChildren = Object.fromEntries(Object.entries(snapshot.memo.children).filter(([key, value]) => childIds.includes(value[1]))); 4230 return snapshotEncoded.replace(/"children":\{[^}]*\}/, `"children":${JSON.stringify(filteredChildren)}`); 4231 } 4232 toRequestPayload() { 4233 let propertiesDiff = diff(this.component.canonical, this.component.ephemeral); 4234 let updates = this.component.mergeQueuedUpdates(propertiesDiff); 4235 let snapshotEncoded = this.getEncodedSnapshotWithLatestChildrenMergedIn(); 4236 let payload = { 4237 snapshot: snapshotEncoded, 4238 updates, 4239 calls: this.calls.map((i) => ({ 4240 path: i.path, 4241 method: i.method, 4242 params: i.params 4243 })) 4244 }; 4245 let succeedCallbacks = []; 4246 let failCallbacks = []; 4247 let respondCallbacks = []; 4248 let succeed = (fwd) => succeedCallbacks.forEach((i) => i(fwd)); 4249 let fail = () => failCallbacks.forEach((i) => i()); 4250 let respond = () => respondCallbacks.forEach((i) => i()); 4251 let finishTarget = trigger2("commit", { 4252 component: this.component, 4253 commit: payload, 4254 succeed: (callback) => { 4255 succeedCallbacks.push(callback); 4256 }, 4257 fail: (callback) => { 4258 failCallbacks.push(callback); 4259 }, 4260 respond: (callback) => { 4261 respondCallbacks.push(callback); 4262 } 4263 }); 4264 let handleResponse = (response) => { 4265 let { snapshot, effects } = response; 4266 respond(); 4267 this.component.mergeNewSnapshot(snapshot, effects, updates); 4268 this.component.processEffects(this.component.effects); 4269 if (effects["returns"]) { 4270 let returns = effects["returns"]; 4271 let returnHandlerStack = this.calls.map(({ handleReturn }) => handleReturn); 4272 returnHandlerStack.forEach((handleReturn, index) => { 4273 handleReturn(returns[index]); 4274 }); 4275 } 4276 let parsedSnapshot = JSON.parse(snapshot); 4277 finishTarget({ snapshot: parsedSnapshot, effects }); 4278 this.resolvers.forEach((i) => i()); 4279 succeed(response); 4280 }; 4281 let handleFailure = () => { 4282 respond(); 4283 fail(); 4284 }; 4285 return [payload, handleResponse, handleFailure]; 4286 } 4287 }; 4288 4289
4289// js/request/bus.js 4290 var CommitBus = class { 4291 constructor() { 4292 this.commits = /* @__PURE__ */ new Set(); 4293 this.pools = /* @__PURE__ */ new Set(); 4294 } 4295 add(component) { 4296 let commit = this.findCommitOr(component, () => { 4297 let newCommit = new Commit(component); 4298 this.commits.add(newCommit); 4299 return newCommit; 4300 }); 4301 bufferPoolingForFiveMs(commit, () => { 4302 let pool = this.findPoolWithComponent(commit.component); 4303 if (!pool) { 4304 this.createAndSendNewPool(); 4305 } 4306 }); 4307 return commit; 4308 } 4309 findCommitOr(component, callback) { 4310 for (let [idx, commit] of this.commits.entries()) { 4311 if (commit.component === component) { 4312 return commit; 4313 } 4314 } 4315 return callback(); 4316 } 4317 findPoolWithComponent(component) { 4318 for (let [idx, pool] of this.pools.entries()) { 4319 if (pool.hasCommitFor(component)) 4320 return pool; 4321 } 4322 } 4323 createAndSendNewPool() { 4324 trigger2("commit.pooling", { commits: this.commits }); 4325 let pools = this.corraleCommitsIntoPools(); 4326 trigger2("commit.pooled", { pools }); 4327 pools.forEach((pool) => { 4328 if (pool.empty()) 4329 return; 4330 this.pools.add(pool); 4331 pool.send().then(() => { 4332 this.pools.delete(pool); 4333 queueMicrotask(() => { 4334 this.sendAnyQueuedCommits(); 4335 }); 4336 }); 4337 }); 4338 } 4339 corraleCommitsIntoPools() { 4340 let pools = /* @__PURE__ */ new Set(); 4341 for (let [idx, commit] of this.commits.entries()) { 4342 if (this.findPoolWithComponent(commit.component)) 4343 continue; 4344 let hasFoundPool = false;
4345 pools.forEach((pool) => { 4346 if (pool.shouldHoldCommit(commit)) { 4347 pool.add(commit); 4348 hasFoundPool = true; 4349 } 4350 }); 4351 if (!hasFoundPool) { 4352 let newPool = new RequestPool(); 4353 newPool.add(commit); 4354 pools.add(newPool); 4355 } 4356 this.commits.delete(commit); 4357 } 4358 return pools; 4359 } 4360 sendAnyQueuedCommits() { 4361 if (this.commits.size > 0) { 4362 this.createAndSendNewPool(); 4363 } 4364 } 4365 }; 4366 var buffersByCommit = /* @__PURE__ */ new WeakMap(); 4367 function bufferPoolingForFiveMs(commit, callback) { 4368 if (buffersByCommit.has(commit)) 4369 return; 4370 buffersByCommit.set(commit, setTimeout(() => { 4371 callback(); 4372 buffersByCommit.delete(commit); 4373 }, 5)); 4374 } 4375 4376
4376// js/request/index.js 4377 var commitBus = new CommitBus(); 4378 async function requestCommit(component) { 4379 let commit = commitBus.add(component); 4380 let promise = new Promise((resolve) => { 4381 commit.addResolver(resolve); 4382 }); 4383 promise.commit = commit; 4384 return promise; 4385 } 4386 async function requestCall(component, method, params) { 4387 let commit = commitBus.add(component); 4388 let promise = new Promise((resolve) => { 4389 commit.addCall(method, params, (value) => resolve(value)); 4390 }); 4391 promise.commit = commit; 4392 return promise; 4393 } 4394 async function sendRequest(pool) { 4395 let [payload, handleSuccess, handleFailure] = pool.payload(); 4396 let options = { 4397 method: "POST", 4398 body: JSON.stringify({ 4399 _token: getCsrfToken(), 4400 components: payload 4401 }), 4402 headers: { 4403 "Content-type": "application/json", 4404 "X-Livewire": "" 4405 } 4406 }; 4407 let succeedCallbacks = []; 4408 let failCallbacks = []; 4409 let respondCallbacks = []; 4410 let succeed = (fwd) => succeedCallbacks.forEach((i) => i(fwd)); 4411 let fail = (fwd) => failCallbacks.forEach((i) => i(fwd)); 4412 let respond = (fwd) => respondCallbacks.forEach((i) => i(fwd)); 4413 let finishProfile = trigger2("request.profile", options); 4414 let updateUri = getUpdateUri(); 4415 trigger2("request", { 4416 url: updateUri, 4417 options, 4418 payload: options.body, 4419 respond: (i) => respondCallbacks.push(i), 4420 succeed: (i) => succeedCallbacks.push(i), 4421 fail: (i) => failCallbacks.push(i) 4422 }); 4423 let response; 4424 try { 4425 response = await fetch(updateUri, options); 4426 } catch (e) { 4427 finishProfile({ content: "{}", failed: true }); 4428 handleFailure(); 4429 fail({ 4430 status: 503, 4431 content: null, 4432 preventDefault: () => { 4433 } 4434 }); 4435 return; 4436 } 4437 let mutableObject = { 4438 status: response.status, 4439 response 4440 }; 4441 respond(mutableObject); 4442 response = mutableObject.response; 4443 let content = await response.text(); 4444 if (!response.ok) { 4445 finishProfile({ content: "{}", failed: true }); 4446 let preventDefault = false;
4447 handleFailure(); 4448 fail({ 4449 status: response.status, 4450 content, 4451 preventDefault: () => preventDefault = true 4452 }); 4453 if (preventDefault) 4454 return; 4455 if (response.status === 419) { 4456 handlePageExpiry(); 4457 } 4458 return showFailureModal(content); 4459 } 4460 if (response.redirected) { 4461 window.location.href = response.url; 4462 } 4463 if (contentIsFromDump(content)) { 4464 let dump; 4465 [dump, content] = splitDumpFromContent(content); 4466 showHtmlModal(dump); 4467 finishProfile({ content: "{}", failed: true }); 4468 } else { 4469 finishProfile({ content, failed: false }); 4470 } 4471 let { components: components2, assets } = JSON.parse(content); 4472 await triggerAsync("payload.intercept", { components: components2, assets }); 4473 await handleSuccess(components2); 4474 succeed({ status: response.status, json: JSON.parse(content) }); 4475 } 4476 function handlePageExpiry() { 4477 confirm("This page has expired.\nWould you like to refresh the page?") && window.location.reload(); 4478 } 4479 function showFailureModal(content) { 4480 let html = content; 4481 showHtmlModal(html); 4482 } 4483 4484 // js/$wire.js 4485 var properties = {}; 4486 var fallback; 4487 function wireProperty(name, callback, component = null) { 4488 properties[name] = callback; 4489 } 4490 function wireFallback(callback) { 4491 fallback = callback; 4492 } 4493 var aliases = { 4494 "on": "$on", 4495 "el": "$el", 4496 "id": "$id", 4497 "js": "$js", 4498 "get": "$get", 4499 "set": "$set", 4500 "call": "$call", 4501 "hook": "$hook", 4502 "commit": "$commit", 4503 "watch": "$watch", 4504 "entangle": "$entangle", 4505 "dispatch": "$dispatch", 4506 "dispatchTo": "$dispatchTo", 4507 "dispatchSelf": "$dispatchSelf", 4508 "upload": "$upload", 4509 "uploadMultiple": "$uploadMultiple", 4510 "removeUpload": "$removeUpload", 4511 "cancelUpload": "$cancelUpload" 4512 }; 4513 function generateWireObject(component, state) { 4514 return new Proxy({}, { 4515 get(target, property) { 4516 if (property === "__instance") 4517 return component; 4518 if (property in aliases) { 4519 return getProperty(component, aliases[property]); 4520 } else if (property in properties) { 4521 return getProperty(component, property); 4522 } else if (property in state) { 4523 return state[property]; 4524 } else if (!["then"].includes(property)) { 4525 return getFallback(component)(property); 4526 } 4527 }, 4528 set(target, property, value) { 4529 if (property in state) { 4530 state[property] = value; 4531 } 4532 return true; 4533 } 4534 }); 4535 } 4536 function getProperty(component, name) { 4537 return properties[name](component); 4538 } 4539 function getFallback(component) { 4540 return fallback(component); 4541 } 4542 module_default.magic("wire", (el, { cleanup: cleanup2 }) => {
4543 let component; 4544 return new Proxy({}, { 4545 get(target, property) { 4546 if (!component) { 4547 try { 4548 component = closestComponent(el); 4549 } catch (e) { 4550 return () => { 4551 }; 4552 } 4553 } 4554 if (["$entangle", "entangle"].includes(property)) { 4555 return generateEntangleFunction(component, cleanup2); 4556 } 4557 return component.$wire[property]; 4558 }, 4559 set(target, property, value) { 4560 if (!component) { 4561 try { 4562 component = closestComponent(el); 4563 } catch (e) { 4564 return true; 4565 } 4566 } 4567 component.$wire[property] = value; 4568 return true; 4569 } 4570 }); 4571 }); 4572 wireProperty("__instance", (component) => component); 4573 wireProperty("$get", (component) => (property, reactive3 = true) => dataGet(reactive3 ? component.reactive : component.ephemeral, property)); 4574 wireProperty("$el", (component) => { 4575 return component.el; 4576 }); 4577 wireProperty("$id", (component) => { 4578 return component.id; 4579 }); 4580 wireProperty("$js", (component) => { 4581 let fn = component.addJsAction.bind(component); 4582 let jsActions = component.getJsActions(); 4583 Object.keys(jsActions).forEach((name) => { 4584 fn[name] = component.getJsAction(name); 4585 }); 4586 return fn; 4587 }); 4588 wireProperty("$set", (component) => async (property, value, live = true) => { 4589 dataSet(component.reactive, property, value); 4590 if (live) { 4591 component.queueUpdate(property, value); 4592 return await requestCommit(component); 4593 } 4594 return Promise.resolve(); 4595 }); 4596 wireProperty("$call", (component) => async (method, ...params) => { 4597 return await component.$wire[method](...params); 4598 }); 4599 wireProperty("$entangle", (component) => (name, live = false) => { 4600 return generateEntangleFunction(component)(name, live); 4601 }); 4602 wireProperty("$toggle", (component) => (name, live = true) => { 4603 return component.$wire.set(name, !component.$wire.get(name), live); 4604 }); 4605 wireProperty("$watch", (component) => (path, callback) => { 4606 let getter = () => { 4607 return dataGet(component.reactive, path); 4608 }; 4609 let unwatch = module_default.watch(getter, callback); 4610 component.addCleanup(unwatch); 4611 }); 4612 wireProperty("$refresh", (component) => component.$wire.$commit); 4613 wireProperty("$commit", (component) => async () => await requestCommit(component)); 4614 wireProperty("$on", (component) => (...params) => listen2(component, ...params)); 4615 wireProperty("$hook", (component) => (name, callback) => { 4616 let unhook = on2(name, ({ component: hookComponent, ...params }) => { 4617 if (hookComponent === void 0) 4618 return callback(params); 4619 if (hookComponent.id === component.id) 4620 return callback({ component: hookComponent, ...params }); 4621 }); 4622 component.addCleanup(unhook); 4623 return unhook; 4624 }); 4625 wireProperty("$dispatch", (component) => (...params) => dispatch3(component, ...params)); 4626 wireProperty("$dispatchSelf", (component) => (...params) => dispatchSelf(component, ...params)); 4627 wireProperty("$dispatchTo", () => (...params) => dispatchTo(...params)); 4628 wireProperty("$upload", (component) => (...params) => upload(component, ...params)); 4629 wireProperty("$uploadMultiple", (component) => (...params) => uploadMultiple(component, ...params)); 4630 wireProperty("$removeUpload", (component) => (...params) => removeUpload(component, ...params)); 4631 wireProperty("$cancelUpload", (component) => (...params) => cancelUpload(component, ...params)); 4632 var parentMemo = /* @__PURE__ */ new WeakMap(); 4633 wireProperty("$parent", (component) => { 4634 if (parentMemo.has(component)) 4635 return parentMemo.get(component).$wire; 4636 let parent = component.parent; 4637 parentMemo.set(component, parent); 4638 return parent.$wire; 4639 }); 4640 var overriddenMethods = /* @__PURE__ */ new WeakMap(); 4641 function overrideMethod(component, method, callback) { 4642 if (!overriddenMethods.has(component)) { 4643 overriddenMethods.set(component, {}); 4644 } 4645 let obj = overriddenMethods.get(component); 4646 obj[method] = callback; 4647 overriddenMethods.set(component, obj); 4648 } 4649 wireFallback((component) => (property) => async (...params) => { 4650 if (params.length === 1 && params[0] instanceof Event) { 4651 params = []; 4652 } 4653 if (overriddenMethods.has(component)) { 4654 let overrides = overriddenMethods.get(component); 4655 if (typeof overrides[property] === "function") { 4656 return overrides[property](params); 4657 } 4658 } 4659 return await requestCall(component, property, params); 4660 }); 4661 4662
4662// js/component.js 4663 var Component = class { 4664 constructor(el) { 4665 if (el.__livewire) 4666 throw "Component already initialized"; 4667 el.__livewire = this; 4668 this.el = el; 4669 this.id = el.getAttribute("wire:id"); 4670 this.__livewireId = this.id; 4671 this.snapshotEncoded = el.getAttribute("wire:snapshot"); 4672 this.snapshot = JSON.parse(this.snapshotEncoded); 4673 if (!this.snapshot) { 4674 throw `Snapshot missing on Livewire component with id: ` + this.id; 4675 } 4676 this.name = this.snapshot.memo.name; 4677 this.effects = JSON.parse(el.getAttribute("wire:effects")); 4678 this.originalEffects = deepClone(this.effects); 4679 this.canonical = extractData(deepClone(this.snapshot.data)); 4680 this.ephemeral = extractData(deepClone(this.snapshot.data)); 4681 this.reactive = Alpine.reactive(this.ephemeral); 4682 this.queuedUpdates = {}; 4683 this.jsActions = {}; 4684 this.$wire = generateWireObject(this, this.reactive); 4685 this.cleanups = []; 4686 this.processEffects(this.effects); 4687 } 4688 mergeNewSnapshot(snapshotEncoded, effects, updates = {}) { 4689 let snapshot = JSON.parse(snapshotEncoded); 4690 let oldCanonical = deepClone(this.canonical); 4691 let updatedOldCanonical = this.applyUpdates(oldCanonical, updates); 4692 let newCanonical = extractData(deepClone(snapshot.data)); 4693 let dirty = diff(updatedOldCanonical, newCanonical); 4694 this.snapshotEncoded = snapshotEncoded; 4695 this.snapshot = snapshot; 4696 this.effects = effects; 4697 this.canonical = extractData(deepClone(snapshot.data)); 4698 let newData = extractData(deepClone(snapshot.data)); 4699 Object.entries(dirty).forEach(([key, value]) => { 4700 let rootKey = key.split(".")[0]; 4701 this.reactive[rootKey] = newData[rootKey]; 4702 }); 4703 return dirty; 4704 } 4705 queueUpdate(propertyName, value) { 4706 this.queuedUpdates[propertyName] = value; 4707 } 4708 mergeQueuedUpdates(diff2) { 4709 Object.entries(this.queuedUpdates).forEach(([updateKey, updateValue]) => { 4710 Object.entries(diff2).forEach(([diffKey, diffValue]) => { 4711 if (diffKey.startsWith(updateValue)) { 4712 delete diff2[diffKey]; 4713 } 4714 }); 4715 diff2[updateKey] = updateValue; 4716 }); 4717 this.queuedUpdates = []; 4718 return diff2; 4719 } 4720 applyUpdates(object, updates) { 4721 for (let key in updates) { 4722 dataSet(object, key, updates[key]); 4723 } 4724 return object; 4725 } 4726 replayUpdate(snapshot, html) { 4727 let effects = { ...this.effects, html }; 4728 this.mergeNewSnapshot(JSON.stringify(snapshot), effects); 4729 this.processEffects({ html }); 4730 } 4731 processEffects(effects) { 4732 trigger2("effects", this, effects); 4733 trigger2("effect", { 4734 component: this, 4735 effects, 4736 cleanup: (i) => this.addCleanup(i) 4737 }); 4738 } 4739 get children() { 4740 let meta = this.snapshot.memo; 4741 let childIds = Object.values(meta.children).map((i) => i[1]); 4742 return childIds.filter((id) => hasComponent(id)).map((id) => findComponent(id)); 4743 } 4744 get parent() { 4745 return closestComponent(this.el.parentElement); 4746 } 4747 get isLazy() { 4748 return this.snapshot.memo.lazyLoaded !== void 0; 4749 } 4750 get hasBeenLazyLoaded() { 4751 return this.snapshot.memo.lazyLoaded === true; 4752 } 4753 inscribeSnapshotAndEffectsOnElement() { 4754 let el = this.el; 4755 el.setAttribute("wire:snapshot", this.snapshotEncoded); 4756 let effects = this.originalEffects.listeners ? { listeners: this.originalEffects.listeners } : {}; 4757 if (this.originalEffects.url) { 4758 effects.url = this.originalEffects.url; 4759 } 4760 if (this.originalEffects.scripts) { 4761 effects.scripts = this.originalEffects.scripts; 4762 } 4763 el.setAttribute("wire:effects", JSON.stringify(effects)); 4764 } 4765 addJsAction(name, action) { 4766 this.jsActions[name] = action; 4767 } 4768 hasJsAction(name) { 4769 return this.jsActions[name] !== void 0; 4770 } 4771 getJsAction(name) { 4772 return this.jsActions[name].bind(this.$wire); 4773 } 4774 getJsActions() { 4775 return this.jsActions; 4776 } 4777 addCleanup(cleanup2) { 4778 this.cleanups.push(cleanup2); 4779 } 4780 cleanup() { 4781 delete this.el.__livewire; 4782 while (this.cleanups.length > 0) { 4783 this.cleanups.pop()(); 4784 } 4785 } 4786 }; 4787 4788
4788// js/store.js 4789 var components = {}; 4790 function initComponent(el) { 4791 let component = new Component(el); 4792 if (components[component.id]) 4793 throw "Component already registered"; 4794 let cleanup2 = (i) => component.addCleanup(i); 4795 trigger2("component.init", { component, cleanup: cleanup2 }); 4796 components[component.id] = component; 4797 return component; 4798 } 4799 function destroyComponent(id) { 4800 let component = components[id]; 4801 if (!component) 4802 return; 4803 component.cleanup(); 4804 delete components[id]; 4805 } 4806 function hasComponent(id) { 4807 return !!components[id]; 4808 } 4809 function findComponent(id) { 4810 let component = components[id]; 4811 if (!component) 4812 throw "Component not found: " + id; 4813 return component; 4814 } 4815 function closestComponent(el, strict = true) { 4816 let closestRoot2 = Alpine.findClosest(el, (i) => i.__livewire); 4817 if (!closestRoot2) { 4818 if (strict) 4819 throw "Could not find Livewire component in DOM tree"; 4820 return; 4821 } 4822 return closestRoot2.__livewire; 4823 } 4824 function componentsByName(name) { 4825 return Object.values(components).filter((component) => { 4826 return name == component.name; 4827 }); 4828 } 4829 function getByName(name) { 4830 return componentsByName(name).map((i) => i.$wire); 4831 } 4832 function find(id) {
4833 let component = components[id]; 4834 return component && component.$wire; 4835 } 4836 function first() { 4837 return Object.values(components)[0].$wire; 4838 } 4839 function all() { 4840 return Object.values(components); 4841 } 4842 4843
4843// js/events.js 4844 function dispatch3(component, name, params) { 4845 dispatchEvent(component.el, name, params); 4846 } 4847 function dispatchGlobal(name, params) { 4848 dispatchEvent(window, name, params); 4849 } 4850 function dispatchSelf(component, name, params) { 4851 dispatchEvent(component.el, name, params, false); 4852 } 4853 function dispatchTo(componentName, name, params) { 4854 let targets = componentsByName(componentName); 4855 targets.forEach((target) => { 4856 dispatchEvent(target.el, name, params, false); 4857 }); 4858 } 4859 function listen2(component, name, callback) { 4860 component.el.addEventListener(name, (e) => { 4861 callback(e.detail); 4862 }); 4863 } 4864 function on3(eventName, callback) { 4865 let handler4 = (e) => { 4866 if (!e.__livewire) 4867 return; 4868 callback(e.detail); 4869 }; 4870 window.addEventListener(eventName, handler4); 4871 return () => { 4872 window.removeEventListener(eventName, handler4); 4873 }; 4874 } 4875 function dispatchEvent(target, name, params, bubbles = true) { 4876 if (typeof params === "string") { 4877 params = [params]; 4878 } 4879 let e = new CustomEvent(name, { bubbles, detail: params }); 4880 e.__livewire = { name, params, receivedBy: [] }; 4881 target.dispatchEvent(e); 4882 } 4883 4884
4884// js/directives.js 4885 var customDirectiveNames = /* @__PURE__ */ new Set(); 4886 function matchesForLivewireDirective(attributeName) { 4887 return attributeName.match(new RegExp("wire:")); 4888 } 4889 function extractDirective(el, name) { 4890 let [value, ...modifiers] = name.replace(new RegExp("wire:"), "").split("."); 4891 return new Directive(value, modifiers, name, el); 4892 } 4893 function directive2(name, callback) { 4894 if (customDirectiveNames.has(name)) 4895 return; 4896 customDirectiveNames.add(name); 4897 on2("directive.init", ({ el, component, directive: directive3, cleanup: cleanup2 }) => { 4898 if (directive3.value === name) { 4899 callback({ 4900 el, 4901 directive: directive3, 4902 component, 4903 $wire: component.$wire, 4904 cleanup: cleanup2 4905 }); 4906 } 4907 }); 4908 } 4909 function globalDirective(name, callback) { 4910 if (customDirectiveNames.has(name)) 4911 return; 4912 customDirectiveNames.add(name); 4913 on2("directive.global.init", ({ el, directive: directive3, cleanup: cleanup2 }) => { 4914 if (directive3.value === name) { 4915 callback({ el, directive: directive3, cleanup: cleanup2 }); 4916 } 4917 }); 4918 } 4919 function getDirectives(el) { 4920 return new DirectiveManager(el); 4921 } 4922 function customDirectiveHasBeenRegistered(name) { 4923 return customDirectiveNames.has(name); 4924 } 4925 var DirectiveManager = class { 4926 constructor(el) { 4927 this.el = el; 4928 this.directives = this.extractTypeModifiersAndValue(); 4929 } 4930 all() { 4931 return this.directives; 4932 } 4933 has(value) { 4934 return this.directives.map((directive3) => directive3.value).includes(value); 4935 } 4936 missing(value) { 4937 return !this.has(value); 4938 } 4939 get(value) { 4940 return this.directives.find((directive3) => directive3.value === value); 4941 } 4942 extractTypeModifiersAndValue() { 4943 return Array.from(this.el.getAttributeNames().filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(this.el, name))); 4944 } 4945 }; 4946 var Directive = class { 4947 constructor(value, modifiers, rawName, el) { 4948 this.rawName = this.raw = rawName; 4949 this.el = el; 4950 this.eventContext; 4951 this.value = value; 4952 this.modifiers = modifiers; 4953 this.expression = this.el.getAttribute(this.rawName); 4954 } 4955 get method() { 4956 const methods = this.parseOutMethodsAndParams(this.expression); 4957 return methods[0].method; 4958 } 4959 get methods() { 4960 return this.parseOutMethodsAndParams(this.expression); 4961 } 4962 get params() { 4963 const methods = this.parseOutMethodsAndParams(this.expression); 4964 return methods[0].params; 4965 } 4966 parseOutMethodsAndParams(rawMethod) { 4967 let methods = []; 4968 let parsedMethods = this.splitAndParseMethods(rawMethod); 4969 for (let { method, paramString } of parsedMethods) { 4970 let params = []; 4971 if (paramString.length > 0) { 4972 let argumentsToArray = function() { 4973 for (var l = arguments.length, p = new Array(l), k = 0; k < l; k++) { 4974 p[k] = arguments[k]; 4975 } 4976 return [].concat(p); 4977 }; 4978 try { 4979 params = Alpine.evaluate(document, "argumentsToArray(" + paramString + ")", { 4980 scope: { argumentsToArray } 4981 }); 4982 } catch (error2) { 4983 console.warn("Failed to parse parameters:", paramString, error2); 4984 params = []; 4985 } 4986 } 4987 methods.push({ method, params }); 4988 } 4989 return methods; 4990 } 4991 splitAndParseMethods(methodExpression) { 4992 let methods = []; 4993 let current = ""; 4994 let parenCount = 0; 4995 let inString = false; 4996 let stringChar = null; 4997 let trimmedExpression = methodExpression.trim(); 4998 for (let i = 0; i < trimmedExpression.length; i++) { 4999 let char = trimmedExpression[i]; 5000 if (!inString) { 5001 if (char === '"' || char === "'") { 5002 inString = true; 5003 stringChar = char; 5004 current += char; 5005 } else if (char === "(") { 5006 parenCount++; 5007 current += char; 5008 } else if (char === ")") { 5009 parenCount--; 5010 current += char; 5011 } else if (char === "," && parenCount === 0) { 5012 methods.push(this.parseMethodCall(current.trim())); 5013 current = ""; 5014 } else { 5015 current += char; 5016 } 5017 } else { 5018 if (char === stringChar && trimmedExpression[i - 1] !== "\\") { 5019 inString = false;
5020 stringChar = null; 5021 } 5022 current += char; 5023 } 5024 } 5025 if (current.trim().length > 0) { 5026 methods.push(this.parseMethodCall(current.trim())); 5027 } 5028 return methods; 5029 } 5030 parseMethodCall(methodString) { 5031 let methodMatch = methodString.match(/^([^(]+)\(/); 5032 if (!methodMatch) { 5033 return { 5034 method: methodString.trim(), 5035 paramString: "" 5036 }; 5037 } 5038 let method = methodMatch[1].trim(); 5039 let paramStart = methodMatch[0].length - 1; 5040 let lastParenIndex = methodString.lastIndexOf(")"); 5041 if (lastParenIndex === -1) { 5042 throw new Error(`Missing closing parenthesis for method "${method}"`); 5043 } 5044 let paramString = methodString.slice(paramStart + 1, lastParenIndex).trim(); 5045 return { 5046 method, 5047 paramString 5048 }; 5049 } 5050 }; 5051 5052
vendor: 3,044 bytes, lines 5052-5146
5052// node_modules/@alpinejs/collapse/dist/module.esm.js 5053 function src_default2(Alpine3) { 5054 Alpine3.directive("collapse", collapse); 5055 collapse.inline = (el, { modifiers }) => { 5056 if (!modifiers.includes("min")) 5057 return; 5058 el._x_doShow = () => { 5059 }; 5060 el._x_doHide = () => { 5061 }; 5062 }; 5063 function collapse(el, { modifiers }) { 5064 let duration = modifierValue2(modifiers, "duration", 250) / 1e3; 5065 let floor2 = modifierValue2(modifiers, "min", 0); 5066 let fullyHide = !modifiers.includes("min"); 5067 if (!el._x_isShown) 5068 el.style.height = `${floor2}px`; 5069 if (!el._x_isShown && fullyHide) 5070 el.hidden = true; 5071 if (!el._x_isShown) 5072 el.style.overflow = "hidden"; 5073 let setFunction = (el2, styles) => { 5074 let revertFunction = Alpine3.setStyles(el2, styles); 5075 return styles.height ? () => { 5076 } : revertFunction; 5077 }; 5078 let transitionStyles = { 5079 transitionProperty: "height", 5080 transitionDuration: `${duration}s`, 5081 transitionTimingFunction: "cubic-bezier(0.4, 0.0, 0.2, 1)" 5082 }; 5083 el._x_transition = { 5084 in(before = () => { 5085 }, after = () => { 5086 }) { 5087 if (fullyHide) 5088 el.hidden = false; 5089 if (fullyHide) 5090 el.style.display = null; 5091 let current = el.getBoundingClientRect().height; 5092 el.style.height = "auto"; 5093 let full = el.getBoundingClientRect().height; 5094 if (current === full) { 5095 current = floor2; 5096 } 5097 Alpine3.transition(el, Alpine3.setStyles, { 5098 during: transitionStyles, 5099 start: { height: current + "px" }, 5100 end: { height: full + "px" } 5101 }, () => el._x_isShown = true, () => { 5102 if (Math.abs(el.getBoundingClientRect().height - full) < 1) { 5103 el.style.overflow = null; 5104 } 5105 }); 5106 }, 5107 out(before = () => { 5108 }, after = () => { 5109 }) { 5110 let full = el.getBoundingClientRect().height; 5111 Alpine3.transition(el, setFunction, { 5112 during: transitionStyles, 5113 start: { height: full + "px" }, 5114 end: { height: floor2 + "px" } 5115 }, () => el.style.overflow = "hidden", () => { 5116 el._x_isShown = false; 5117 if (el.style.height == `${floor2}px` && fullyHide) { 5118 el.style.display = "none"; 5119 el.hidden = true; 5120 } 5121 }); 5122 } 5123 }; 5124 } 5125 } 5126 function modifierValue2(modifiers, key, fallback2) { 5127 if (modifiers.indexOf(key) === -1) 5128 return fallback2; 5129 const rawValue = modifiers[modifiers.indexOf(key) + 1]; 5130 if (!rawValue) 5131 return fallback2; 5132 if (key === "duration") { 5133 let match = rawValue.match(/([0-9]+)ms/); 5134 if (match) 5135 return match[1]; 5136 } 5137 if (key === "min") { 5138 let match = rawValue.match(/([0-9]+)px/); 5139 if (match) 5140 return match[1]; 5141 } 5142 return rawValue; 5143 } 5144 var module_default2 = src_default2; 5145 5146
vendor: 60,938 bytes, lines 5146-6708
5146// node_modules/@alpinejs/focus/dist/module.esm.js 5147 var candidateSelectors = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"]; 5148 var candidateSelector = /* @__PURE__ */ candidateSelectors.join(","); 5149 var NoElement = typeof Element === "undefined"; 5150 var matches = NoElement ? function() { 5151 } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 5152 var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) { 5153 var _element$getRootNode; 5154 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element); 5155 } : function(element) { 5156 return element === null || element === void 0 ? void 0 : element.ownerDocument; 5157 }; 5158 var _isInert = function isInert(node, lookUp) { 5159 var _node$getAttribute; 5160 if (lookUp === void 0) { 5161 lookUp = true; 5162 } 5163 var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert"); 5164 var inert = inertAtt === "" || inertAtt === "true"; 5165 var result = inert || lookUp && node && (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode)); 5166 return result; 5167 }; 5168 var isContentEditable = function isContentEditable2(node) { 5169 var _node$getAttribute2; 5170 var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable"); 5171 return attValue === "" || attValue === "true"; 5172 }; 5173 var getCandidates = function getCandidates2(el, includeContainer, filter) { 5174 if (_isInert(el)) { 5175 return []; 5176 } 5177 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); 5178 if (includeContainer && matches.call(el, candidateSelector)) { 5179 candidates.unshift(el); 5180 } 5181 candidates = candidates.filter(filter); 5182 return candidates; 5183 }; 5184 var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { 5185 var candidates = []; 5186 var elementsToCheck = Array.from(elements); 5187 while (elementsToCheck.length) { 5188 var element = elementsToCheck.shift(); 5189 if (_isInert(element, false)) { 5190 continue; 5191 } 5192 if (element.tagName === "SLOT") { 5193 var assigned = element.assignedElements(); 5194 var content = assigned.length ? assigned : element.children; 5195 var nestedCandidates = _getCandidatesIteratively(content, true, options); 5196 if (options.flatten) { 5197 candidates.push.apply(candidates, nestedCandidates); 5198 } else { 5199 candidates.push({ 5200 scopeParent: element, 5201 candidates: nestedCandidates 5202 }); 5203 } 5204 } else { 5205 var validCandidate = matches.call(element, candidateSelector); 5206 if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) { 5207 candidates.push(element); 5208 } 5209 var shadowRoot = element.shadowRoot || typeof options.getShadowRoot === "function" && options.getShadowRoot(element); 5210 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element)); 5211 if (shadowRoot && validShadowRoot) { 5212 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options); 5213 if (options.flatten) { 5214 candidates.push.apply(candidates, _nestedCandidates); 5215 } else { 5216 candidates.push({ 5217 scopeParent: element, 5218 candidates: _nestedCandidates 5219 }); 5220 } 5221 } else { 5222 elementsToCheck.unshift.apply(elementsToCheck, element.children); 5223 } 5224 } 5225 } 5226 return candidates; 5227 }; 5228 var hasTabIndex = function hasTabIndex2(node) { 5229 return !isNaN(parseInt(node.getAttribute("tabindex"), 10)); 5230 }; 5231 var getTabIndex = function getTabIndex2(node) { 5232 if (!node) { 5233 throw new Error("No node provided"); 5234 } 5235 if (node.tabIndex < 0) { 5236 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) { 5237 return 0; 5238 } 5239 } 5240 return node.tabIndex; 5241 }; 5242 var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) { 5243 var tabIndex = getTabIndex(node); 5244 if (tabIndex < 0 && isScope && !hasTabIndex(node)) { 5245 return 0; 5246 } 5247 return tabIndex; 5248 }; 5249 var sortOrderedTabbables = function sortOrderedTabbables2(a, b) { 5250 return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex; 5251 }; 5252 var isInput = function isInput2(node) { 5253 return node.tagName === "INPUT"; 5254 }; 5255 var isHiddenInput = function isHiddenInput2(node) { 5256 return isInput(node) && node.type === "hidden"; 5257 }; 5258 var isDetailsWithSummary = function isDetailsWithSummary2(node) { 5259 var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) { 5260 return child.tagName === "SUMMARY"; 5261 }); 5262 return r; 5263 }; 5264 var getCheckedRadio = function getCheckedRadio2(nodes, form) { 5265 for (var i = 0; i < nodes.length; i++) { 5266 if (nodes[i].checked && nodes[i].form === form) { 5267 return nodes[i]; 5268 } 5269 } 5270 }; 5271 var isTabbableRadio = function isTabbableRadio2(node) { 5272 if (!node.name) { 5273 return true; 5274 } 5275 var radioScope = node.form || getRootNode(node); 5276 var queryRadios = function queryRadios2(name) { 5277 return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]'); 5278 }; 5279 var radioSet; 5280 if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") { 5281 radioSet = queryRadios(window.CSS.escape(node.name)); 5282 } else { 5283 try { 5284 radioSet = queryRadios(node.name); 5285 } catch (err) { 5286 console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message); 5287 return false; 5288 } 5289 } 5290 var checked = getCheckedRadio(radioSet, node.form); 5291 return !checked || checked === node; 5292 }; 5293 var isRadio2 = function isRadio22(node) { 5294 return isInput(node) && node.type === "radio"; 5295 }; 5296 var isNonTabbableRadio = function isNonTabbableRadio2(node) { 5297 return isRadio2(node) && !isTabbableRadio(node); 5298 }; 5299 var isNodeAttached = function isNodeAttached2(node) { 5300 var _nodeRoot; 5301 var nodeRoot = node && getRootNode(node); 5302 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; 5303 var attached = false; 5304 if (nodeRoot && nodeRoot !== node) { 5305 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; 5306 attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node)); 5307 while (!attached && nodeRootHost) { 5308 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; 5309 nodeRoot = getRootNode(nodeRootHost); 5310 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; 5311 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); 5312 } 5313 } 5314 return attached; 5315 }; 5316 var isZeroArea = function isZeroArea2(node) { 5317 var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; 5318 return width === 0 && height === 0; 5319 }; 5320 var isHidden = function isHidden2(node, _ref) { 5321 var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot; 5322 if (displayCheck === "full-native") { 5323 if ("checkVisibility" in node) { 5324 var visible = node.checkVisibility({ 5325 checkOpacity: false, 5326 opacityProperty: false, 5327 contentVisibilityAuto: true, 5328 visibilityProperty: true, 5329 checkVisibilityCSS: true 5330 }); 5331 return !visible; 5332 } 5333 } 5334 if (getComputedStyle(node).visibility === "hidden") { 5335 return true; 5336 } 5337 var isDirectSummary = matches.call(node, "details>summary:first-of-type"); 5338 var nodeUnderDetails = isDirectSummary ? node.parentElement : node; 5339 if (matches.call(nodeUnderDetails, "details:not([open]) *")) { 5340 return true; 5341 } 5342 if (!displayCheck || displayCheck === "full" || displayCheck === "full-native" || displayCheck === "legacy-full") { 5343 if (typeof getShadowRoot === "function") { 5344 var originalNode = node; 5345 while (node) { 5346 var parentElement = node.parentElement; 5347 var rootNode = getRootNode(node); 5348 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) { 5349 return isZeroArea(node); 5350 } else if (node.assignedSlot) { 5351 node = node.assignedSlot; 5352 } else if (!parentElement && rootNode !== node.ownerDocument) { 5353 node = rootNode.host; 5354 } else { 5355 node = parentElement; 5356 } 5357 } 5358 node = originalNode; 5359 } 5360 if (isNodeAttached(node)) { 5361 return !node.getClientRects().length; 5362 } 5363 if (displayCheck !== "legacy-full") { 5364 return true; 5365 } 5366 } else if (displayCheck === "non-zero-area") { 5367 return isZeroArea(node); 5368 } 5369 return false; 5370 }; 5371 var isDisabledFromFieldset = function isDisabledFromFieldset2(node) { 5372 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { 5373 var parentNode = node.parentElement; 5374 while (parentNode) { 5375 if (parentNode.tagName === "FIELDSET" && parentNode.disabled) { 5376 for (var i = 0; i < parentNode.children.length; i++) { 5377 var child = parentNode.children.item(i); 5378 if (child.tagName === "LEGEND") { 5379 return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node); 5380 } 5381 } 5382 return true; 5383 } 5384 parentNode = parentNode.parentElement; 5385 } 5386 } 5387 return false; 5388 }; 5389 var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) { 5390 if (node.disabled || isHiddenInput(node) || isHidden(node, options) || isDetailsWithSummary(node) || isDisabledFromFieldset(node)) { 5391 return false; 5392 } 5393 return true; 5394 }; 5395 var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) { 5396 if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) { 5397 return false; 5398 } 5399 return true; 5400 }; 5401 var isShadowRootTabbable = function isShadowRootTabbable2(shadowHostNode) { 5402 var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10); 5403 if (isNaN(tabIndex) || tabIndex >= 0) { 5404 return true; 5405 } 5406 return false; 5407 }; 5408 var _sortByOrder = function sortByOrder(candidates) { 5409 var regularTabbables = []; 5410 var orderedTabbables = []; 5411 candidates.forEach(function(item, i) { 5412 var isScope = !!item.scopeParent; 5413 var element = isScope ? item.scopeParent : item; 5414 var candidateTabindex = getSortOrderTabIndex(element, isScope); 5415 var elements = isScope ? _sortByOrder(item.candidates) : element; 5416 if (candidateTabindex === 0) { 5417 isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element); 5418 } else { 5419 orderedTabbables.push({ 5420 documentOrder: i, 5421 tabIndex: candidateTabindex, 5422 item, 5423 isScope, 5424 content: elements 5425 }); 5426 } 5427 }); 5428 return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) { 5429 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); 5430 return acc; 5431 }, []).concat(regularTabbables); 5432 }; 5433 var tabbable = function tabbable2(container, options) { 5434 options = options || {}; 5435 var candidates; 5436 if (options.getShadowRoot) { 5437 candidates = _getCandidatesIteratively([container], options.includeContainer, { 5438 filter: isNodeMatchingSelectorTabbable.bind(null, options), 5439 flatten: false, 5440 getShadowRoot: options.getShadowRoot, 5441 shadowRootFilter: isShadowRootTabbable 5442 }); 5443 } else { 5444 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); 5445 } 5446 return _sortByOrder(candidates); 5447 }; 5448 var focusable = function focusable2(container, options) { 5449 options = options || {}; 5450 var candidates; 5451 if (options.getShadowRoot) { 5452 candidates = _getCandidatesIteratively([container], options.includeContainer, { 5453 filter: isNodeMatchingSelectorFocusable.bind(null, options), 5454 flatten: true, 5455 getShadowRoot: options.getShadowRoot 5456 }); 5457 } else { 5458 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorFocusable.bind(null, options)); 5459 } 5460 return candidates; 5461 }; 5462 var isTabbable = function isTabbable2(node, options) { 5463 options = options || {}; 5464 if (!node) { 5465 throw new Error("No node provided"); 5466 } 5467 if (matches.call(node, candidateSelector) === false) { 5468 return false; 5469 } 5470 return isNodeMatchingSelectorTabbable(options, node); 5471 }; 5472 var focusableCandidateSelector = /* @__PURE__ */ candidateSelectors.concat("iframe:not([inert]):not([inert] *)").join(","); 5473 var isFocusable = function isFocusable2(node, options) { 5474 options = options || {}; 5475 if (!node) { 5476 throw new Error("No node provided"); 5477 } 5478 if (matches.call(node, focusableCandidateSelector) === false) { 5479 return false; 5480 } 5481 return isNodeMatchingSelectorFocusable(options, node); 5482 }; 5483 function _arrayLikeToArray(r, a) { 5484 (null == a || a > r.length) && (a = r.length); 5485 for (var e = 0, n = Array(a); e < a; e++) 5486 n[e] = r[e]; 5487 return n; 5488 } 5489 function _arrayWithoutHoles(r) { 5490 if (Array.isArray(r)) 5491 return _arrayLikeToArray(r); 5492 } 5493 function asyncGeneratorStep(n, t, e, r, o, a, c) { 5494 try { 5495 var i = n[a](c), u = i.value; 5496 } catch (n2) { 5497 return void e(n2); 5498 } 5499 i.done ? t(u) : Promise.resolve(u).then(r, o); 5500 } 5501 function _asyncToGenerator(n) { 5502 return function() { 5503 var t = this, e = arguments; 5504 return new Promise(function(r, o) { 5505 var a = n.apply(t, e); 5506 function _next(n2) { 5507 asyncGeneratorStep(a, r, o, _next, _throw, "next", n2); 5508 } 5509 function _throw(n2) { 5510 asyncGeneratorStep(a, r, o, _next, _throw, "throw", n2); 5511 } 5512 _next(void 0); 5513 }); 5514 }; 5515 } 5516 function _createForOfIteratorHelper(r, e) { 5517 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 5518 if (!t) { 5519 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) { 5520 t && (r = t); 5521 var n = 0, F = function() { 5522 }; 5523 return { 5524 s: F, 5525 n: function() { 5526 return n >= r.length ? { 5527 done: true 5528 } : { 5529 done: false, 5530 value: r[n++] 5531 }; 5532 }, 5533 e: function(r2) { 5534 throw r2; 5535 }, 5536 f: F 5537 }; 5538 } 5539 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 5540 } 5541 var o, a = true, u = false; 5542 return { 5543 s: function() { 5544 t = t.call(r); 5545 }, 5546 n: function() { 5547 var r2 = t.next(); 5548 return a = r2.done, r2; 5549 }, 5550 e: function(r2) { 5551 u = true, o = r2; 5552 }, 5553 f: function() { 5554 try { 5555 a || null == t.return || t.return(); 5556 } finally { 5557 if (u) 5558 throw o; 5559 } 5560 } 5561 }; 5562 } 5563 function _defineProperty(e, r, t) { 5564 return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { 5565 value: t, 5566 enumerable: true, 5567 configurable: true, 5568 writable: true 5569 }) : e[r] = t, e; 5570 } 5571 function _iterableToArray(r) { 5572 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) 5573 return Array.from(r); 5574 } 5575 function _nonIterableSpread() { 5576 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 5577 } 5578 function ownKeys2(e, r) { 5579 var t = Object.keys(e); 5580 if (Object.getOwnPropertySymbols) { 5581 var o = Object.getOwnPropertySymbols(e); 5582 r && (o = o.filter(function(r2) { 5583 return Object.getOwnPropertyDescriptor(e, r2).enumerable; 5584 })), t.push.apply(t, o); 5585 } 5586 return t; 5587 } 5588 function _objectSpread2(e) { 5589 for (var r = 1; r < arguments.length; r++) { 5590 var t = null != arguments[r] ? arguments[r] : {}; 5591 r % 2 ? ownKeys2(Object(t), true).forEach(function(r2) { 5592 _defineProperty(e, r2, t[r2]); 5593 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r2) { 5594 Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2)); 5595 }); 5596 } 5597 return e; 5598 } 5599 function _regenerator() { 5600 var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; 5601 function i(r2, n2, o2, i2) { 5602 var c2 = n2 && n2.prototype instanceof Generator ? n2 : Generator, u2 = Object.create(c2.prototype); 5603 return _regeneratorDefine(u2, "_invoke", function(r3, n3, o3) { 5604 var i3, c3, u3, f2 = 0, p = o3 || [], y = false, G = { 5605 p: 0, 5606 n: 0, 5607 v: e, 5608 a: d, 5609 f: d.bind(e, 4), 5610 d: function(t2, r4) { 5611 return i3 = t2, c3 = 0, u3 = e, G.n = r4, a; 5612 } 5613 }; 5614 function d(r4, n4) { 5615 for (c3 = r4, u3 = n4, t = 0; !y && f2 && !o4 && t < p.length; t++) { 5616 var o4, i4 = p[t], d2 = G.p, l = i4[2]; 5617 r4 > 3 ? (o4 = l === n4) && (u3 = i4[(c3 = i4[4]) ? 5 : (c3 = 3, 3)], i4[4] = i4[5] = e) : i4[0] <= d2 && ((o4 = r4 < 2 && d2 < i4[1]) ? (c3 = 0, G.v = n4, G.n = i4[1]) : d2 < l && (o4 = r4 < 3 || i4[0] > n4 || n4 > l) && (i4[4] = r4, i4[5] = n4, G.n = l, c3 = 0)); 5618 } 5619 if (o4 || r4 > 1) 5620 return a; 5621 throw y = true, n4; 5622 } 5623 return function(o4, p2, l) { 5624 if (f2 > 1) 5625 throw TypeError("Generator is already running"); 5626 for (y && 1 === p2 && d(p2, l), c3 = p2, u3 = l; (t = c3 < 2 ? e : u3) || !y; ) { 5627 i3 || (c3 ? c3 < 3 ? (c3 > 1 && (G.n = -1), d(c3, u3)) : G.n = u3 : G.v = u3); 5628 try { 5629 if (f2 = 2, i3) { 5630 if (c3 || (o4 = "next"), t = i3[o4]) { 5631 if (!(t = t.call(i3, u3))) 5632 throw TypeError("iterator result is not an object"); 5633 if (!t.done) 5634 return t; 5635 u3 = t.value, c3 < 2 && (c3 = 0); 5636 } else 5637 1 === c3 && (t = i3.return) && t.call(i3), c3 < 2 && (u3 = TypeError("The iterator does not provide a '" + o4 + "' method"), c3 = 1); 5638 i3 = e; 5639 } else if ((t = (y = G.n < 0) ? u3 : r3.call(n3, G)) !== a) 5640 break; 5641 } catch (t2) { 5642 i3 = e, c3 = 1, u3 = t2; 5643 } finally { 5644 f2 = 1; 5645 } 5646 } 5647 return { 5648 value: t, 5649 done: y 5650 }; 5651 }; 5652 }(r2, o2, i2), true), u2; 5653 } 5654 var a = {}; 5655 function Generator() { 5656 } 5657 function GeneratorFunction() { 5658 } 5659 function GeneratorFunctionPrototype() { 5660 } 5661 t = Object.getPrototypeOf; 5662 var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function() { 5663 return this; 5664 }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); 5665 function f(e2) { 5666 return Object.setPrototypeOf ? Object.setPrototypeOf(e2, GeneratorFunctionPrototype) : (e2.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e2, o, "GeneratorFunction")), e2.prototype = Object.create(u), e2; 5667 } 5668 return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function() { 5669 return this; 5670 }), _regeneratorDefine(u, "toString", function() { 5671 return "[object Generator]"; 5672 }), (_regenerator = function() { 5673 return { 5674 w: i, 5675 m: f 5676 }; 5677 })(); 5678 } 5679 function _regeneratorDefine(e, r, n, t) { 5680 var i = Object.defineProperty; 5681 try { 5682 i({}, "", {}); 5683 } catch (e2) { 5684 i = 0; 5685 } 5686 _regeneratorDefine = function(e2, r2, n2, t2) { 5687 function o(r3, n3) { 5688 _regeneratorDefine(e2, r3, function(e3) { 5689 return this._invoke(r3, n3, e3); 5690 }); 5691 } 5692 r2 ? i ? i(e2, r2, { 5693 value: n2, 5694 enumerable: !t2, 5695 configurable: !t2, 5696 writable: !t2 5697 }) : e2[r2] = n2 : (o("next", 0), o("throw", 1), o("return", 2)); 5698 }, _regeneratorDefine(e, r, n, t); 5699 } 5700 function _toConsumableArray(r) { 5701 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); 5702 } 5703 function _toPrimitive(t, r) { 5704 if ("object" != typeof t || !t) 5705 return t; 5706 var e = t[Symbol.toPrimitive]; 5707 if (void 0 !== e) { 5708 var i = e.call(t, r); 5709 if ("object" != typeof i) 5710 return i; 5711 throw new TypeError("@@toPrimitive must return a primitive value."); 5712 } 5713 return ("string" === r ? String : Number)(t); 5714 } 5715 function _toPropertyKey(t) { 5716 var i = _toPrimitive(t, "string"); 5717 return "symbol" == typeof i ? i : i + ""; 5718 } 5719 function _unsupportedIterableToArray(r, a) { 5720 if (r) { 5721 if ("string" == typeof r) 5722 return _arrayLikeToArray(r, a); 5723 var t = {}.toString.call(r).slice(8, -1); 5724 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 5725 } 5726 } 5727 var activeFocusTraps = { 5728 getActiveTrap: function getActiveTrap(trapStack) { 5729 if ((trapStack === null || trapStack === void 0 ? void 0 : trapStack.length) > 0) { 5730 return trapStack[trapStack.length - 1]; 5731 } 5732 return null; 5733 }, 5734 activateTrap: function activateTrap(trapStack, trap) { 5735 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 5736 if (trap !== activeTrap) { 5737 activeFocusTraps.pauseTrap(trapStack); 5738 } 5739 var trapIndex = trapStack.indexOf(trap); 5740 if (trapIndex === -1) { 5741 trapStack.push(trap); 5742 } else { 5743 trapStack.splice(trapIndex, 1); 5744 trapStack.push(trap); 5745 } 5746 }, 5747 deactivateTrap: function deactivateTrap(trapStack, trap) { 5748 var trapIndex = trapStack.indexOf(trap); 5749 if (trapIndex !== -1) { 5750 trapStack.splice(trapIndex, 1); 5751 } 5752 activeFocusTraps.unpauseTrap(trapStack); 5753 }, 5754 pauseTrap: function pauseTrap(trapStack) { 5755 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 5756 activeTrap === null || activeTrap === void 0 || activeTrap._setPausedState(true); 5757 }, 5758 unpauseTrap: function unpauseTrap(trapStack) { 5759 var activeTrap = activeFocusTraps.getActiveTrap(trapStack); 5760 if (activeTrap && !activeTrap._isManuallyPaused()) { 5761 activeTrap._setPausedState(false); 5762 } 5763 } 5764 }; 5765 var isSelectableInput = function isSelectableInput2(node) { 5766 return node.tagName && node.tagName.toLowerCase() === "input" && typeof node.select === "function"; 5767 }; 5768 var isEscapeEvent = function isEscapeEvent2(e) { 5769 return (e === null || e === void 0 ? void 0 : e.key) === "Escape" || (e === null || e === void 0 ? void 0 : e.key) === "Esc" || (e === null || e === void 0 ? void 0 : e.keyCode) === 27; 5770 }; 5771 var isTabEvent = function isTabEvent2(e) { 5772 return (e === null || e === void 0 ? void 0 : e.key) === "Tab" || (e === null || e === void 0 ? void 0 : e.keyCode) === 9; 5773 }; 5774 var isKeyForward = function isKeyForward2(e) { 5775 return isTabEvent(e) && !e.shiftKey; 5776 }; 5777 var isKeyBackward = function isKeyBackward2(e) { 5778 return isTabEvent(e) && e.shiftKey; 5779 }; 5780 var delay = function delay2(fn) { 5781 return setTimeout(fn, 0); 5782 }; 5783 var valueOrHandler = function valueOrHandler2(value) { 5784 for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 5785 params[_key - 1] = arguments[_key]; 5786 } 5787 return typeof value === "function" ? value.apply(void 0, params) : value; 5788 }; 5789 var getActualTarget = function getActualTarget2(event) { 5790 return event.target.shadowRoot && typeof event.composedPath === "function" ? event.composedPath()[0] : event.target; 5791 }; 5792 var internalTrapStack = []; 5793 var createFocusTrap = function createFocusTrap2(elements, userOptions) { 5794 var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document; 5795 var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack; 5796 var config = _objectSpread2({ 5797 returnFocusOnDeactivate: true, 5798 escapeDeactivates: true, 5799 delayInitialFocus: true, 5800 isolateSubtrees: false, 5801 isKeyForward, 5802 isKeyBackward 5803 }, userOptions); 5804 var state = { 5805 containers: [], 5806 containerGroups: [], 5807 tabbableGroups: [], 5808 adjacentElements: /* @__PURE__ */ new Set(), 5809 alreadySilent: /* @__PURE__ */ new Set(), 5810 nodeFocusedBeforeActivation: null, 5811 mostRecentlyFocusedNode: null, 5812 active: false, 5813 paused: false, 5814 manuallyPaused: false, 5815 delayInitialFocusTimer: void 0, 5816 recentNavEvent: void 0 5817 }; 5818 var trap; 5819 var getOption = function getOption2(configOverrideOptions, optionName, configOptionName) { 5820 return configOverrideOptions && configOverrideOptions[optionName] !== void 0 ? configOverrideOptions[optionName] : config[configOptionName || optionName]; 5821 }; 5822 var findContainerIndex = function findContainerIndex2(element, event) { 5823 var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === "function" ? event.composedPath() : void 0; 5824 return state.containerGroups.findIndex(function(_ref) { 5825 var container = _ref.container, tabbableNodes = _ref.tabbableNodes; 5826 return container.contains(element) || (composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function(node) { 5827 return node === element; 5828 }); 5829 }); 5830 }; 5831 var getNodeForOption = function getNodeForOption2(optionName) { 5832 var _ref2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref2$hasFallback = _ref2.hasFallback, hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback, _ref2$params = _ref2.params, params = _ref2$params === void 0 ? [] : _ref2$params; 5833 var optionValue = config[optionName]; 5834 if (typeof optionValue === "function") { 5835 optionValue = optionValue.apply(void 0, _toConsumableArray(params)); 5836 } 5837 if (optionValue === true) { 5838 optionValue = void 0; 5839 } 5840 if (!optionValue) { 5841 if (optionValue === void 0 || optionValue === false) { 5842 return optionValue; 5843 } 5844 throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node")); 5845 } 5846 var node = optionValue; 5847 if (typeof optionValue === "string") { 5848 try { 5849 node = doc.querySelector(optionValue); 5850 } catch (err) { 5851 throw new Error("`".concat(optionName, '` appears to be an invalid selector; error="').concat(err.message, '"')); 5852 } 5853 if (!node) { 5854 if (!hasFallback) { 5855 throw new Error("`".concat(optionName, "` as selector refers to no known node")); 5856 } 5857 } 5858 } 5859 return node; 5860 }; 5861 var getInitialFocusNode = function getInitialFocusNode2() { 5862 var node = getNodeForOption("initialFocus", { 5863 hasFallback: true 5864 }); 5865 if (node === false) { 5866 return false; 5867 } 5868 if (node === void 0 || node && !isFocusable(node, config.tabbableOptions)) { 5869 if (findContainerIndex(doc.activeElement) >= 0) { 5870 node = doc.activeElement; 5871 } else { 5872 var firstTabbableGroup = state.tabbableGroups[0]; 5873 var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode; 5874 node = firstTabbableNode || getNodeForOption("fallbackFocus"); 5875 } 5876 } else if (node === null) { 5877 node = getNodeForOption("fallbackFocus"); 5878 } 5879 if (!node) { 5880 throw new Error("Your focus-trap needs to have at least one focusable element"); 5881 } 5882 return node; 5883 }; 5884 var updateTabbableNodes = function updateTabbableNodes2() { 5885 state.containerGroups = state.containers.map(function(container) { 5886 var tabbableNodes = tabbable(container, config.tabbableOptions); 5887 var focusableNodes = focusable(container, config.tabbableOptions); 5888 var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : void 0; 5889 var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : void 0; 5890 var firstDomTabbableNode = focusableNodes.find(function(node) { 5891 return isTabbable(node); 5892 }); 5893 var lastDomTabbableNode = focusableNodes.slice().reverse().find(function(node) { 5894 return isTabbable(node); 5895 }); 5896 var posTabIndexesFound = !!tabbableNodes.find(function(node) { 5897 return getTabIndex(node) > 0; 5898 }); 5899 return { 5900 container, 5901 tabbableNodes, 5902 focusableNodes, 5903 posTabIndexesFound, 5904 firstTabbableNode, 5905 lastTabbableNode, 5906 firstDomTabbableNode, 5907 lastDomTabbableNode, 5908 nextTabbableNode: function nextTabbableNode(node) { 5909 var forward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true; 5910 var nodeIdx = tabbableNodes.indexOf(node); 5911 if (nodeIdx < 0) { 5912 if (forward) { 5913 return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function(el) { 5914 return isTabbable(el); 5915 }); 5916 } 5917 return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function(el) { 5918 return isTabbable(el); 5919 }); 5920 } 5921 return tabbableNodes[nodeIdx + (forward ? 1 : -1)]; 5922 } 5923 }; 5924 }); 5925 state.tabbableGroups = state.containerGroups.filter(function(group) { 5926 return group.tabbableNodes.length > 0; 5927 }); 5928 if (state.tabbableGroups.length <= 0 && !getNodeForOption("fallbackFocus")) { 5929 throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times"); 5930 } 5931 if (state.containerGroups.find(function(g) { 5932 return g.posTabIndexesFound; 5933 }) && state.containerGroups.length > 1) { 5934 throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps."); 5935 } 5936 }; 5937 var _getActiveElement = function getActiveElement(el) { 5938 var activeElement = el.activeElement; 5939 if (!activeElement) { 5940 return; 5941 } 5942 if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) { 5943 return _getActiveElement(activeElement.shadowRoot); 5944 } 5945 return activeElement; 5946 }; 5947 var _tryFocus = function tryFocus(node) { 5948 if (node === false) { 5949 return; 5950 } 5951 if (node === _getActiveElement(document)) { 5952 return; 5953 } 5954 if (!node || !node.focus) { 5955 _tryFocus(getInitialFocusNode()); 5956 return; 5957 } 5958 node.focus({ 5959 preventScroll: !!config.preventScroll 5960 }); 5961 state.mostRecentlyFocusedNode = node; 5962 if (isSelectableInput(node)) { 5963 node.select(); 5964 } 5965 }; 5966 var getReturnFocusNode = function getReturnFocusNode2(previousActiveElement) { 5967 var node = getNodeForOption("setReturnFocus", { 5968 params: [previousActiveElement] 5969 }); 5970 return node ? node : node === false ? false : previousActiveElement; 5971 }; 5972 var findNextNavNode = function findNextNavNode2(_ref3) { 5973 var target = _ref3.target, event = _ref3.event, _ref3$isBackward = _ref3.isBackward, isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward; 5974 target = target || getActualTarget(event); 5975 updateTabbableNodes(); 5976 var destinationNode = null; 5977 if (state.tabbableGroups.length > 0) { 5978 var containerIndex = findContainerIndex(target, event); 5979 var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : void 0; 5980 if (containerIndex < 0) { 5981 if (isBackward) { 5982 destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode; 5983 } else { 5984 destinationNode = state.tabbableGroups[0].firstTabbableNode; 5985 } 5986 } else if (isBackward) { 5987 var startOfGroupIndex = state.tabbableGroups.findIndex(function(_ref4) { 5988 var firstTabbableNode = _ref4.firstTabbableNode; 5989 return target === firstTabbableNode; 5990 }); 5991 if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) { 5992 startOfGroupIndex = containerIndex; 5993 } 5994 if (startOfGroupIndex >= 0) { 5995 var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1; 5996 var destinationGroup = state.tabbableGroups[destinationGroupIndex]; 5997 destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode; 5998 } else if (!isTabEvent(event)) { 5999 destinationNode = containerGroup.nextTabbableNode(target, false); 6000 } 6001 } else { 6002 var lastOfGroupIndex = state.tabbableGroups.findIndex(function(_ref5) { 6003 var lastTabbableNode = _ref5.lastTabbableNode; 6004 return target === lastTabbableNode; 6005 }); 6006 if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) { 6007 lastOfGroupIndex = containerIndex; 6008 } 6009 if (lastOfGroupIndex >= 0) { 6010 var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1; 6011 var _destinationGroup = state.tabbableGroups[_destinationGroupIndex]; 6012 destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode; 6013 } else if (!isTabEvent(event)) { 6014 destinationNode = containerGroup.nextTabbableNode(target); 6015 } 6016 } 6017 } else { 6018 destinationNode = getNodeForOption("fallbackFocus"); 6019 } 6020 return destinationNode; 6021 }; 6022 var checkPointerDown = function checkPointerDown2(e) { 6023 var target = getActualTarget(e); 6024 if (findContainerIndex(target, e) >= 0) { 6025 return; 6026 } 6027 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 6028 trap.deactivate({ 6029 returnFocus: config.returnFocusOnDeactivate 6030 }); 6031 return; 6032 } 6033 if (valueOrHandler(config.allowOutsideClick, e)) { 6034 return; 6035 } 6036 e.preventDefault(); 6037 }; 6038 var checkFocusIn = function checkFocusIn2(event) { 6039 var target = getActualTarget(event); 6040 var targetContained = findContainerIndex(target, event) >= 0; 6041 if (targetContained || target instanceof Document) { 6042 if (targetContained) { 6043 state.mostRecentlyFocusedNode = target; 6044 } 6045 } else { 6046 event.stopImmediatePropagation(); 6047 var nextNode; 6048 var navAcrossContainers = true; 6049 if (state.mostRecentlyFocusedNode) { 6050 if (getTabIndex(state.mostRecentlyFocusedNode) > 0) { 6051 var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode); 6052 var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes; 6053 if (tabbableNodes.length > 0) { 6054 var mruTabIdx = tabbableNodes.findIndex(function(node) { 6055 return node === state.mostRecentlyFocusedNode; 6056 }); 6057 if (mruTabIdx >= 0) { 6058 if (config.isKeyForward(state.recentNavEvent)) { 6059 if (mruTabIdx + 1 < tabbableNodes.length) { 6060 nextNode = tabbableNodes[mruTabIdx + 1]; 6061 navAcrossContainers = false; 6062 } 6063 } else { 6064 if (mruTabIdx - 1 >= 0) { 6065 nextNode = tabbableNodes[mruTabIdx - 1]; 6066 navAcrossContainers = false; 6067 } 6068 } 6069 } 6070 } 6071 } else { 6072 if (!state.containerGroups.some(function(g) { 6073 return g.tabbableNodes.some(function(n) { 6074 return getTabIndex(n) > 0; 6075 }); 6076 })) { 6077 navAcrossContainers = false; 6078 } 6079 } 6080 } else { 6081 navAcrossContainers = false; 6082 } 6083 if (navAcrossContainers) { 6084 nextNode = findNextNavNode({ 6085 target: state.mostRecentlyFocusedNode, 6086 isBackward: config.isKeyBackward(state.recentNavEvent) 6087 }); 6088 } 6089 if (nextNode) { 6090 _tryFocus(nextNode); 6091 } else { 6092 _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode()); 6093 } 6094 } 6095 state.recentNavEvent = void 0; 6096 }; 6097 var checkKeyNav = function checkKeyNav2(event) { 6098 var isBackward = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false; 6099 state.recentNavEvent = event; 6100 var destinationNode = findNextNavNode({ 6101 event, 6102 isBackward 6103 }); 6104 if (destinationNode) { 6105 if (isTabEvent(event)) { 6106 event.preventDefault(); 6107 } 6108 _tryFocus(destinationNode); 6109 } 6110 }; 6111 var checkTabKey = function checkTabKey2(event) { 6112 if (config.isKeyForward(event) || config.isKeyBackward(event)) { 6113 checkKeyNav(event, config.isKeyBackward(event)); 6114 } 6115 }; 6116 var checkEscapeKey = function checkEscapeKey2(event) { 6117 if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) { 6118 event.preventDefault(); 6119 trap.deactivate(); 6120 } 6121 }; 6122 var checkClick = function checkClick2(e) { 6123 var target = getActualTarget(e); 6124 if (findContainerIndex(target, e) >= 0) { 6125 return; 6126 } 6127 if (valueOrHandler(config.clickOutsideDeactivates, e)) { 6128 return; 6129 } 6130 if (valueOrHandler(config.allowOutsideClick, e)) { 6131 return; 6132 } 6133 e.preventDefault(); 6134 e.stopImmediatePropagation(); 6135 }; 6136 var addListeners = function addListeners2() { 6137 if (!state.active) { 6138 return Promise.resolve(); 6139 } 6140 activeFocusTraps.activateTrap(trapStack, trap); 6141 var promise; 6142 if (config.delayInitialFocus) { 6143 promise = new Promise(function(resolve) { 6144 state.delayInitialFocusTimer = delay(function() { 6145 _tryFocus(getInitialFocusNode()); 6146 resolve(); 6147 }); 6148 }); 6149 } else { 6150 promise = Promise.resolve(); 6151 _tryFocus(getInitialFocusNode()); 6152 } 6153 doc.addEventListener("focusin", checkFocusIn, true); 6154 doc.addEventListener("mousedown", checkPointerDown, { 6155 capture: true, 6156 passive: false 6157 }); 6158 doc.addEventListener("touchstart", checkPointerDown, { 6159 capture: true, 6160 passive: false 6161 }); 6162 doc.addEventListener("click", checkClick, { 6163 capture: true, 6164 passive: false 6165 }); 6166 doc.addEventListener("keydown", checkTabKey, { 6167 capture: true, 6168 passive: false 6169 }); 6170 doc.addEventListener("keydown", checkEscapeKey); 6171 return promise; 6172 }; 6173 var collectAdjacentElements = function collectAdjacentElements2(containers) { 6174 if (state.active && !state.paused) { 6175 trap._setSubtreeIsolation(false); 6176 } 6177 state.adjacentElements.clear(); 6178 state.alreadySilent.clear(); 6179 var containerAncestors = /* @__PURE__ */ new Set(); 6180 var adjacentElements = /* @__PURE__ */ new Set(); 6181 var _iterator = _createForOfIteratorHelper(containers), _step; 6182 try { 6183 for (_iterator.s(); !(_step = _iterator.n()).done; ) { 6184 var container = _step.value; 6185 containerAncestors.add(container); 6186 var insideShadowRoot = typeof ShadowRoot !== "undefined" && container.getRootNode() instanceof ShadowRoot; 6187 var current = container; 6188 while (current) { 6189 containerAncestors.add(current); 6190 var parent = current.parentElement; 6191 var siblings = []; 6192 if (parent) { 6193 siblings = parent.children; 6194 } else if (!parent && insideShadowRoot) { 6195 siblings = current.getRootNode().children; 6196 parent = current.getRootNode().host; 6197 insideShadowRoot = typeof ShadowRoot !== "undefined" && parent.getRootNode() instanceof ShadowRoot; 6198 } 6199 var _iterator2 = _createForOfIteratorHelper(siblings), _step2; 6200 try { 6201 for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { 6202 var child = _step2.value; 6203 adjacentElements.add(child); 6204 } 6205 } catch (err) { 6206 _iterator2.e(err); 6207 } finally { 6208 _iterator2.f(); 6209 } 6210 current = parent; 6211 } 6212 } 6213 } catch (err) { 6214 _iterator.e(err); 6215 } finally { 6216 _iterator.f(); 6217 } 6218 containerAncestors.forEach(function(el) { 6219 adjacentElements["delete"](el); 6220 }); 6221 state.adjacentElements = adjacentElements; 6222 }; 6223 var removeListeners = function removeListeners2() { 6224 if (!state.active) { 6225 return; 6226 } 6227 doc.removeEventListener("focusin", checkFocusIn, true); 6228 doc.removeEventListener("mousedown", checkPointerDown, true); 6229 doc.removeEventListener("touchstart", checkPointerDown, true); 6230 doc.removeEventListener("click", checkClick, true); 6231 doc.removeEventListener("keydown", checkTabKey, true); 6232 doc.removeEventListener("keydown", checkEscapeKey); 6233 return trap; 6234 }; 6235 var checkDomRemoval = function checkDomRemoval2(mutations) { 6236 var isFocusedNodeRemoved = mutations.some(function(mutation) { 6237 var removedNodes = Array.from(mutation.removedNodes); 6238 return removedNodes.some(function(node) { 6239 return node === state.mostRecentlyFocusedNode; 6240 }); 6241 }); 6242 if (isFocusedNodeRemoved) { 6243 _tryFocus(getInitialFocusNode()); 6244 } 6245 }; 6246 var mutationObserver = typeof window !== "undefined" && "MutationObserver" in window ? new MutationObserver(checkDomRemoval) : void 0; 6247 var updateObservedNodes = function updateObservedNodes2() { 6248 if (!mutationObserver) { 6249 return; 6250 } 6251 mutationObserver.disconnect(); 6252 if (state.active && !state.paused) { 6253 state.containers.map(function(container) { 6254 mutationObserver.observe(container, { 6255 subtree: true, 6256 childList: true 6257 }); 6258 }); 6259 } 6260 }; 6261 trap = { 6262 get active() { 6263 return state.active; 6264 }, 6265 get paused() { 6266 return state.paused; 6267 }, 6268 activate: function activate(activateOptions) { 6269 if (state.active) { 6270 return this; 6271 } 6272 var onActivate = getOption(activateOptions, "onActivate"); 6273 var onPostActivate = getOption(activateOptions, "onPostActivate"); 6274 var checkCanFocusTrap = getOption(activateOptions, "checkCanFocusTrap"); 6275 var preexistingTrap = activeFocusTraps.getActiveTrap(trapStack); 6276 var revertState = false; 6277 if (preexistingTrap && !preexistingTrap.paused) { 6278 var _preexistingTrap$_set; 6279 (_preexistingTrap$_set = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set === void 0 || _preexistingTrap$_set.call(preexistingTrap, false); 6280 revertState = true; 6281 } 6282 try { 6283 if (!checkCanFocusTrap) { 6284 updateTabbableNodes(); 6285 } 6286 state.active = true; 6287 state.paused = false; 6288 state.nodeFocusedBeforeActivation = _getActiveElement(doc); 6289 onActivate === null || onActivate === void 0 || onActivate(); 6290 var finishActivation = /* @__PURE__ */ function() { 6291 var _ref6 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee() { 6292 return _regenerator().w(function(_context) { 6293 while (1) 6294 switch (_context.n) { 6295 case 0: 6296 if (checkCanFocusTrap) { 6297 updateTabbableNodes(); 6298 } 6299 _context.n = 1; 6300 return addListeners(); 6301 case 1: 6302 trap._setSubtreeIsolation(true); 6303 updateObservedNodes(); 6304 onPostActivate === null || onPostActivate === void 0 || onPostActivate(); 6305 case 2: 6306 return _context.a(2); 6307 } 6308 }, _callee); 6309 })); 6310 return function finishActivation2() { 6311 return _ref6.apply(this, arguments); 6312 }; 6313 }(); 6314 if (checkCanFocusTrap) { 6315 checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation); 6316 return this; 6317 } 6318 finishActivation(); 6319 } catch (error2) { 6320 if (preexistingTrap === activeFocusTraps.getActiveTrap(trapStack) && revertState) { 6321 var _preexistingTrap$_set2; 6322 (_preexistingTrap$_set2 = preexistingTrap._setSubtreeIsolation) === null || _preexistingTrap$_set2 === void 0 || _preexistingTrap$_set2.call(preexistingTrap, true); 6323 } 6324 throw error2; 6325 } 6326 return this; 6327 }, 6328 deactivate: function deactivate(deactivateOptions) { 6329 if (!state.active) { 6330 return this; 6331 } 6332 var options = _objectSpread2({ 6333 onDeactivate: config.onDeactivate, 6334 onPostDeactivate: config.onPostDeactivate, 6335 checkCanReturnFocus: config.checkCanReturnFocus 6336 }, deactivateOptions); 6337 clearTimeout(state.delayInitialFocusTimer); 6338 state.delayInitialFocusTimer = void 0; 6339 if (!state.paused) { 6340 trap._setSubtreeIsolation(false); 6341 } 6342 state.alreadySilent.clear(); 6343 removeListeners(); 6344 state.active = false; 6345 state.paused = false; 6346 updateObservedNodes(); 6347 activeFocusTraps.deactivateTrap(trapStack, trap); 6348 var onDeactivate = getOption(options, "onDeactivate"); 6349 var onPostDeactivate = getOption(options, "onPostDeactivate"); 6350 var checkCanReturnFocus = getOption(options, "checkCanReturnFocus"); 6351 var returnFocus = getOption(options, "returnFocus", "returnFocusOnDeactivate"); 6352 onDeactivate === null || onDeactivate === void 0 || onDeactivate(); 6353 var finishDeactivation = function finishDeactivation2() { 6354 delay(function() { 6355 if (returnFocus) { 6356 _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)); 6357 } 6358 onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate(); 6359 }); 6360 }; 6361 if (returnFocus && checkCanReturnFocus) { 6362 checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation); 6363 return this; 6364 } 6365 finishDeactivation(); 6366 return this; 6367 }, 6368 pause: function pause(pauseOptions) { 6369 if (!state.active) { 6370 return this; 6371 } 6372 state.manuallyPaused = true; 6373 return this._setPausedState(true, pauseOptions); 6374 }, 6375 unpause: function unpause(unpauseOptions) { 6376 if (!state.active) { 6377 return this; 6378 } 6379 state.manuallyPaused = false; 6380 if (trapStack[trapStack.length - 1] !== this) { 6381 return this; 6382 } 6383 return this._setPausedState(false, unpauseOptions); 6384 }, 6385 updateContainerElements: function updateContainerElements(containerElements) { 6386 var elementsAsArray = [].concat(containerElements).filter(Boolean); 6387 state.containers = elementsAsArray.map(function(element) { 6388 return typeof element === "string" ? doc.querySelector(element) : element; 6389 }); 6390 if (config.isolateSubtrees) { 6391 collectAdjacentElements(state.containers); 6392 } 6393 if (state.active) { 6394 updateTabbableNodes(); 6395 if (!state.paused) { 6396 trap._setSubtreeIsolation(true); 6397 } 6398 } 6399 updateObservedNodes(); 6400 return this; 6401 } 6402 }; 6403 Object.defineProperties(trap, { 6404 _isManuallyPaused: { 6405 value: function value() { 6406 return state.manuallyPaused; 6407 } 6408 }, 6409 _setPausedState: { 6410 value: function value(paused, options) { 6411 if (state.paused === paused) { 6412 return this; 6413 } 6414 state.paused = paused; 6415 if (paused) { 6416 var onPause = getOption(options, "onPause"); 6417 var onPostPause = getOption(options, "onPostPause"); 6418 onPause === null || onPause === void 0 || onPause(); 6419 removeListeners(); 6420 trap._setSubtreeIsolation(false); 6421 updateObservedNodes(); 6422 onPostPause === null || onPostPause === void 0 || onPostPause(); 6423 } else { 6424 var onUnpause = getOption(options, "onUnpause"); 6425 var onPostUnpause = getOption(options, "onPostUnpause"); 6426 onUnpause === null || onUnpause === void 0 || onUnpause(); 6427 var finishUnpause = /* @__PURE__ */ function() { 6428 var _ref7 = _asyncToGenerator(/* @__PURE__ */ _regenerator().m(function _callee2() { 6429 return _regenerator().w(function(_context2) { 6430 while (1) 6431 switch (_context2.n) { 6432 case 0: 6433 updateTabbableNodes(); 6434 _context2.n = 1; 6435 return addListeners(); 6436 case 1: 6437 trap._setSubtreeIsolation(true); 6438 updateObservedNodes(); 6439 onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause(); 6440 case 2: 6441 return _context2.a(2); 6442 } 6443 }, _callee2); 6444 })); 6445 return function finishUnpause2() { 6446 return _ref7.apply(this, arguments); 6447 }; 6448 }(); 6449 finishUnpause(); 6450 } 6451 return this; 6452 } 6453 }, 6454 _setSubtreeIsolation: { 6455 value: function value(isEnabled) { 6456 if (config.isolateSubtrees) { 6457 state.adjacentElements.forEach(function(el) { 6458 var _el$getAttribute; 6459 if (isEnabled) { 6460 switch (config.isolateSubtrees) { 6461 case "aria-hidden": 6462 if (el.ariaHidden === "true" || ((_el$getAttribute = el.getAttribute("aria-hidden")) === null || _el$getAttribute === void 0 ? void 0 : _el$getAttribute.toLowerCase()) === "true") { 6463 state.alreadySilent.add(el); 6464 } 6465 el.setAttribute("aria-hidden", "true"); 6466 break; 6467 default: 6468 if (el.inert || el.hasAttribute("inert")) { 6469 state.alreadySilent.add(el); 6470 } 6471 el.setAttribute("inert", true); 6472 break; 6473 } 6474 } else { 6475 if (state.alreadySilent.has(el)) 6476 ; 6477 else { 6478 switch (config.isolateSubtrees) { 6479 case "aria-hidden": 6480 el.removeAttribute("aria-hidden"); 6481 break; 6482 default: 6483 el.removeAttribute("inert"); 6484 break; 6485 } 6486 } 6487 } 6488 }); 6489 } 6490 } 6491 } 6492 }); 6493 trap.updateContainerElements(elements); 6494 return trap; 6495 }; 6496 function src_default3(Alpine3) { 6497 let lastFocused; 6498 let currentFocused; 6499 window.addEventListener("focusin", () => { 6500 lastFocused = currentFocused; 6501 currentFocused = document.activeElement; 6502 }); 6503 Alpine3.magic("focus", (el) => { 6504 let within = el; 6505 return { 6506 __noscroll: false, 6507 __wrapAround: false, 6508 within(el2) { 6509 within = el2; 6510 return this; 6511 }, 6512 withoutScrolling() { 6513 this.__noscroll = true; 6514 return this; 6515 }, 6516 noscroll() { 6517 this.__noscroll = true; 6518 return this; 6519 }, 6520 withWrapAround() { 6521 this.__wrapAround = true; 6522 return this; 6523 }, 6524 wrap() { 6525 return this.withWrapAround(); 6526 }, 6527 focusable(el2) { 6528 return isFocusable(el2); 6529 }, 6530 previouslyFocused() { 6531 return lastFocused; 6532 }, 6533 lastFocused() { 6534 return lastFocused; 6535 }, 6536 focused() { 6537 return currentFocused; 6538 }, 6539 focusables() { 6540 if (Array.isArray(within)) 6541 return within; 6542 return focusable(within, { displayCheck: "none" }); 6543 }, 6544 all() { 6545 return this.focusables(); 6546 }, 6547 isFirst(el2) { 6548 let els2 = this.all(); 6549 return els2[0] && els2[0].isSameNode(el2); 6550 }, 6551 isLast(el2) { 6552 let els2 = this.all(); 6553 return els2.length && els2.slice(-1)[0].isSameNode(el2); 6554 }, 6555 getFirst() { 6556 return this.all()[0]; 6557 }, 6558 getLast() { 6559 return this.all().slice(-1)[0]; 6560 }, 6561 getNext() { 6562 let list = this.all(); 6563 let current = document.activeElement; 6564 if (list.indexOf(current) === -1) 6565 return; 6566 if (this.__wrapAround && list.indexOf(current) === list.length - 1) { 6567 return list[0]; 6568 } 6569 return list[list.indexOf(current) + 1]; 6570 }, 6571 getPrevious() { 6572 let list = this.all(); 6573 let current = document.activeElement; 6574 if (list.indexOf(current) === -1) 6575 return; 6576 if (this.__wrapAround && list.indexOf(current) === 0) { 6577 return list.slice(-1)[0]; 6578 } 6579 return list[list.indexOf(current) - 1]; 6580 }, 6581 first() { 6582 this.focus(this.getFirst()); 6583 }, 6584 last() { 6585 this.focus(this.getLast()); 6586 }, 6587 next() { 6588 this.focus(this.getNext()); 6589 }, 6590 previous() { 6591 this.focus(this.getPrevious()); 6592 }, 6593 prev() { 6594 return this.previous(); 6595 }, 6596 focus(el2) { 6597 if (!el2) 6598 return; 6599 setTimeout(() => { 6600 if (!el2.hasAttribute("tabindex")) 6601 el2.setAttribute("tabindex", "0"); 6602 el2.focus({ preventScroll: this.__noscroll }); 6603 }); 6604 } 6605 }; 6606 }); 6607 Alpine3.directive("trap", Alpine3.skipDuringClone((el, { expression, modifiers }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 6608 let evaluator = evaluateLater2(expression); 6609 let oldValue = false; 6610 let options = { 6611 escapeDeactivates: false, 6612 allowOutsideClick: true, 6613 fallbackFocus: () => el 6614 }; 6615 let undoInert = () => { 6616 }; 6617 if (modifiers.includes("noautofocus")) { 6618 options.initialFocus = false; 6619 } else { 6620 let autofocusEl = el.querySelector("[autofocus]"); 6621 if (autofocusEl) 6622 options.initialFocus = autofocusEl; 6623 } 6624 if (modifiers.includes("inert")) { 6625 options.onPostActivate = () => { 6626 Alpine3.nextTick(() => { 6627 undoInert = setInert(el); 6628 }); 6629 }; 6630 } 6631 let trap = createFocusTrap(el, options); 6632 let undoDisableScrolling = () => { 6633 }; 6634 const releaseFocus = () => { 6635 undoInert(); 6636 undoInert = () => { 6637 }; 6638 undoDisableScrolling(); 6639 undoDisableScrolling = () => { 6640 }; 6641 trap.deactivate({ 6642 returnFocus: !modifiers.includes("noreturn") 6643 }); 6644 }; 6645 effect3(() => evaluator((value) => { 6646 if (oldValue === value) 6647 return; 6648 if (value && !oldValue) { 6649 if (modifiers.includes("noscroll")) 6650 undoDisableScrolling = disableScrolling(); 6651 setTimeout(() => { 6652 trap.activate(); 6653 }, 15); 6654 } 6655 if (!value && oldValue) { 6656 releaseFocus(); 6657 } 6658 oldValue = !!value; 6659 })); 6660 cleanup2(releaseFocus); 6661 }, (el, { expression, modifiers }, { evaluate: evaluate3 }) => { 6662 if (modifiers.includes("inert") && evaluate3(expression)) 6663 setInert(el); 6664 })); 6665 } 6666 function setInert(el) { 6667 let undos = []; 6668 crawlSiblingsUp(el, (sibling) => { 6669 let cache = sibling.hasAttribute("aria-hidden"); 6670 sibling.setAttribute("aria-hidden", "true"); 6671 undos.push(() => cache || sibling.removeAttribute("aria-hidden")); 6672 }); 6673 return () => { 6674 while (undos.length) 6675 undos.pop()(); 6676 }; 6677 } 6678 function crawlSiblingsUp(el, callback) { 6679 if (el.isSameNode(document.body) || !el.parentNode) 6680 return; 6681 Array.from(el.parentNode.children).forEach((sibling) => { 6682 if (sibling.isSameNode(el)) { 6683 crawlSiblingsUp(el.parentNode, callback); 6684 } else { 6685 callback(sibling); 6686 } 6687 }); 6688 } 6689 function disableScrolling() { 6690 let overflow = document.documentElement.style.overflow; 6691 let paddingRight = document.documentElement.style.paddingRight; 6692 let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 6693 let scrollbarGutter = window.getComputedStyle(document.documentElement).scrollbarGutter; 6694 document.documentElement.style.overflow = "hidden"; 6695 if (scrollbarGutter && scrollbarGutter !== "auto") { 6696 return () => { 6697 document.documentElement.style.overflow = overflow; 6698 }; 6699 } 6700 document.documentElement.style.paddingRight = `${scrollbarWidth}px`; 6701 return () => { 6702 document.documentElement.style.overflow = overflow; 6703 document.documentElement.style.paddingRight = paddingRight; 6704 }; 6705 } 6706 var module_default3 = src_default3; 6707 6708
vendor: 1,953 bytes, lines 6708-6770
6708// node_modules/@alpinejs/persist/dist/module.esm.js 6709 function src_default4(Alpine3) { 6710 let persist = () => { 6711 let alias; 6712 let storage; 6713 try { 6714 storage = localStorage; 6715 } catch (e) { 6716 console.error(e); 6717 console.warn("Alpine: $persist is using temporary storage since localStorage is unavailable."); 6718 let dummy = /* @__PURE__ */ new Map(); 6719 storage = { 6720 getItem: dummy.get.bind(dummy), 6721 setItem: dummy.set.bind(dummy) 6722 }; 6723 } 6724 return Alpine3.interceptor((initialValue, getter, setter, path, key) => { 6725 let lookup = alias || `_x_${path}`; 6726 let initial = storageHas(lookup, storage) ? storageGet(lookup, storage) : initialValue; 6727 setter(initial); 6728 Alpine3.effect(() => { 6729 let value = getter(); 6730 storageSet(lookup, value, storage); 6731 setter(value); 6732 }); 6733 return initial; 6734 }, (func) => { 6735 func.as = (key) => { 6736 alias = key; 6737 return func; 6738 }, func.using = (target) => { 6739 storage = target; 6740 return func; 6741 }; 6742 }); 6743 }; 6744 Object.defineProperty(Alpine3, "$persist", { get: () => persist() }); 6745 Alpine3.magic("persist", persist); 6746 Alpine3.persist = (key, { get: get3, set: set3 }, storage = localStorage) => { 6747 let initial = storageHas(key, storage) ? storageGet(key, storage) : get3(); 6748 set3(initial); 6749 Alpine3.effect(() => { 6750 let value = get3(); 6751 storageSet(key, value, storage); 6752 set3(value); 6753 }); 6754 }; 6755 } 6756 function storageHas(key, storage) { 6757 return storage.getItem(key) !== null; 6758 } 6759 function storageGet(key, storage) { 6760 let value = storage.getItem(key); 6761 if (value === void 0) 6762 return; 6763 return JSON.parse(value); 6764 } 6765 function storageSet(key, value, storage) { 6766 storage.setItem(key, JSON.stringify(value)); 6767 } 6768 var module_default4 = src_default4; 6769 6770
vendor: 1,851 bytes, lines 6770-6825
6770// node_modules/@alpinejs/intersect/dist/module.esm.js 6771 function src_default5(Alpine3) { 6772 Alpine3.directive("intersect", Alpine3.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 6773 let evaluate3 = evaluateLater2(expression); 6774 let options = { 6775 rootMargin: getRootMargin(modifiers), 6776 threshold: getThreshold(modifiers) 6777 }; 6778 let observer2 = new IntersectionObserver((entries) => { 6779 entries.forEach((entry) => { 6780 if (entry.isIntersecting === (value === "leave")) 6781 return; 6782 evaluate3(); 6783 modifiers.includes("once") && observer2.disconnect(); 6784 }); 6785 }, options); 6786 observer2.observe(el); 6787 cleanup2(() => { 6788 observer2.disconnect(); 6789 }); 6790 })); 6791 } 6792 function getThreshold(modifiers) { 6793 if (modifiers.includes("full")) 6794 return 0.99; 6795 if (modifiers.includes("half")) 6796 return 0.5; 6797 if (!modifiers.includes("threshold")) 6798 return 0; 6799 let threshold = modifiers[modifiers.indexOf("threshold") + 1]; 6800 if (threshold === "100") 6801 return 1; 6802 if (threshold === "0") 6803 return 0; 6804 return Number(`.${threshold}`); 6805 } 6806 function getLengthValue(rawValue) { 6807 let match = rawValue.match(/^(-?[0-9]+)(px|%)?$/); 6808 return match ? match[1] + (match[2] || "px") : void 0; 6809 } 6810 function getRootMargin(modifiers) { 6811 const key = "margin"; 6812 const fallback2 = "0px 0px 0px 0px"; 6813 const index = modifiers.indexOf(key); 6814 if (index === -1) 6815 return fallback2; 6816 let values = []; 6817 for (let i = 1; i < 5; i++) { 6818 values.push(getLengthValue(modifiers[index + i] || "")); 6819 } 6820 values = values.filter((v) => v !== void 0); 6821 return values.length ? values.join(" ").trim() : fallback2; 6822 } 6823 var module_default5 = src_default5; 6824 6825
vendor: 1,677 bytes, lines 6825-6870
6825// node_modules/@alpinejs/resize/dist/module.esm.js 6826 function src_default6(Alpine3) { 6827 Alpine3.directive("resize", Alpine3.skipDuringClone((el, { value, expression, modifiers }, { evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 6828 let evaluator = evaluateLater2(expression); 6829 let evaluate3 = (width, height) => { 6830 evaluator(() => { 6831 }, { scope: { "$width": width, "$height": height } }); 6832 }; 6833 let off = modifiers.includes("document") ? onDocumentResize(evaluate3) : onElResize(el, evaluate3); 6834 cleanup2(() => off()); 6835 })); 6836 } 6837 function onElResize(el, callback) { 6838 let observer2 = new ResizeObserver((entries) => { 6839 let [width, height] = dimensions(entries); 6840 callback(width, height); 6841 }); 6842 observer2.observe(el); 6843 return () => observer2.disconnect(); 6844 } 6845 var documentResizeObserver; 6846 var documentResizeObserverCallbacks = /* @__PURE__ */ new Set(); 6847 function onDocumentResize(callback) { 6848 documentResizeObserverCallbacks.add(callback); 6849 if (!documentResizeObserver) { 6850 documentResizeObserver = new ResizeObserver((entries) => { 6851 let [width, height] = dimensions(entries); 6852 documentResizeObserverCallbacks.forEach((i) => i(width, height)); 6853 }); 6854 documentResizeObserver.observe(document.documentElement); 6855 } 6856 return () => { 6857 documentResizeObserverCallbacks.delete(callback); 6858 }; 6859 } 6860 function dimensions(entries) { 6861 let width, height; 6862 for (let entry of entries) { 6863 width = entry.borderBoxSize[0].inlineSize; 6864 height = entry.borderBoxSize[0].blockSize; 6865 } 6866 return [width, height]; 6867 } 6868 var module_default6 = src_default6; 6869 6870
vendor: 42,747 bytes, lines 6870-8117
6870// node_modules/@alpinejs/anchor/dist/module.esm.js 6871 var min = Math.min; 6872 var max = Math.max; 6873 var round = Math.round; 6874 var floor = Math.floor; 6875 var createCoords = (v) => ({ 6876 x: v, 6877 y: v 6878 }); 6879 var oppositeSideMap = { 6880 left: "right", 6881 right: "left", 6882 bottom: "top", 6883 top: "bottom" 6884 }; 6885 var oppositeAlignmentMap = { 6886 start: "end", 6887 end: "start" 6888 }; 6889 function clamp(start3, value, end) { 6890 return max(start3, min(value, end)); 6891 } 6892 function evaluate2(value, param) { 6893 return typeof value === "function" ? value(param) : value; 6894 } 6895 function getSide(placement) { 6896 return placement.split("-")[0]; 6897 } 6898 function getAlignment(placement) { 6899 return placement.split("-")[1]; 6900 } 6901 function getOppositeAxis(axis) { 6902 return axis === "x" ? "y" : "x"; 6903 } 6904 function getAxisLength(axis) { 6905 return axis === "y" ? "height" : "width"; 6906 } 6907 function getSideAxis(placement) { 6908 return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; 6909 } 6910 function getAlignmentAxis(placement) { 6911 return getOppositeAxis(getSideAxis(placement)); 6912 } 6913 function getAlignmentSides(placement, rects, rtl) { 6914 if (rtl === void 0) { 6915 rtl = false; 6916 } 6917 const alignment = getAlignment(placement); 6918 const alignmentAxis = getAlignmentAxis(placement); 6919 const length = getAxisLength(alignmentAxis); 6920 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 6921 if (rects.reference[length] > rects.floating[length]) { 6922 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 6923 } 6924 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 6925 } 6926 function getExpandedPlacements(placement) { 6927 const oppositePlacement = getOppositePlacement(placement); 6928 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 6929 } 6930 function getOppositeAlignmentPlacement(placement) { 6931 return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); 6932 } 6933 function getSideList(side, isStart, rtl) { 6934 const lr = ["left", "right"]; 6935 const rl = ["right", "left"]; 6936 const tb = ["top", "bottom"]; 6937 const bt = ["bottom", "top"]; 6938 switch (side) { 6939 case "top": 6940 case "bottom": 6941 if (rtl) 6942 return isStart ? rl : lr; 6943 return isStart ? lr : rl; 6944 case "left": 6945 case "right": 6946 return isStart ? tb : bt; 6947 default: 6948 return []; 6949 } 6950 } 6951 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 6952 const alignment = getAlignment(placement); 6953 let list = getSideList(getSide(placement), direction === "start", rtl); 6954 if (alignment) { 6955 list = list.map((side) => side + "-" + alignment); 6956 if (flipAlignment) { 6957 list = list.concat(list.map(getOppositeAlignmentPlacement)); 6958 } 6959 } 6960 return list; 6961 } 6962 function getOppositePlacement(placement) { 6963 return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); 6964 } 6965 function expandPaddingObject(padding) { 6966 return { 6967 top: 0, 6968 right: 0, 6969 bottom: 0, 6970 left: 0, 6971 ...padding 6972 }; 6973 } 6974 function getPaddingObject(padding) { 6975 return typeof padding !== "number" ? expandPaddingObject(padding) : { 6976 top: padding, 6977 right: padding, 6978 bottom: padding, 6979 left: padding 6980 }; 6981 } 6982 function rectToClientRect(rect) { 6983 return { 6984 ...rect, 6985 top: rect.y, 6986 left: rect.x, 6987 right: rect.x + rect.width, 6988 bottom: rect.y + rect.height 6989 }; 6990 } 6991 function computeCoordsFromPlacement(_ref, placement, rtl) { 6992 let { 6993 reference, 6994 floating 6995 } = _ref; 6996 const sideAxis = getSideAxis(placement); 6997 const alignmentAxis = getAlignmentAxis(placement); 6998 const alignLength = getAxisLength(alignmentAxis); 6999 const side = getSide(placement); 7000 const isVertical = sideAxis === "y"; 7001 const commonX = reference.x + reference.width / 2 - floating.width / 2; 7002 const commonY = reference.y + reference.height / 2 - floating.height / 2; 7003 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 7004 let coords; 7005 switch (side) { 7006 case "top": 7007 coords = { 7008 x: commonX, 7009 y: reference.y - floating.height 7010 }; 7011 break; 7012 case "bottom": 7013 coords = { 7014 x: commonX, 7015 y: reference.y + reference.height 7016 }; 7017 break; 7018 case "right": 7019 coords = { 7020 x: reference.x + reference.width, 7021 y: commonY 7022 }; 7023 break; 7024 case "left": 7025 coords = { 7026 x: reference.x - floating.width, 7027 y: commonY 7028 }; 7029 break; 7030 default: 7031 coords = { 7032 x: reference.x, 7033 y: reference.y 7034 }; 7035 } 7036 switch (getAlignment(placement)) { 7037 case "start": 7038 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 7039 break; 7040 case "end": 7041 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 7042 break; 7043 } 7044 return coords; 7045 } 7046 var computePosition = async (reference, floating, config) => { 7047 const { 7048 placement = "bottom", 7049 strategy = "absolute", 7050 middleware = [], 7051 platform: platform2 7052 } = config; 7053 const validMiddleware = middleware.filter(Boolean); 7054 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); 7055 let rects = await platform2.getElementRects({ 7056 reference, 7057 floating, 7058 strategy 7059 }); 7060 let { 7061 x, 7062 y 7063 } = computeCoordsFromPlacement(rects, placement, rtl); 7064 let statefulPlacement = placement; 7065 let middlewareData = {}; 7066 let resetCount = 0; 7067 for (let i = 0; i < validMiddleware.length; i++) { 7068 const { 7069 name, 7070 fn 7071 } = validMiddleware[i]; 7072 const { 7073 x: nextX, 7074 y: nextY, 7075 data: data2, 7076 reset 7077 } = await fn({ 7078 x, 7079 y, 7080 initialPlacement: placement, 7081 placement: statefulPlacement, 7082 strategy, 7083 middlewareData, 7084 rects, 7085 platform: platform2, 7086 elements: { 7087 reference, 7088 floating 7089 } 7090 }); 7091 x = nextX != null ? nextX : x; 7092 y = nextY != null ? nextY : y; 7093 middlewareData = { 7094 ...middlewareData, 7095 [name]: { 7096 ...middlewareData[name], 7097 ...data2 7098 } 7099 }; 7100 if (reset && resetCount <= 50) { 7101 resetCount++; 7102 if (typeof reset === "object") { 7103 if (reset.placement) { 7104 statefulPlacement = reset.placement; 7105 } 7106 if (reset.rects) { 7107 rects = reset.rects === true ? await platform2.getElementRects({ 7108 reference, 7109 floating, 7110 strategy 7111 }) : reset.rects; 7112 } 7113 ({ 7114 x, 7115 y 7116 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 7117 } 7118 i = -1; 7119 continue; 7120 } 7121 } 7122 return { 7123 x, 7124 y, 7125 placement: statefulPlacement, 7126 strategy, 7127 middlewareData 7128 }; 7129 }; 7130 async function detectOverflow(state, options) { 7131 var _await$platform$isEle; 7132 if (options === void 0) { 7133 options = {}; 7134 } 7135 const { 7136 x, 7137 y, 7138 platform: platform2, 7139 rects, 7140 elements, 7141 strategy 7142 } = state; 7143 const { 7144 boundary = "clippingAncestors", 7145 rootBoundary = "viewport", 7146 elementContext = "floating", 7147 altBoundary = false, 7148 padding = 0 7149 } = evaluate2(options, state); 7150 const paddingObject = getPaddingObject(padding); 7151 const altContext = elementContext === "floating" ? "reference" : "floating"; 7152 const element = elements[altBoundary ? altContext : elementContext]; 7153 const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ 7154 element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)), 7155 boundary, 7156 rootBoundary, 7157 strategy 7158 })); 7159 const rect = elementContext === "floating" ? { 7160 ...rects.floating, 7161 x, 7162 y 7163 } : rects.reference; 7164 const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); 7165 const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { 7166 x: 1, 7167 y: 1 7168 } : { 7169 x: 1, 7170 y: 1 7171 }; 7172 const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ 7173 rect, 7174 offsetParent, 7175 strategy 7176 }) : rect); 7177 return { 7178 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 7179 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 7180 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 7181 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 7182 }; 7183 } 7184 var flip = function(options) { 7185 if (options === void 0) { 7186 options = {}; 7187 } 7188 return { 7189 name: "flip", 7190 options, 7191 async fn(state) { 7192 var _middlewareData$arrow, _middlewareData$flip; 7193 const { 7194 placement, 7195 middlewareData, 7196 rects, 7197 initialPlacement, 7198 platform: platform2, 7199 elements 7200 } = state; 7201 const { 7202 mainAxis: checkMainAxis = true, 7203 crossAxis: checkCrossAxis = true, 7204 fallbackPlacements: specifiedFallbackPlacements, 7205 fallbackStrategy = "bestFit", 7206 fallbackAxisSideDirection = "none", 7207 flipAlignment = true, 7208 ...detectOverflowOptions 7209 } = evaluate2(options, state); 7210 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 7211 return {}; 7212 } 7213 const side = getSide(placement); 7214 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 7215 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); 7216 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 7217 if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") { 7218 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 7219 } 7220 const placements2 = [initialPlacement, ...fallbackPlacements]; 7221 const overflow = await detectOverflow(state, detectOverflowOptions); 7222 const overflows = []; 7223 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 7224 if (checkMainAxis) { 7225 overflows.push(overflow[side]); 7226 } 7227 if (checkCrossAxis) { 7228 const sides2 = getAlignmentSides(placement, rects, rtl); 7229 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 7230 } 7231 overflowsData = [...overflowsData, { 7232 placement, 7233 overflows 7234 }]; 7235 if (!overflows.every((side2) => side2 <= 0)) { 7236 var _middlewareData$flip2, _overflowsData$filter; 7237 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 7238 const nextPlacement = placements2[nextIndex]; 7239 if (nextPlacement) { 7240 return { 7241 data: { 7242 index: nextIndex, 7243 overflows: overflowsData 7244 }, 7245 reset: { 7246 placement: nextPlacement 7247 } 7248 }; 7249 } 7250 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 7251 if (!resetPlacement) { 7252 switch (fallbackStrategy) { 7253 case "bestFit": { 7254 var _overflowsData$map$so; 7255 const placement2 = (_overflowsData$map$so = overflowsData.map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; 7256 if (placement2) { 7257 resetPlacement = placement2; 7258 } 7259 break; 7260 } 7261 case "initialPlacement": 7262 resetPlacement = initialPlacement; 7263 break; 7264 } 7265 } 7266 if (placement !== resetPlacement) { 7267 return { 7268 reset: { 7269 placement: resetPlacement 7270 } 7271 }; 7272 } 7273 } 7274 return {}; 7275 } 7276 }; 7277 }; 7278 async function convertValueToCoords(state, options) { 7279 const { 7280 placement, 7281 platform: platform2, 7282 elements 7283 } = state; 7284 const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); 7285 const side = getSide(placement); 7286 const alignment = getAlignment(placement); 7287 const isVertical = getSideAxis(placement) === "y"; 7288 const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1; 7289 const crossAxisMulti = rtl && isVertical ? -1 : 1; 7290 const rawValue = evaluate2(options, state); 7291 let { 7292 mainAxis, 7293 crossAxis, 7294 alignmentAxis 7295 } = typeof rawValue === "number" ? { 7296 mainAxis: rawValue, 7297 crossAxis: 0, 7298 alignmentAxis: null 7299 } : { 7300 mainAxis: 0, 7301 crossAxis: 0, 7302 alignmentAxis: null, 7303 ...rawValue 7304 }; 7305 if (alignment && typeof alignmentAxis === "number") { 7306 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 7307 } 7308 return isVertical ? { 7309 x: crossAxis * crossAxisMulti, 7310 y: mainAxis * mainAxisMulti 7311 } : { 7312 x: mainAxis * mainAxisMulti, 7313 y: crossAxis * crossAxisMulti 7314 }; 7315 } 7316 var offset = function(options) { 7317 if (options === void 0) { 7318 options = 0; 7319 } 7320 return { 7321 name: "offset", 7322 options, 7323 async fn(state) { 7324 const { 7325 x, 7326 y 7327 } = state; 7328 const diffCoords = await convertValueToCoords(state, options); 7329 return { 7330 x: x + diffCoords.x, 7331 y: y + diffCoords.y, 7332 data: diffCoords 7333 }; 7334 } 7335 }; 7336 }; 7337 var shift = function(options) { 7338 if (options === void 0) { 7339 options = {}; 7340 } 7341 return { 7342 name: "shift", 7343 options, 7344 async fn(state) { 7345 const { 7346 x, 7347 y, 7348 placement 7349 } = state; 7350 const { 7351 mainAxis: checkMainAxis = true, 7352 crossAxis: checkCrossAxis = false, 7353 limiter = { 7354 fn: (_ref) => { 7355 let { 7356 x: x2, 7357 y: y2 7358 } = _ref; 7359 return { 7360 x: x2, 7361 y: y2 7362 }; 7363 } 7364 }, 7365 ...detectOverflowOptions 7366 } = evaluate2(options, state); 7367 const coords = { 7368 x, 7369 y 7370 }; 7371 const overflow = await detectOverflow(state, detectOverflowOptions); 7372 const crossAxis = getSideAxis(getSide(placement)); 7373 const mainAxis = getOppositeAxis(crossAxis); 7374 let mainAxisCoord = coords[mainAxis]; 7375 let crossAxisCoord = coords[crossAxis]; 7376 if (checkMainAxis) { 7377 const minSide = mainAxis === "y" ? "top" : "left"; 7378 const maxSide = mainAxis === "y" ? "bottom" : "right"; 7379 const min2 = mainAxisCoord + overflow[minSide]; 7380 const max2 = mainAxisCoord - overflow[maxSide]; 7381 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 7382 } 7383 if (checkCrossAxis) { 7384 const minSide = crossAxis === "y" ? "top" : "left"; 7385 const maxSide = crossAxis === "y" ? "bottom" : "right"; 7386 const min2 = crossAxisCoord + overflow[minSide]; 7387 const max2 = crossAxisCoord - overflow[maxSide]; 7388 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 7389 } 7390 const limitedCoords = limiter.fn({ 7391 ...state, 7392 [mainAxis]: mainAxisCoord, 7393 [crossAxis]: crossAxisCoord 7394 }); 7395 return { 7396 ...limitedCoords, 7397 data: { 7398 x: limitedCoords.x - x, 7399 y: limitedCoords.y - y 7400 } 7401 }; 7402 } 7403 }; 7404 }; 7405 function getNodeName(node) { 7406 if (isNode(node)) { 7407 return (node.nodeName || "").toLowerCase(); 7408 } 7409 return "#document"; 7410 } 7411 function getWindow(node) { 7412 var _node$ownerDocument; 7413 return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 7414 } 7415 function getDocumentElement(node) { 7416 var _ref; 7417 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 7418 } 7419 function isNode(value) { 7420 return value instanceof Node || value instanceof getWindow(value).Node; 7421 } 7422 function isElement(value) { 7423 return value instanceof Element || value instanceof getWindow(value).Element; 7424 } 7425 function isHTMLElement(value) { 7426 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 7427 } 7428 function isShadowRoot(value) { 7429 if (typeof ShadowRoot === "undefined") { 7430 return false; 7431 } 7432 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 7433 } 7434 function isOverflowElement(element) { 7435 const { 7436 overflow, 7437 overflowX, 7438 overflowY, 7439 display 7440 } = getComputedStyle2(element); 7441 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); 7442 } 7443 function isTableElement(element) { 7444 return ["table", "td", "th"].includes(getNodeName(element)); 7445 } 7446 function isContainingBlock(element) { 7447 const webkit = isWebKit(); 7448 const css = getComputedStyle2(element); 7449 return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value)); 7450 } 7451 function getContainingBlock(element) { 7452 let currentNode = getParentNode(element); 7453 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 7454 if (isContainingBlock(currentNode)) { 7455 return currentNode; 7456 } else { 7457 currentNode = getParentNode(currentNode); 7458 } 7459 } 7460 return null; 7461 } 7462 function isWebKit() { 7463 if (typeof CSS === "undefined" || !CSS.supports) 7464 return false; 7465 return CSS.supports("-webkit-backdrop-filter", "none"); 7466 } 7467 function isLastTraversableNode(node) { 7468 return ["html", "body", "#document"].includes(getNodeName(node)); 7469 } 7470 function getComputedStyle2(element) { 7471 return getWindow(element).getComputedStyle(element); 7472 } 7473 function getNodeScroll(element) { 7474 if (isElement(element)) { 7475 return { 7476 scrollLeft: element.scrollLeft, 7477 scrollTop: element.scrollTop 7478 }; 7479 } 7480 return { 7481 scrollLeft: element.pageXOffset, 7482 scrollTop: element.pageYOffset 7483 }; 7484 } 7485 function getParentNode(node) { 7486 if (getNodeName(node) === "html") { 7487 return node; 7488 } 7489 const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node); 7490 return isShadowRoot(result) ? result.host : result; 7491 } 7492 function getNearestOverflowAncestor(node) { 7493 const parentNode = getParentNode(node); 7494 if (isLastTraversableNode(parentNode)) { 7495 return node.ownerDocument ? node.ownerDocument.body : node.body; 7496 } 7497 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 7498 return parentNode; 7499 } 7500 return getNearestOverflowAncestor(parentNode); 7501 } 7502 function getOverflowAncestors(node, list, traverseIframes) { 7503 var _node$ownerDocument2; 7504 if (list === void 0) { 7505 list = []; 7506 } 7507 if (traverseIframes === void 0) { 7508 traverseIframes = true; 7509 } 7510 const scrollableAncestor = getNearestOverflowAncestor(node); 7511 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 7512 const win = getWindow(scrollableAncestor); 7513 if (isBody) { 7514 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []); 7515 } 7516 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 7517 } 7518 function getCssDimensions(element) { 7519 const css = getComputedStyle2(element); 7520 let width = parseFloat(css.width) || 0; 7521 let height = parseFloat(css.height) || 0; 7522 const hasOffset = isHTMLElement(element); 7523 const offsetWidth = hasOffset ? element.offsetWidth : width; 7524 const offsetHeight = hasOffset ? element.offsetHeight : height; 7525 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7526 if (shouldFallback) { 7527 width = offsetWidth; 7528 height = offsetHeight; 7529 } 7530 return { 7531 width, 7532 height, 7533 $: shouldFallback 7534 }; 7535 } 7536 function unwrapElement(element) { 7537 return !isElement(element) ? element.contextElement : element; 7538 } 7539 function getScale(element) { 7540 const domElement = unwrapElement(element); 7541 if (!isHTMLElement(domElement)) { 7542 return createCoords(1); 7543 } 7544 const rect = domElement.getBoundingClientRect(); 7545 const { 7546 width, 7547 height, 7548 $ 7549 } = getCssDimensions(domElement); 7550 let x = ($ ? round(rect.width) : rect.width) / width; 7551 let y = ($ ? round(rect.height) : rect.height) / height; 7552 if (!x || !Number.isFinite(x)) { 7553 x = 1; 7554 } 7555 if (!y || !Number.isFinite(y)) { 7556 y = 1; 7557 } 7558 return { 7559 x, 7560 y 7561 }; 7562 } 7563 var noOffsets = /* @__PURE__ */ createCoords(0); 7564 function getVisualOffsets(element) { 7565 const win = getWindow(element); 7566 if (!isWebKit() || !win.visualViewport) { 7567 return noOffsets; 7568 } 7569 return { 7570 x: win.visualViewport.offsetLeft, 7571 y: win.visualViewport.offsetTop 7572 }; 7573 } 7574 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 7575 if (isFixed === void 0) { 7576 isFixed = false; 7577 } 7578 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 7579 return false; 7580 } 7581 return isFixed; 7582 } 7583 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 7584 if (includeScale === void 0) { 7585 includeScale = false; 7586 } 7587 if (isFixedStrategy === void 0) { 7588 isFixedStrategy = false; 7589 } 7590 const clientRect = element.getBoundingClientRect(); 7591 const domElement = unwrapElement(element); 7592 let scale = createCoords(1); 7593 if (includeScale) { 7594 if (offsetParent) { 7595 if (isElement(offsetParent)) { 7596 scale = getScale(offsetParent); 7597 } 7598 } else { 7599 scale = getScale(element); 7600 } 7601 } 7602 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 7603 let x = (clientRect.left + visualOffsets.x) / scale.x; 7604 let y = (clientRect.top + visualOffsets.y) / scale.y; 7605 let width = clientRect.width / scale.x; 7606 let height = clientRect.height / scale.y; 7607 if (domElement) { 7608 const win = getWindow(domElement); 7609 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 7610 let currentIFrame = win.frameElement; 7611 while (currentIFrame && offsetParent && offsetWin !== win) { 7612 const iframeScale = getScale(currentIFrame); 7613 const iframeRect = currentIFrame.getBoundingClientRect(); 7614 const css = getComputedStyle2(currentIFrame); 7615 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 7616 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 7617 x *= iframeScale.x; 7618 y *= iframeScale.y; 7619 width *= iframeScale.x; 7620 height *= iframeScale.y; 7621 x += left; 7622 y += top; 7623 currentIFrame = getWindow(currentIFrame).frameElement; 7624 } 7625 } 7626 return rectToClientRect({ 7627 width, 7628 height, 7629 x, 7630 y 7631 }); 7632 } 7633 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 7634 let { 7635 rect, 7636 offsetParent, 7637 strategy 7638 } = _ref; 7639 const isOffsetParentAnElement = isHTMLElement(offsetParent); 7640 const documentElement = getDocumentElement(offsetParent); 7641 if (offsetParent === documentElement) { 7642 return rect; 7643 } 7644 let scroll = { 7645 scrollLeft: 0, 7646 scrollTop: 0 7647 }; 7648 let scale = createCoords(1); 7649 const offsets = createCoords(0); 7650 if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") { 7651 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 7652 scroll = getNodeScroll(offsetParent); 7653 } 7654 if (isHTMLElement(offsetParent)) { 7655 const offsetRect = getBoundingClientRect(offsetParent); 7656 scale = getScale(offsetParent); 7657 offsets.x = offsetRect.x + offsetParent.clientLeft; 7658 offsets.y = offsetRect.y + offsetParent.clientTop; 7659 } 7660 } 7661 return { 7662 width: rect.width * scale.x, 7663 height: rect.height * scale.y, 7664 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x, 7665 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y 7666 }; 7667 } 7668 function getClientRects(element) { 7669 return Array.from(element.getClientRects()); 7670 } 7671 function getWindowScrollBarX(element) { 7672 return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; 7673 } 7674 function getDocumentRect(element) { 7675 const html = getDocumentElement(element); 7676 const scroll = getNodeScroll(element); 7677 const body = element.ownerDocument.body; 7678 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 7679 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 7680 let x = -scroll.scrollLeft + getWindowScrollBarX(element); 7681 const y = -scroll.scrollTop; 7682 if (getComputedStyle2(body).direction === "rtl") { 7683 x += max(html.clientWidth, body.clientWidth) - width; 7684 } 7685 return { 7686 width, 7687 height, 7688 x, 7689 y 7690 }; 7691 } 7692 function getViewportRect(element, strategy) { 7693 const win = getWindow(element); 7694 const html = getDocumentElement(element); 7695 const visualViewport = win.visualViewport; 7696 let width = html.clientWidth; 7697 let height = html.clientHeight; 7698 let x = 0; 7699 let y = 0; 7700 if (visualViewport) { 7701 width = visualViewport.width; 7702 height = visualViewport.height; 7703 const visualViewportBased = isWebKit(); 7704 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 7705 x = visualViewport.offsetLeft; 7706 y = visualViewport.offsetTop; 7707 } 7708 } 7709 return { 7710 width, 7711 height, 7712 x, 7713 y 7714 }; 7715 } 7716 function getInnerBoundingClientRect(element, strategy) { 7717 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 7718 const top = clientRect.top + element.clientTop; 7719 const left = clientRect.left + element.clientLeft; 7720 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 7721 const width = element.clientWidth * scale.x; 7722 const height = element.clientHeight * scale.y; 7723 const x = left * scale.x; 7724 const y = top * scale.y; 7725 return { 7726 width, 7727 height, 7728 x, 7729 y 7730 }; 7731 } 7732 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 7733 let rect; 7734 if (clippingAncestor === "viewport") { 7735 rect = getViewportRect(element, strategy); 7736 } else if (clippingAncestor === "document") { 7737 rect = getDocumentRect(getDocumentElement(element)); 7738 } else if (isElement(clippingAncestor)) { 7739 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 7740 } else { 7741 const visualOffsets = getVisualOffsets(element); 7742 rect = { 7743 ...clippingAncestor, 7744 x: clippingAncestor.x - visualOffsets.x, 7745 y: clippingAncestor.y - visualOffsets.y 7746 }; 7747 } 7748 return rectToClientRect(rect); 7749 } 7750 function hasFixedPositionAncestor(element, stopNode) { 7751 const parentNode = getParentNode(element); 7752 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 7753 return false; 7754 } 7755 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 7756 } 7757 function getClippingElementAncestors(element, cache) { 7758 const cachedResult = cache.get(element); 7759 if (cachedResult) { 7760 return cachedResult; 7761 } 7762 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 7763 let currentContainingBlockComputedStyle = null; 7764 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 7765 let currentNode = elementIsFixed ? getParentNode(element) : element; 7766 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 7767 const computedStyle = getComputedStyle2(currentNode); 7768 const currentNodeIsContaining = isContainingBlock(currentNode); 7769 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 7770 currentContainingBlockComputedStyle = null; 7771 } 7772 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 7773 if (shouldDropCurrentNode) { 7774 result = result.filter((ancestor) => ancestor !== currentNode); 7775 } else { 7776 currentContainingBlockComputedStyle = computedStyle; 7777 } 7778 currentNode = getParentNode(currentNode); 7779 } 7780 cache.set(element, result); 7781 return result; 7782 } 7783 function getClippingRect(_ref) { 7784 let { 7785 element, 7786 boundary, 7787 rootBoundary, 7788 strategy 7789 } = _ref; 7790 const elementClippingAncestors = boundary === "clippingAncestors" ? getClippingElementAncestors(element, this._c) : [].concat(boundary); 7791 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 7792 const firstClippingAncestor = clippingAncestors[0]; 7793 const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { 7794 const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); 7795 accRect.top = max(rect.top, accRect.top); 7796 accRect.right = min(rect.right, accRect.right); 7797 accRect.bottom = min(rect.bottom, accRect.bottom); 7798 accRect.left = max(rect.left, accRect.left); 7799 return accRect; 7800 }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); 7801 return { 7802 width: clippingRect.right - clippingRect.left, 7803 height: clippingRect.bottom - clippingRect.top, 7804 x: clippingRect.left, 7805 y: clippingRect.top 7806 }; 7807 } 7808 function getDimensions(element) { 7809 return getCssDimensions(element); 7810 } 7811 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 7812 const isOffsetParentAnElement = isHTMLElement(offsetParent); 7813 const documentElement = getDocumentElement(offsetParent); 7814 const isFixed = strategy === "fixed"; 7815 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 7816 let scroll = { 7817 scrollLeft: 0, 7818 scrollTop: 0 7819 }; 7820 const offsets = createCoords(0); 7821 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 7822 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 7823 scroll = getNodeScroll(offsetParent); 7824 } 7825 if (isOffsetParentAnElement) { 7826 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 7827 offsets.x = offsetRect.x + offsetParent.clientLeft; 7828 offsets.y = offsetRect.y + offsetParent.clientTop; 7829 } else if (documentElement) { 7830 offsets.x = getWindowScrollBarX(documentElement); 7831 } 7832 } 7833 return { 7834 x: rect.left + scroll.scrollLeft - offsets.x, 7835 y: rect.top + scroll.scrollTop - offsets.y, 7836 width: rect.width, 7837 height: rect.height 7838 }; 7839 } 7840 function getTrueOffsetParent(element, polyfill) { 7841 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 7842 return null; 7843 } 7844 if (polyfill) { 7845 return polyfill(element); 7846 } 7847 return element.offsetParent; 7848 } 7849 function getOffsetParent(element, polyfill) { 7850 const window2 = getWindow(element); 7851 if (!isHTMLElement(element)) { 7852 return window2; 7853 } 7854 let offsetParent = getTrueOffsetParent(element, polyfill); 7855 while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") { 7856 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 7857 } 7858 if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static" && !isContainingBlock(offsetParent))) { 7859 return window2; 7860 } 7861 return offsetParent || getContainingBlock(element) || window2; 7862 } 7863 var getElementRects = async function(_ref) { 7864 let { 7865 reference, 7866 floating, 7867 strategy 7868 } = _ref; 7869 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 7870 const getDimensionsFn = this.getDimensions; 7871 return { 7872 reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy), 7873 floating: { 7874 x: 0, 7875 y: 0, 7876 ...await getDimensionsFn(floating) 7877 } 7878 }; 7879 }; 7880 function isRTL(element) { 7881 return getComputedStyle2(element).direction === "rtl"; 7882 } 7883 var platform = { 7884 convertOffsetParentRelativeRectToViewportRelativeRect, 7885 getDocumentElement, 7886 getClippingRect, 7887 getOffsetParent, 7888 getElementRects, 7889 getClientRects, 7890 getDimensions, 7891 getScale, 7892 isElement, 7893 isRTL 7894 }; 7895 function observeMove(element, onMove) { 7896 let io = null; 7897 let timeoutId; 7898 const root = getDocumentElement(element); 7899 function cleanup2() { 7900 clearTimeout(timeoutId); 7901 io && io.disconnect(); 7902 io = null; 7903 } 7904 function refresh(skip, threshold) { 7905 if (skip === void 0) { 7906 skip = false; 7907 } 7908 if (threshold === void 0) { 7909 threshold = 1; 7910 } 7911 cleanup2(); 7912 const { 7913 left, 7914 top, 7915 width, 7916 height 7917 } = element.getBoundingClientRect(); 7918 if (!skip) { 7919 onMove(); 7920 } 7921 if (!width || !height) { 7922 return; 7923 } 7924 const insetTop = floor(top); 7925 const insetRight = floor(root.clientWidth - (left + width)); 7926 const insetBottom = floor(root.clientHeight - (top + height)); 7927 const insetLeft = floor(left); 7928 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 7929 const options = { 7930 rootMargin, 7931 threshold: max(0, min(1, threshold)) || 1 7932 }; 7933 let isFirstUpdate = true; 7934 function handleObserve(entries) { 7935 const ratio = entries[0].intersectionRatio; 7936 if (ratio !== threshold) { 7937 if (!isFirstUpdate) { 7938 return refresh(); 7939 } 7940 if (!ratio) { 7941 timeoutId = setTimeout(() => { 7942 refresh(false, 1e-7); 7943 }, 100); 7944 } else { 7945 refresh(false, ratio); 7946 } 7947 } 7948 isFirstUpdate = false; 7949 } 7950 try { 7951 io = new IntersectionObserver(handleObserve, { 7952 ...options, 7953 root: root.ownerDocument 7954 }); 7955 } catch (e) { 7956 io = new IntersectionObserver(handleObserve, options); 7957 } 7958 io.observe(element); 7959 } 7960 refresh(true); 7961 return cleanup2; 7962 } 7963 function autoUpdate(reference, floating, update, options) { 7964 if (options === void 0) { 7965 options = {}; 7966 } 7967 const { 7968 ancestorScroll = true, 7969 ancestorResize = true, 7970 elementResize = typeof ResizeObserver === "function", 7971 layoutShift = typeof IntersectionObserver === "function", 7972 animationFrame = false 7973 } = options; 7974 const referenceEl = unwrapElement(reference); 7975 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : []; 7976 ancestors.forEach((ancestor) => { 7977 ancestorScroll && ancestor.addEventListener("scroll", update, { 7978 passive: true 7979 }); 7980 ancestorResize && ancestor.addEventListener("resize", update); 7981 }); 7982 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null; 7983 let reobserveFrame = -1; 7984 let resizeObserver = null; 7985 if (elementResize) { 7986 resizeObserver = new ResizeObserver((_ref) => { 7987 let [firstEntry] = _ref; 7988 if (firstEntry && firstEntry.target === referenceEl && resizeObserver) { 7989 resizeObserver.unobserve(floating); 7990 cancelAnimationFrame(reobserveFrame); 7991 reobserveFrame = requestAnimationFrame(() => { 7992 resizeObserver && resizeObserver.observe(floating); 7993 }); 7994 } 7995 update(); 7996 }); 7997 if (referenceEl && !animationFrame) { 7998 resizeObserver.observe(referenceEl); 7999 } 8000 resizeObserver.observe(floating); 8001 } 8002 let frameId; 8003 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 8004 if (animationFrame) { 8005 frameLoop(); 8006 } 8007 function frameLoop() { 8008 const nextRefRect = getBoundingClientRect(reference); 8009 if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) { 8010 update(); 8011 } 8012 prevRefRect = nextRefRect; 8013 frameId = requestAnimationFrame(frameLoop); 8014 } 8015 update(); 8016 return () => { 8017 ancestors.forEach((ancestor) => { 8018 ancestorScroll && ancestor.removeEventListener("scroll", update); 8019 ancestorResize && ancestor.removeEventListener("resize", update); 8020 }); 8021 cleanupIo && cleanupIo(); 8022 resizeObserver && resizeObserver.disconnect(); 8023 resizeObserver = null; 8024 if (animationFrame) { 8025 cancelAnimationFrame(frameId); 8026 } 8027 }; 8028 } 8029 var computePosition2 = (reference, floating, options) => { 8030 const cache = /* @__PURE__ */ new Map(); 8031 const mergedOptions = { 8032 platform, 8033 ...options 8034 }; 8035 const platformWithCache = { 8036 ...mergedOptions.platform, 8037 _c: cache 8038 }; 8039 return computePosition(reference, floating, { 8040 ...mergedOptions, 8041 platform: platformWithCache 8042 }); 8043 }; 8044 function src_default7(Alpine3) { 8045 Alpine3.magic("anchor", (el) => { 8046 if (!el._x_anchor) 8047 throw "Alpine: No x-anchor directive found on element using $anchor..."; 8048 return el._x_anchor; 8049 }); 8050 Alpine3.interceptClone((from, to) => { 8051 if (from && from._x_anchor && !to._x_anchor) { 8052 to._x_anchor = from._x_anchor; 8053 } 8054 }); 8055 Alpine3.directive("anchor", Alpine3.skipDuringClone((el, { expression, modifiers, value }, { evaluate: evaluate22, effect: effect3, cleanup: cleanup2 }) => { 8056 let { placement, offsetValue, unstyled, allowFlip } = getOptions(modifiers); 8057 el._x_anchor = Alpine3.reactive({ x: 0, y: 0 }); 8058 let previousReference = null; 8059 let release2 = null; 8060 effect3(() => { 8061 let reference = evaluate22(expression); 8062 if (!reference) 8063 return; 8064 if (previousReference !== reference) { 8065 if (release2) 8066 release2(); 8067 previousReference = reference; 8068 let compute = () => { 8069 let previousValue; 8070 computePosition2(reference, el, { 8071 placement, 8072 middleware: [allowFlip && flip(), shift({ padding: 5 }), offset(offsetValue)] 8073 }).then(({ x, y }) => { 8074 unstyled || setStyles2(el, x, y); 8075 if (JSON.stringify({ x, y }) !== previousValue) { 8076 el._x_anchor.x = x; 8077 el._x_anchor.y = y; 8078 } 8079 previousValue = JSON.stringify({ x, y }); 8080 }); 8081 }; 8082 release2 = autoUpdate(reference, el, () => compute()); 8083 } 8084 }); 8085 cleanup2(() => { 8086 if (release2) 8087 release2(); 8088 }); 8089 }, (el, { expression, modifiers, value }, { cleanup: cleanup2, evaluate: evaluate22 }) => { 8090 let { placement, offsetValue, unstyled } = getOptions(modifiers); 8091 if (el._x_anchor) { 8092 unstyled || setStyles2(el, el._x_anchor.x, el._x_anchor.y); 8093 } 8094 })); 8095 } 8096 function setStyles2(el, x, y) { 8097 Object.assign(el.style, { 8098 left: x + "px", 8099 top: y + "px", 8100 position: "absolute" 8101 }); 8102 } 8103 function getOptions(modifiers) { 8104 let positions = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"]; 8105 let placement = positions.find((i) => modifiers.includes(i)); 8106 let offsetValue = 0; 8107 if (modifiers.includes("offset")) { 8108 let idx = modifiers.findIndex((i) => i === "offset"); 8109 offsetValue = modifiers[idx + 1] !== void 0 ? Number(modifiers[idx + 1]) : offsetValue; 8110 } 8111 let unstyled = modifiers.includes("no-style"); 8112 let allowFlip = !modifiers.includes("noflip"); 8113 return { placement, offsetValue, unstyled, allowFlip }; 8114 } 8115 var module_default7 = src_default7; 8116 8117
8117// js/plugins/navigate/history.js 8118 var Snapshot = class { 8119 constructor(url, html) { 8120 this.url = url; 8121 this.html = html; 8122 } 8123 }; 8124 var snapshotCache = { 8125 currentKey: null, 8126 currentUrl: null, 8127 keys: [], 8128 lookup: {}, 8129 limit: 10, 8130 has(location) { 8131 return this.lookup[location] !== void 0; 8132 }, 8133 retrieve(location) { 8134 let snapshot = this.lookup[location]; 8135 if (snapshot === void 0) 8136 throw "No back button cache found for current location: " + location; 8137 return snapshot; 8138 }, 8139 replace(key, snapshot) { 8140 if (this.has(key)) { 8141 this.lookup[key] = snapshot; 8142 } else { 8143 this.push(key, snapshot); 8144 } 8145 }, 8146 push(key, snapshot) { 8147 this.lookup[key] = snapshot; 8148 let index = this.keys.indexOf(key); 8149 if (index > -1) 8150 this.keys.splice(index, 1); 8151 this.keys.unshift(key); 8152 this.trim(); 8153 }, 8154 trim() { 8155 for (let key of this.keys.splice(this.limit)) { 8156 delete this.lookup[key]; 8157 } 8158 } 8159 }; 8160 var currentPageStatus = null; 8161 function storeCurrentPageStatus(status) { 8162 currentPageStatus = status; 8163 } 8164 function updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks() { 8165 let url = new URL(window.location.href, document.baseURI); 8166 replaceUrl(url, document.documentElement.outerHTML); 8167 } 8168 function updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(key, url) { 8169 let html = document.documentElement.outerHTML; 8170 snapshotCache.replace(key, new Snapshot(url, html)); 8171 } 8172 function whenTheBackOrForwardButtonIsClicked(registerFallback, handleHtml) { 8173 let fallback2; 8174 registerFallback((i) => fallback2 = i); 8175 window.addEventListener("popstate", (e) => { 8176 let state = e.state || {}; 8177 let alpine = state.alpine || {}; 8178 if (currentPageStatus && (currentPageStatus < 200 || currentPageStatus >= 300)) { 8179 return window.location.href = alpine.url; 8180 } 8181 if (Object.keys(state).length === 0) 8182 return; 8183 if (!alpine.snapshotIdx) 8184 return; 8185 if (snapshotCache.has(alpine.snapshotIdx)) { 8186 let snapshot = snapshotCache.retrieve(alpine.snapshotIdx); 8187 handleHtml(snapshot.html, snapshot.url, snapshotCache.currentUrl, snapshotCache.currentKey); 8188 } else { 8189 fallback2(alpine.url); 8190 } 8191 }); 8192 } 8193 function updateUrlAndStoreLatestHtmlForFutureBackButtons(html, destination) { 8194 pushUrl(destination, html); 8195 } 8196 function pushUrl(url, html) { 8197 updateUrl("pushState", url, html); 8198 } 8199 function replaceUrl(url, html) { 8200 updateUrl("replaceState", url, html); 8201 } 8202 function updateUrl(method, url, html) { 8203 let key = url.toString() + "-" + Math.random(); 8204 method === "pushState" ? snapshotCache.push(key, new Snapshot(url, html)) : snapshotCache.replace(key = snapshotCache.currentKey ?? key, new Snapshot(url, html)); 8205 let state = history.state || {}; 8206 if (!state.alpine) 8207 state.alpine = {}; 8208 state.alpine.snapshotIdx = key; 8209 state.alpine.url = url.toString(); 8210 try { 8211 history[method](state, JSON.stringify(document.title), url); 8212 snapshotCache.currentKey = key; 8213 snapshotCache.currentUrl = url; 8214 } catch (error2) { 8215 if (error2 instanceof DOMException && error2.name === "SecurityError") { 8216 console.error("Livewire: You can't use wire:navigate with a link to a different root domain: " + url); 8217 } 8218 console.error(error2); 8219 } 8220 } 8221 8222
8222// js/plugins/navigate/links.js 8223 function whenThisLinkIsPressed(el, callback) { 8224 let isProgrammaticClick = (e) => !e.isTrusted; 8225 let isNotPlainLeftClick = (e) => e.which > 1 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; 8226 let isNotPlainEnterKey = (e) => e.which !== 13 || e.altKey || e.ctrlKey || e.metaKey || e.shiftKey; 8227 el.addEventListener("click", (e) => { 8228 if (isProgrammaticClick(e)) { 8229 e.preventDefault(); 8230 callback((whenReleased) => whenReleased()); 8231 return; 8232 } 8233 if (isNotPlainLeftClick(e)) 8234 return; 8235 e.preventDefault(); 8236 }); 8237 el.addEventListener("mousedown", (e) => { 8238 if (isNotPlainLeftClick(e)) 8239 return; 8240 e.preventDefault(); 8241 callback((whenReleased) => { 8242 let handler4 = (e2) => { 8243 e2.preventDefault(); 8244 whenReleased(); 8245 el.removeEventListener("mouseup", handler4); 8246 }; 8247 el.addEventListener("mouseup", handler4); 8248 }); 8249 }); 8250 el.addEventListener("keydown", (e) => { 8251 if (isNotPlainEnterKey(e)) 8252 return; 8253 e.preventDefault(); 8254 callback((whenReleased) => whenReleased()); 8255 }); 8256 } 8257 function whenThisLinkIsHoveredFor(el, ms = 60, callback) { 8258 el.addEventListener("mouseenter", (e) => { 8259 let timeout = setTimeout(() => { 8260 callback(e); 8261 }, ms); 8262 let handler4 = () => { 8263 clearTimeout(timeout); 8264 el.removeEventListener("mouseleave", handler4); 8265 }; 8266 el.addEventListener("mouseleave", handler4); 8267 }); 8268 } 8269 function extractDestinationFromLink(linkEl) { 8270 return createUrlObjectFromString(linkEl.getAttribute("href")); 8271 } 8272 function createUrlObjectFromString(urlString) { 8273 return urlString !== null && new URL(urlString, document.baseURI); 8274 } 8275 function getUriStringFromUrlObject(urlObject) { 8276 return urlObject.pathname + urlObject.search + urlObject.hash; 8277 } 8278 8279
8279// js/plugins/navigate/fetch.js 8280 function fetchHtml(destination, callback) { 8281 let uri = getUriStringFromUrlObject(destination); 8282 performFetch(uri, (html, finalDestination, status) => { 8283 storeCurrentPageStatus(status); 8284 callback(html, finalDestination); 8285 }); 8286 } 8287 function performFetch(uri, callback) { 8288 let options = { 8289 headers: { 8290 "X-Livewire-Navigate": "" 8291 } 8292 }; 8293 trigger2("navigate.request", { 8294 url: uri, 8295 options 8296 }); 8297 let finalDestination; 8298 let status; 8299 fetch(uri, options).then((response) => { 8300 let destination = createUrlObjectFromString(uri); 8301 finalDestination = createUrlObjectFromString(response.url); 8302 if (destination.pathname + destination.search === finalDestination.pathname + finalDestination.search) { 8303 finalDestination.hash = destination.hash; 8304 } 8305 status = response.status; 8306 return response.text(); 8307 }).then((html) => { 8308 callback(html, finalDestination, status); 8309 }); 8310 } 8311 8312
8312// js/plugins/navigate/prefetch.js 8313 var prefetches = {}; 8314 var cacheDuration = 3e4; 8315 function prefetchHtml(destination, callback) { 8316 let uri = getUriStringFromUrlObject(destination); 8317 if (prefetches[uri]) 8318 return; 8319 prefetches[uri] = { finished: false, html: null, whenFinished: () => setTimeout(() => delete prefetches[uri], cacheDuration) }; 8320 performFetch(uri, (html, routedUri, status) => { 8321 storeCurrentPageStatus(status); 8322 callback(html, routedUri); 8323 }); 8324 } 8325 function storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination) { 8326 let state = prefetches[getUriStringFromUrlObject(destination)]; 8327 state.html = html; 8328 state.finished = true; 8329 state.finalDestination = finalDestination; 8330 state.whenFinished(); 8331 } 8332 function getPretchedHtmlOr(destination, receive, ifNoPrefetchExists) { 8333 let uri = getUriStringFromUrlObject(destination); 8334 if (!prefetches[uri]) 8335 return ifNoPrefetchExists(); 8336 if (prefetches[uri].finished) { 8337 let html = prefetches[uri].html; 8338 let finalDestination = prefetches[uri].finalDestination; 8339 delete prefetches[uri]; 8340 return receive(html, finalDestination); 8341 } else { 8342 prefetches[uri].whenFinished = () => { 8343 let html = prefetches[uri].html; 8344 let finalDestination = prefetches[uri].finalDestination; 8345 delete prefetches[uri]; 8346 receive(html, finalDestination); 8347 }; 8348 } 8349 } 8350 8351
8351// js/plugins/navigate/teleport.js 8352 function packUpPersistedTeleports(persistedEl) { 8353 module_default.mutateDom(() => { 8354 persistedEl.querySelectorAll("[data-teleport-template]").forEach((i) => i._x_teleport.remove()); 8355 }); 8356 } 8357 function removeAnyLeftOverStaleTeleportTargets(body) { 8358 module_default.mutateDom(() => { 8359 body.querySelectorAll("[data-teleport-target]").forEach((i) => i.remove()); 8360 }); 8361 } 8362 function unPackPersistedTeleports(persistedEl) { 8363 module_default.walk(persistedEl, (el, skip) => { 8364 if (!el._x_teleport) 8365 return; 8366 el._x_teleportPutBack(); 8367 skip(); 8368 }); 8369 } 8370 function isTeleportTarget(el) { 8371 return el.hasAttribute("data-teleport-target"); 8372 } 8373 8374
8374// js/plugins/navigate/scroll.js 8375 function storeScrollInformationInHtmlBeforeNavigatingAway() { 8376 document.body.setAttribute("data-scroll-x", document.body.scrollLeft); 8377 document.body.setAttribute("data-scroll-y", document.body.scrollTop); 8378 document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:scroll]"]).forEach((el) => { 8379 el.setAttribute("data-scroll-x", el.scrollLeft); 8380 el.setAttribute("data-scroll-y", el.scrollTop); 8381 }); 8382 } 8383 function restoreScrollPositionOrScrollToTop() { 8384 let scroll = (el) => { 8385 if (!el.hasAttribute("data-scroll-x")) { 8386 window.scrollTo({ top: 0, left: 0, behavior: "instant" }); 8387 } else { 8388 el.scrollTo({ 8389 top: Number(el.getAttribute("data-scroll-y")), 8390 left: Number(el.getAttribute("data-scroll-x")), 8391 behavior: "instant" 8392 }); 8393 el.removeAttribute("data-scroll-x"); 8394 el.removeAttribute("data-scroll-y"); 8395 } 8396 }; 8397 queueMicrotask(() => { 8398 queueMicrotask(() => { 8399 scroll(document.body); 8400 document.querySelectorAll(["[x-navigate\\:scroll]", "[wire\\:scroll]"]).forEach(scroll); 8401 }); 8402 }); 8403 } 8404 8405
8405// js/plugins/navigate/persist.js 8406 var els = {}; 8407 function storePersistantElementsForLater(callback) { 8408 els = {}; 8409 document.querySelectorAll("[x-persist]").forEach((i) => { 8410 els[i.getAttribute("x-persist")] = i; 8411 callback(i); 8412 module_default.mutateDom(() => { 8413 i.remove(); 8414 }); 8415 }); 8416 } 8417 function putPersistantElementsBack(callback) { 8418 let usedPersists = []; 8419 document.querySelectorAll("[x-persist]").forEach((i) => { 8420 let old = els[i.getAttribute("x-persist")]; 8421 if (!old) 8422 return; 8423 usedPersists.push(i.getAttribute("x-persist")); 8424 old._x_wasPersisted = true; 8425 callback(old, i); 8426 module_default.mutateDom(() => { 8427 i.replaceWith(old); 8428 }); 8429 }); 8430 Object.entries(els).forEach(([key, el]) => { 8431 if (usedPersists.includes(key)) 8432 return; 8433 module_default.destroyTree(el); 8434 }); 8435 els = {}; 8436 } 8437 function isPersistedElement(el) { 8438 return el.hasAttribute("x-persist"); 8439 } 8440 8441
8441// js/plugins/navigate/bar.js 8442 var import_nprogress = __toESM(require_nprogress()); 8443 import_nprogress.default.configure({ 8444 minimum: 0.1, 8445 trickleSpeed: 200, 8446 showSpinner: false, 8447 parent: "body" 8448 }); 8449 injectStyles(); 8450 var inProgress = false; 8451 function showAndStartProgressBar() { 8452 inProgress = true; 8453 setTimeout(() => { 8454 if (!inProgress) 8455 return; 8456 import_nprogress.default.start(); 8457 }, 150); 8458 } 8459 function finishAndHideProgressBar() { 8460 inProgress = false; 8461 import_nprogress.default.done(); 8462 } 8463 function removeAnyLeftOverStaleProgressBars() { 8464 import_nprogress.default.remove(); 8465 } 8466 function injectStyles() { 8467 let style = document.createElement("style"); 8468 style.innerHTML = `/* Make clicks pass-through */ 8469 8470 #nprogress { 8471 pointer-events: none; 8472 } 8473 8474 #nprogress .bar { 8475 background: var(--livewire-progress-bar-color, #29d); 8476 8477 position: fixed; 8478 z-index: 1031; 8479 top: 0; 8480 left: 0; 8481 8482 width: 100%; 8483 height: 2px; 8484 } 8485 8486 /* Fancy blur effect */ 8487 #nprogress .peg { 8488 display: block; 8489 position: absolute; 8490 right: 0px; 8491 width: 100px; 8492 height: 100%; 8493 box-shadow: 0 0 10px var(--livewire-progress-bar-color, #29d), 0 0 5px var(--livewire-progress-bar-color, #29d); 8494 opacity: 1.0; 8495 8496 -webkit-transform: rotate(3deg) translate(0px, -4px); 8497 -ms-transform: rotate(3deg) translate(0px, -4px); 8498 transform: rotate(3deg) translate(0px, -4px); 8499 } 8500 8501 /* Remove these to get rid of the spinner */ 8502 #nprogress .spinner { 8503 display: block; 8504 position: fixed; 8505 z-index: 1031; 8506 top: 15px; 8507 right: 15px; 8508 } 8509 8510 #nprogress .spinner-icon { 8511 width: 18px; 8512 height: 18px; 8513 box-sizing: border-box; 8514 8515 border: solid 2px transparent; 8516 border-top-color: var(--livewire-progress-bar-color, #29d); 8517 border-left-color: var(--livewire-progress-bar-color, #29d); 8518 border-radius: 50%; 8519 8520 -webkit-animation: nprogress-spinner 400ms linear infinite; 8521 animation: nprogress-spinner 400ms linear infinite; 8522 } 8523 8524 .nprogress-custom-parent { 8525 overflow: hidden; 8526 position: relative; 8527 } 8528 8529 .nprogress-custom-parent #nprogress .spinner, 8530 .nprogress-custom-parent #nprogress .bar { 8531 position: absolute; 8532 } 8533 8534 @-webkit-keyframes nprogress-spinner { 8535 0% { -webkit-transform: rotate(0deg); } 8536 100% { -webkit-transform: rotate(360deg); } 8537 } 8538 @keyframes nprogress-spinner { 8539 0% { transform: rotate(0deg); } 8540 100% { transform: rotate(360deg); } 8541 } 8542 `; 8543 let nonce2 = getNonce(); 8544 if (nonce2) 8545 style.nonce = nonce2; 8546 document.head.appendChild(style); 8547 } 8548 8549
8549// js/plugins/navigate/popover.js 8550 function packUpPersistedPopovers(persistedEl) { 8551 if (!isPopoverSupported()) 8552 return; 8553 persistedEl.querySelectorAll(":popover-open").forEach((el) => { 8554 el.setAttribute("data-navigate-popover-open", ""); 8555 let animations = el.getAnimations(); 8556 el._pausedAnimations = animations.map((animation) => ({ 8557 keyframes: animation.effect.getKeyframes(), 8558 options: { 8559 duration: animation.effect.getTiming().duration, 8560 easing: animation.effect.getTiming().easing, 8561 fill: animation.effect.getTiming().fill, 8562 iterations: animation.effect.getTiming().iterations 8563 }, 8564 currentTime: animation.currentTime, 8565 playState: animation.playState 8566 })); 8567 animations.forEach((i) => i.pause()); 8568 }); 8569 } 8570 function unPackPersistedPopovers(persistedEl) { 8571 if (!isPopoverSupported()) 8572 return; 8573 persistedEl.querySelectorAll("[data-navigate-popover-open]").forEach((el) => { 8574 el.removeAttribute("data-navigate-popover-open"); 8575 queueMicrotask(() => { 8576 if (!el.isConnected) 8577 return; 8578 el.showPopover(); 8579 el.getAnimations().forEach((i) => i.finish()); 8580 if (el._pausedAnimations) { 8581 el._pausedAnimations.forEach(({ keyframes, options, currentTime, now, playState }) => { 8582 let animation = el.animate(keyframes, options); 8583 animation.currentTime = currentTime; 8584 }); 8585 delete el._pausedAnimations; 8586 } 8587 }); 8588 }); 8589 } 8590 function isPopoverSupported() { 8591 return typeof document.createElement("div").showPopover === "function"; 8592 } 8593 8594
8594// js/plugins/navigate/page.js 8595 var oldBodyScriptTagHashes = []; 8596 var attributesExemptFromScriptTagHashing = [ 8597 "data-csrf", 8598 "nonce", 8599 "aria-hidden" 8600 ]; 8601 function swapCurrentPageWithNewHtml(html, andThen) { 8602 let newDocument = new DOMParser().parseFromString(html, "text/html"); 8603 let newHtml = newDocument.documentElement; 8604 let newBody = document.adoptNode(newDocument.body); 8605 let newHead = document.adoptNode(newDocument.head); 8606 oldBodyScriptTagHashes = oldBodyScriptTagHashes.concat(Array.from(document.body.querySelectorAll("script")).map((i) => { 8607 return simpleHash(ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing)); 8608 })); 8609 let afterRemoteScriptsHaveLoaded = () => { 8610 }; 8611 replaceHtmlAttributes(newHtml); 8612 mergeNewHead(newHead).finally(() => { 8613 afterRemoteScriptsHaveLoaded(); 8614 }); 8615 prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes); 8616 let oldBody = document.body; 8617 document.body.replaceWith(newBody); 8618 Alpine.destroyTree(oldBody); 8619 andThen((i) => afterRemoteScriptsHaveLoaded = i); 8620 } 8621 function prepNewBodyScriptTagsToRun(newBody, oldBodyScriptTagHashes2) { 8622 newBody.querySelectorAll("script").forEach((i) => { 8623 if (i.hasAttribute("data-navigate-once")) { 8624 let hash = simpleHash(ignoreAttributes(i.outerHTML, attributesExemptFromScriptTagHashing)); 8625 if (oldBodyScriptTagHashes2.includes(hash)) 8626 return; 8627 } 8628 i.replaceWith(cloneScriptTag(i)); 8629 }); 8630 } 8631 function replaceHtmlAttributes(newHtmlElement) { 8632 let currentHtmlElement = document.documentElement; 8633 Array.from(newHtmlElement.attributes).forEach((attr) => { 8634 const name = attr.name; 8635 const value = attr.value; 8636 if (currentHtmlElement.getAttribute(name) !== value) { 8637 currentHtmlElement.setAttribute(name, value); 8638 } 8639 }); 8640 Array.from(currentHtmlElement.attributes).forEach((attr) => { 8641 if (!newHtmlElement.hasAttribute(attr.name)) { 8642 currentHtmlElement.removeAttribute(attr.name); 8643 } 8644 }); 8645 } 8646 function mergeNewHead(newHead) {
8647 let children = Array.from(document.head.children); 8648 let headChildrenHtmlLookup = children.map((i) => i.outerHTML); 8649 let garbageCollector = document.createDocumentFragment(); 8650 let touchedHeadElements = []; 8651 let remoteScriptsPromises = []; 8652 for (let child of Array.from(newHead.children)) { 8653 if (isAsset(child)) { 8654 if (!headChildrenHtmlLookup.includes(child.outerHTML)) { 8655 if (isTracked(child)) { 8656 if (ifTheQueryStringChangedSinceLastRequest(child, children)) { 8657 setTimeout(() => window.location.reload()); 8658 } 8659 } 8660 if (isScript(child)) { 8661 try { 8662 remoteScriptsPromises.push(injectScriptTagAndWaitForItToFullyLoad(cloneScriptTag(child))); 8663 } catch (error2) { 8664 } 8665 } else { 8666 document.head.appendChild(child); 8667 } 8668 } else { 8669 garbageCollector.appendChild(child); 8670 } 8671 touchedHeadElements.push(child); 8672 } 8673 } 8674 for (let child of Array.from(document.head.children)) { 8675 if (!isAsset(child)) 8676 child.remove(); 8677 } 8678 for (let child of Array.from(newHead.children)) { 8679 if (child.tagName.toLowerCase() === "noscript") 8680 continue; 8681 document.head.appendChild(child); 8682 } 8683 return Promise.all(remoteScriptsPromises); 8684 } 8685 async function injectScriptTagAndWaitForItToFullyLoad(script) { 8686 return new Promise((resolve, reject) => { 8687 if (script.src) { 8688 script.onload = () => resolve(); 8689 script.onerror = () => reject(); 8690 } else { 8691 resolve(); 8692 } 8693 document.head.appendChild(script); 8694 }); 8695 } 8696 function cloneScriptTag(el) { 8697 let script = document.createElement("script"); 8698 script.textContent = el.textContent; 8699 script.async = el.async; 8700 for (let attr of el.attributes) { 8701 script.setAttribute(attr.name, attr.value); 8702 } 8703 return script; 8704 } 8705 function isTracked(el) { 8706 return el.hasAttribute("data-navigate-track"); 8707 } 8708 function ifTheQueryStringChangedSinceLastRequest(el, currentHeadChildren) { 8709 let [uri, queryString] = extractUriAndQueryString(el); 8710 return currentHeadChildren.some((child) => { 8711 if (!isTracked(child)) 8712 return false; 8713 let [currentUri, currentQueryString] = extractUriAndQueryString(child); 8714 if (currentUri === uri && queryString !== currentQueryString) 8715 return true; 8716 }); 8717 } 8718 function extractUriAndQueryString(el) { 8719 let url = isScript(el) ? el.src : el.href; 8720 return url.split("?"); 8721 } 8722 function isAsset(el) { 8723 return el.tagName.toLowerCase() === "link" && el.getAttribute("rel").toLowerCase() === "stylesheet" || el.tagName.toLowerCase() === "style" || el.tagName.toLowerCase() === "script"; 8724 } 8725 function isScript(el) { 8726 return el.tagName.toLowerCase() === "script"; 8727 } 8728 function simpleHash(str) { 8729 return str.split("").reduce((a, b) => { 8730 a = (a << 5) - a + b.charCodeAt(0); 8731 return a & a; 8732 }, 0); 8733 } 8734 function ignoreAttributes(subject, attributesToRemove) { 8735 let result = subject; 8736 attributesToRemove.forEach((attr) => { 8737 const regex = new RegExp(`${attr}="[^"]*"|${attr}='[^']*'`, "g"); 8738 result = result.replace(regex, ""); 8739 }); 8740 result = result.replaceAll(" ", ""); 8741 return result.trim(); 8742 } 8743 8744
8744// js/plugins/navigate/index.js 8745 var enablePersist = true; 8746 var showProgressBar = true; 8747 var restoreScroll = true; 8748 var autofocus = false; 8749 function navigate_default(Alpine3) { 8750 Alpine3.navigate = (url, options = {}) => { 8751 let { preserveScroll = false } = options; 8752 let destination = createUrlObjectFromString(url); 8753 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 8754 url: destination, 8755 history: false, 8756 cached: false 8757 }); 8758 if (prevented) 8759 return; 8760 navigateTo(destination, { preserveScroll }); 8761 }; 8762 Alpine3.navigate.disableProgressBar = () => { 8763 showProgressBar = false; 8764 }; 8765 Alpine3.addInitSelector(() => `[${Alpine3.prefixed("navigate")}]`); 8766 Alpine3.directive("navigate", (el, { modifiers }) => { 8767 let shouldPrefetchOnHover = modifiers.includes("hover"); 8768 let preserveScroll = modifiers.includes("preserve-scroll"); 8769 shouldPrefetchOnHover && whenThisLinkIsHoveredFor(el, 60, () => { 8770 let destination = extractDestinationFromLink(el); 8771 if (!destination) 8772 return; 8773 prefetchHtml(destination, (html, finalDestination) => { 8774 storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); 8775 }); 8776 }); 8777 whenThisLinkIsPressed(el, (whenItIsReleased) => { 8778 let destination = extractDestinationFromLink(el); 8779 if (!destination) 8780 return; 8781 prefetchHtml(destination, (html, finalDestination) => { 8782 storeThePrefetchedHtmlForWhenALinkIsClicked(html, destination, finalDestination); 8783 }); 8784 whenItIsReleased(() => { 8785 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 8786 url: destination, 8787 history: false, 8788 cached: false 8789 }); 8790 if (prevented) 8791 return; 8792 navigateTo(destination, { preserveScroll }); 8793 }); 8794 }); 8795 }); 8796 function navigateTo(destination, { preserveScroll = false, shouldPushToHistoryState = true }) { 8797 showProgressBar && showAndStartProgressBar(); 8798 fetchHtmlOrUsePrefetchedHtml(destination, (html, finalDestination) => { 8799 let swapCallbacks = []; 8800 fireEventForOtherLibrariesToHookInto("alpine:navigating", { 8801 onSwap: (callback) => swapCallbacks.push(callback) 8802 }); 8803 restoreScroll && storeScrollInformationInHtmlBeforeNavigatingAway(); 8804 cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement(); 8805 updateCurrentPageHtmlInHistoryStateForLaterBackButtonClicks(); 8806 preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { 8807 enablePersist && storePersistantElementsForLater((persistedEl) => { 8808 packUpPersistedTeleports(persistedEl); 8809 packUpPersistedPopovers(persistedEl); 8810 }); 8811 if (shouldPushToHistoryState) { 8812 updateUrlAndStoreLatestHtmlForFutureBackButtons(html, finalDestination); 8813 } else { 8814 replaceUrl(finalDestination, html); 8815 } 8816 swapCurrentPageWithNewHtml(html, (afterNewScriptsAreDoneLoading) => { 8817 removeAnyLeftOverStaleTeleportTargets(document.body); 8818 enablePersist && putPersistantElementsBack((persistedEl, newStub) => { 8819 unPackPersistedTeleports(persistedEl); 8820 unPackPersistedPopovers(persistedEl); 8821 }); 8822 !preserveScroll && restoreScrollPositionOrScrollToTop(); 8823 swapCallbacks.forEach((callback) => callback()); 8824 afterNewScriptsAreDoneLoading(() => { 8825 andAfterAllThis(() => { 8826 setTimeout(() => { 8827 autofocus && autofocusElementsWithTheAutofocusAttribute(); 8828 }); 8829 nowInitializeAlpineOnTheNewPage(Alpine3); 8830 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 8831 showProgressBar && finishAndHideProgressBar(); 8832 }); 8833 }); 8834 }); 8835 }); 8836 }); 8837 }
8838 whenTheBackOrForwardButtonIsClicked((ifThePageBeingVisitedHasntBeenCached) => { 8839 ifThePageBeingVisitedHasntBeenCached((url) => { 8840 let destination = createUrlObjectFromString(url); 8841 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 8842 url: destination, 8843 history: true, 8844 cached: false 8845 }); 8846 if (prevented) 8847 return; 8848 navigateTo(destination, { shouldPushToHistoryState: false }); 8849 }); 8850 }, (html, url, currentPageUrl, currentPageKey) => { 8851 let destination = createUrlObjectFromString(url); 8852 let prevented = fireEventForOtherLibrariesToHookInto("alpine:navigate", { 8853 url: destination, 8854 history: true, 8855 cached: true 8856 }); 8857 if (prevented) 8858 return; 8859 storeScrollInformationInHtmlBeforeNavigatingAway(); 8860 let swapCallbacks = []; 8861 fireEventForOtherLibrariesToHookInto("alpine:navigating", { 8862 onSwap: (callback) => swapCallbacks.push(callback) 8863 }); 8864 updateCurrentPageHtmlInSnapshotCacheForLaterBackButtonClicks(currentPageUrl, currentPageKey); 8865 preventAlpineFromPickingUpDomChanges(Alpine3, (andAfterAllThis) => { 8866 enablePersist && storePersistantElementsForLater((persistedEl) => { 8867 packUpPersistedTeleports(persistedEl); 8868 packUpPersistedPopovers(persistedEl); 8869 }); 8870 swapCurrentPageWithNewHtml(html, () => { 8871 removeAnyLeftOverStaleProgressBars(); 8872 removeAnyLeftOverStaleTeleportTargets(document.body); 8873 enablePersist && putPersistantElementsBack((persistedEl, newStub) => { 8874 unPackPersistedTeleports(persistedEl); 8875 unPackPersistedPopovers(persistedEl); 8876 }); 8877 restoreScrollPositionOrScrollToTop(); 8878 swapCallbacks.forEach((callback) => callback()); 8879 andAfterAllThis(() => { 8880 autofocus && autofocusElementsWithTheAutofocusAttribute(); 8881 nowInitializeAlpineOnTheNewPage(Alpine3); 8882 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 8883 }); 8884 }); 8885 }); 8886 }); 8887 setTimeout(() => { 8888 fireEventForOtherLibrariesToHookInto("alpine:navigated"); 8889 }); 8890 } 8891 function fetchHtmlOrUsePrefetchedHtml(fromDestination, callback) { 8892 getPretchedHtmlOr(fromDestination, callback, () => { 8893 fetchHtml(fromDestination, callback); 8894 }); 8895 } 8896 function preventAlpineFromPickingUpDomChanges(Alpine3, callback) { 8897 Alpine3.stopObservingMutations(); 8898 callback((afterAllThis) => { 8899 Alpine3.startObservingMutations(); 8900 queueMicrotask(() => { 8901 afterAllThis(); 8902 }); 8903 }); 8904 } 8905 function fireEventForOtherLibrariesToHookInto(name, detail) { 8906 let event = new CustomEvent(name, { 8907 cancelable: true, 8908 bubbles: true, 8909 detail 8910 }); 8911 document.dispatchEvent(event); 8912 return event.defaultPrevented; 8913 } 8914 function nowInitializeAlpineOnTheNewPage(Alpine3) { 8915 Alpine3.initTree(document.body, void 0, (el, skip) => { 8916 if (el._x_wasPersisted) 8917 skip(); 8918 }); 8919 } 8920 function autofocusElementsWithTheAutofocusAttribute() { 8921 document.querySelector("[autofocus]") && document.querySelector("[autofocus]").focus(); 8922 } 8923 function cleanupAlpineElementsOnThePageThatArentInsideAPersistedElement() { 8924 let walker = function(root, callback) { 8925 Alpine.walk(root, (el, skip) => { 8926 if (isPersistedElement(el)) 8927 skip(); 8928 if (isTeleportTarget(el)) 8929 skip(); 8930 else 8931 callback(el, skip); 8932 }); 8933 }; 8934 Alpine.destroyTree(document.body, walker); 8935 } 8936 8937
8937// js/plugins/history/index.js 8938 function history2(Alpine3) { 8939 Alpine3.magic("queryString", (el, { interceptor: interceptor2 }) => { 8940 let alias; 8941 let alwaysShow = false; 8942 let usePush = false; 8943 return interceptor2((initialSeedValue, getter, setter, path, key) => { 8944 let queryKey = alias || path; 8945 let { initial, replace: replace2, push: push2, pop } = track2(queryKey, initialSeedValue, alwaysShow); 8946 setter(initial); 8947 if (!usePush) { 8948 Alpine3.effect(() => replace2(getter())); 8949 } else { 8950 Alpine3.effect(() => push2(getter())); 8951 pop(async (newValue) => { 8952 setter(newValue); 8953 let tillTheEndOfTheMicrotaskQueue = () => Promise.resolve(); 8954 await tillTheEndOfTheMicrotaskQueue(); 8955 }); 8956 } 8957 return initial; 8958 }, (func) => { 8959 func.alwaysShow = () => { 8960 alwaysShow = true; 8961 return func; 8962 }; 8963 func.usePush = () => { 8964 usePush = true; 8965 return func; 8966 }; 8967 func.as = (key) => { 8968 alias = key; 8969 return func; 8970 }; 8971 }); 8972 }); 8973 Alpine3.history = { track: track2 }; 8974 } 8975 function track2(name, initialSeedValue, alwaysShow = false, except = null) { 8976 let { has: has2, get: get3, set: set3, remove } = queryStringUtils(); 8977 let url = new URL(window.location.href); 8978 let isInitiallyPresentInUrl = has2(url, name); 8979 let initialValue = isInitiallyPresentInUrl ? get3(url, name) : initialSeedValue; 8980 let initialValueMemo = JSON.stringify(initialValue); 8981 let exceptValueMemo = JSON.stringify(except); 8982 let hasReturnedToInitialValue = (newValue) => JSON.stringify(newValue) === initialValueMemo; 8983 let hasReturnedToExceptValue = (newValue) => JSON.stringify(newValue) === exceptValueMemo; 8984 if (alwaysShow) 8985 url = set3(url, name, initialValue); 8986 replace(url, name, { value: initialValue }); 8987 let lock = false; 8988 let update = (strategy, newValue) => { 8989 if (lock) 8990 return; 8991 let url2 = new URL(window.location.href); 8992 if (!alwaysShow && !isInitiallyPresentInUrl && hasReturnedToInitialValue(newValue)) { 8993 url2 = remove(url2, name); 8994 } else if (newValue === void 0) { 8995 url2 = remove(url2, name); 8996 } else if (!alwaysShow && hasReturnedToExceptValue(newValue)) { 8997 url2 = remove(url2, name); 8998 } else { 8999 url2 = set3(url2, name, newValue); 9000 } 9001 strategy(url2, name, { value: newValue }); 9002 }; 9003 return { 9004 initial: initialValue, 9005 replace(newValue) { 9006 update(replace, newValue); 9007 }, 9008 push(newValue) { 9009 update(push, newValue); 9010 }, 9011 pop(receiver) { 9012 let handler4 = (e) => { 9013 if (!e.state || !e.state.alpine) 9014 return; 9015 Object.entries(e.state.alpine).forEach(([iName, { value: newValue }]) => { 9016 if (iName !== name) 9017 return; 9018 lock = true; 9019 let result = receiver(newValue); 9020 if (result instanceof Promise) { 9021 result.finally(() => lock = false); 9022 } else { 9023 lock = false; 9024 } 9025 }); 9026 }; 9027 window.addEventListener("popstate", handler4); 9028 return () => window.removeEventListener("popstate", handler4); 9029 } 9030 }; 9031 } 9032 function replace(url, key, object) { 9033 let state = window.history.state || {}; 9034 if (!state.alpine) 9035 state.alpine = {}; 9036 state.alpine[key] = unwrap(object); 9037 try { 9038 window.history.replaceState(state, "", url.toString()); 9039 } catch (e) { 9040 console.error(e); 9041 } 9042 } 9043 function push(url, key, object) { 9044 let state = window.history.state || {}; 9045 if (!state.alpine) 9046 state.alpine = {}; 9047 state = { alpine: { ...state.alpine, ...{ [key]: unwrap(object) } } }; 9048 try { 9049 window.history.pushState(state, "", url.toString()); 9050 } catch (e) { 9051 console.error(e); 9052 } 9053 } 9054 function unwrap(object) { 9055 if (object === void 0) 9056 return void 0; 9057 return JSON.parse(JSON.stringify(object)); 9058 } 9059 function queryStringUtils() { 9060 return { 9061 has(url, key) { 9062 let search = url.search; 9063 if (!search) 9064 return false;
9065 let data2 = fromQueryString(search, key); 9066 return Object.keys(data2).includes(key); 9067 }, 9068 get(url, key) { 9069 let search = url.search; 9070 if (!search) 9071 return false; 9072 let data2 = fromQueryString(search, key); 9073 return data2[key]; 9074 }, 9075 set(url, key, value) { 9076 let data2 = fromQueryString(url.search, key); 9077 data2[key] = stripNulls(unwrap(value)); 9078 url.search = toQueryString(data2); 9079 return url; 9080 }, 9081 remove(url, key) { 9082 let data2 = fromQueryString(url.search, key); 9083 delete data2[key]; 9084 url.search = toQueryString(data2); 9085 return url; 9086 } 9087 }; 9088 } 9089 function stripNulls(value) { 9090 if (!isObjecty(value)) 9091 return value; 9092 for (let key in value) { 9093 if (value[key] === null) 9094 delete value[key]; 9095 else 9096 value[key] = stripNulls(value[key]); 9097 } 9098 return value; 9099 } 9100 function toQueryString(data2) { 9101 let isObjecty2 = (subject) => typeof subject === "object" && subject !== null; 9102 let buildQueryStringEntries = (data3, entries2 = {}, baseKey = "") => { 9103 Object.entries(data3).forEach(([iKey, iValue]) => { 9104 let key = baseKey === "" ? iKey : `${baseKey}[${iKey}]`; 9105 if (iValue === null) { 9106 entries2[key] = ""; 9107 } else if (!isObjecty2(iValue)) { 9108 entries2[key] = encodeURIComponent(iValue).replaceAll("%20", "+").replaceAll("%2C", ","); 9109 } else { 9110 entries2 = { ...entries2, ...buildQueryStringEntries(iValue, entries2, key) }; 9111 } 9112 }); 9113 return entries2; 9114 }; 9115 let entries = buildQueryStringEntries(data2); 9116 return Object.entries(entries).map(([key, value]) => `${key}=${value}`).join("&"); 9117 } 9118 function fromQueryString(search, queryKey) { 9119 search = search.replace("?", ""); 9120 if (search === "") 9121 return {}; 9122 let insertDotNotatedValueIntoData = (key, value, data3) => { 9123 let [first2, second, ...rest] = key.split("."); 9124 if (!second) 9125 return data3[key] = value; 9126 if (data3[first2] === void 0) { 9127 data3[first2] = isNaN(second) ? {} : []; 9128 } 9129 insertDotNotatedValueIntoData([second, ...rest].join("."), value, data3[first2]); 9130 }; 9131 let entries = search.split("&").map((i) => i.split("=")); 9132 let data2 = /* @__PURE__ */ Object.create(null); 9133 entries.forEach(([key, value]) => { 9134 if (typeof value == "undefined") 9135 return; 9136 value = decodeURIComponent(value.replaceAll("+", "%20")); 9137 let decodedKey = decodeURIComponent(key); 9138 let shouldBeHandledAsArray = decodedKey.includes("[") && decodedKey.startsWith(queryKey); 9139 if (!shouldBeHandledAsArray) { 9140 data2[key] = value; 9141 } else { 9142 let dotNotatedKey = decodedKey.replaceAll("[", ".").replaceAll("]", ""); 9143 insertDotNotatedValueIntoData(dotNotatedKey, value, data2); 9144 } 9145 }); 9146 return data2; 9147 } 9148 9149
vendor: 13,840 bytes, lines 9149-9535
9149// node_modules/@alpinejs/morph/dist/module.esm.js 9150 function morph(from, toHtml, options) { 9151 monkeyPatchDomSetAttributeToAllowAtSymbols(); 9152 let context = createMorphContext(options); 9153 let toEl = typeof toHtml === "string" ? createElement(toHtml) : toHtml; 9154 if (window.Alpine && window.Alpine.closestDataStack && !from._x_dataStack) { 9155 toEl._x_dataStack = window.Alpine.closestDataStack(from); 9156 toEl._x_dataStack && window.Alpine.cloneNode(from, toEl); 9157 } 9158 context.patch(from, toEl); 9159 return from; 9160 } 9161 function morphBetween(startMarker, endMarker, toHtml, options = {}) { 9162 monkeyPatchDomSetAttributeToAllowAtSymbols(); 9163 let context = createMorphContext(options); 9164 let fromContainer = startMarker.parentNode; 9165 let fromBlock = new Block(startMarker, endMarker); 9166 let toContainer = typeof toHtml === "string" ? (() => { 9167 let container = document.createElement("div"); 9168 container.insertAdjacentHTML("beforeend", toHtml); 9169 return container; 9170 })() : toHtml; 9171 let toStartMarker = document.createComment("[morph-start]"); 9172 let toEndMarker = document.createComment("[morph-end]"); 9173 toContainer.insertBefore(toStartMarker, toContainer.firstChild); 9174 toContainer.appendChild(toEndMarker); 9175 let toBlock = new Block(toStartMarker, toEndMarker); 9176 if (window.Alpine && window.Alpine.closestDataStack) { 9177 toContainer._x_dataStack = window.Alpine.closestDataStack(fromContainer); 9178 toContainer._x_dataStack && window.Alpine.cloneNode(fromContainer, toContainer); 9179 } 9180 context.patchChildren(fromBlock, toBlock); 9181 } 9182 function createMorphContext(options = {}) { 9183 let defaultGetKey = (el) => el.getAttribute("key"); 9184 let noop = () => { 9185 }; 9186 let context = { 9187 key: options.key || defaultGetKey, 9188 lookahead: options.lookahead || false, 9189 updating: options.updating || noop, 9190 updated: options.updated || noop, 9191 removing: options.removing || noop, 9192 removed: options.removed || noop, 9193 adding: options.adding || noop, 9194 added: options.added || noop 9195 }; 9196 context.patch = function(from, to) { 9197 if (context.differentElementNamesTypesOrKeys(from, to)) { 9198 return context.swapElements(from, to); 9199 } 9200 let updateChildrenOnly = false; 9201 let skipChildren = false; 9202 let skipUntil = (predicate) => context.skipUntilCondition = predicate; 9203 if (shouldSkipChildren(context.updating, () => skipChildren = true, skipUntil, from, to, () => updateChildrenOnly = true)) 9204 return; 9205 if (from.nodeType === 1 && window.Alpine) { 9206 window.Alpine.cloneNode(from, to); 9207 if (from._x_teleport && to._x_teleport) { 9208 context.patch(from._x_teleport, to._x_teleport); 9209 } 9210 } 9211 if (textOrComment(to)) { 9212 context.patchNodeValue(from, to); 9213 context.updated(from, to); 9214 return; 9215 } 9216 if (!updateChildrenOnly) { 9217 context.patchAttributes(from, to); 9218 } 9219 context.updated(from, to); 9220 if (!skipChildren) { 9221 context.patchChildren(from, to); 9222 } 9223 }; 9224 context.differentElementNamesTypesOrKeys = function(from, to) { 9225 return from.nodeType != to.nodeType || from.nodeName != to.nodeName || context.getKey(from) != context.getKey(to); 9226 }; 9227 context.swapElements = function(from, to) { 9228 if (shouldSkip(context.removing, from)) 9229 return; 9230 let toCloned = to.cloneNode(true); 9231 if (shouldSkip(context.adding, toCloned)) 9232 return; 9233 from.replaceWith(toCloned); 9234 context.removed(from); 9235 context.added(toCloned); 9236 }; 9237 context.patchNodeValue = function(from, to) { 9238 let value = to.nodeValue; 9239 if (from.nodeValue !== value) { 9240 from.nodeValue = value; 9241 } 9242 }; 9243 context.patchAttributes = function(from, to) { 9244 if (from._x_transitioning) 9245 return; 9246 if (from._x_isShown && !to._x_isShown) { 9247 return; 9248 } 9249 if (!from._x_isShown && to._x_isShown) { 9250 return; 9251 } 9252 let domAttributes = Array.from(from.attributes); 9253 let toAttributes = Array.from(to.attributes); 9254 for (let i = domAttributes.length - 1; i >= 0; i--) { 9255 let name = domAttributes[i].name; 9256 if (!to.hasAttribute(name)) { 9257 if (name === "open" && from.nodeName === "DIALOG" && from.open) { 9258 from.close(); 9259 } else { 9260 from.removeAttribute(name); 9261 } 9262 } 9263 } 9264 for (let i = toAttributes.length - 1; i >= 0; i--) { 9265 let name = toAttributes[i].name; 9266 let value = toAttributes[i].value; 9267 if (from.getAttribute(name) !== value) { 9268 from.setAttribute(name, value); 9269 } 9270 } 9271 }; 9272 context.patchChildren = function(from, to) { 9273 let fromKeys = context.keyToMap(from.children); 9274 let fromKeyHoldovers = {}; 9275 let currentTo = getFirstNode(to); 9276 let currentFrom = getFirstNode(from); 9277 while (currentTo) { 9278 seedingMatchingId(currentTo, currentFrom); 9279 let toKey = context.getKey(currentTo); 9280 let fromKey = context.getKey(currentFrom); 9281 if (context.skipUntilCondition) { 9282 let fromDone = !currentFrom || context.skipUntilCondition(currentFrom); 9283 let toDone = !currentTo || context.skipUntilCondition(currentTo); 9284 if (fromDone && toDone) { 9285 context.skipUntilCondition = null; 9286 } else { 9287 if (!fromDone) 9288 currentFrom = currentFrom && getNextSibling(from, currentFrom); 9289 if (!toDone) 9290 currentTo = currentTo && getNextSibling(to, currentTo); 9291 continue; 9292 } 9293 } 9294 if (!currentFrom) { 9295 if (toKey && fromKeyHoldovers[toKey]) { 9296 let holdover = fromKeyHoldovers[toKey]; 9297 from.appendChild(holdover); 9298 currentFrom = holdover; 9299 fromKey = context.getKey(currentFrom); 9300 } else { 9301 if (!shouldSkip(context.adding, currentTo)) { 9302 let clone2 = currentTo.cloneNode(true); 9303 from.appendChild(clone2); 9304 context.added(clone2); 9305 } 9306 currentTo = getNextSibling(to, currentTo); 9307 continue; 9308 } 9309 } 9310 let isIf = (node) => node && node.nodeType === 8 && node.textContent === "[if BLOCK]><![endif]"; 9311 let isEnd = (node) => node && node.nodeType === 8 && node.textContent === "[if ENDBLOCK]><![endif]"; 9312 if (isIf(currentTo) && isIf(currentFrom)) { 9313 let nestedIfCount = 0; 9314 let fromBlockStart = currentFrom; 9315 while (currentFrom) { 9316 let next = getNextSibling(from, currentFrom); 9317 if (isIf(next)) { 9318 nestedIfCount++; 9319 } else if (isEnd(next) && nestedIfCount > 0) { 9320 nestedIfCount--; 9321 } else if (isEnd(next) && nestedIfCount === 0) { 9322 currentFrom = next; 9323 break; 9324 } 9325 currentFrom = next; 9326 } 9327 let fromBlockEnd = currentFrom; 9328 nestedIfCount = 0; 9329 let toBlockStart = currentTo; 9330 while (currentTo) { 9331 let next = getNextSibling(to, currentTo); 9332 if (isIf(next)) { 9333 nestedIfCount++; 9334 } else if (isEnd(next) && nestedIfCount > 0) { 9335 nestedIfCount--; 9336 } else if (isEnd(next) && nestedIfCount === 0) { 9337 currentTo = next; 9338 break; 9339 } 9340 currentTo = next; 9341 } 9342 let toBlockEnd = currentTo; 9343 let fromBlock = new Block(fromBlockStart, fromBlockEnd); 9344 let toBlock = new Block(toBlockStart, toBlockEnd); 9345 context.patchChildren(fromBlock, toBlock); 9346 continue; 9347 } 9348 if (currentFrom.nodeType === 1 && context.lookahead && !currentFrom.isEqualNode(currentTo)) { 9349 let nextToElementSibling = getNextSibling(to, currentTo); 9350 let found = false; 9351 while (!found && nextToElementSibling) { 9352 if (nextToElementSibling.nodeType === 1 && currentFrom.isEqualNode(nextToElementSibling)) { 9353 found = true; 9354 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 9355 fromKey = context.getKey(currentFrom); 9356 } 9357 nextToElementSibling = getNextSibling(to, nextToElementSibling); 9358 } 9359 } 9360 if (toKey !== fromKey) { 9361 if (!toKey && fromKey) { 9362 fromKeyHoldovers[fromKey] = currentFrom; 9363 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 9364 fromKeyHoldovers[fromKey].remove(); 9365 currentFrom = getNextSibling(from, currentFrom); 9366 currentTo = getNextSibling(to, currentTo); 9367 continue; 9368 } 9369 if (toKey && !fromKey) { 9370 if (fromKeys[toKey]) { 9371 currentFrom.replaceWith(fromKeys[toKey]); 9372 currentFrom = fromKeys[toKey]; 9373 fromKey = context.getKey(currentFrom); 9374 } 9375 } 9376 if (toKey && fromKey) { 9377 let fromKeyNode = fromKeys[toKey]; 9378 if (fromKeyNode) { 9379 fromKeyHoldovers[fromKey] = currentFrom; 9380 currentFrom.replaceWith(fromKeyNode); 9381 currentFrom = fromKeyNode; 9382 fromKey = context.getKey(currentFrom); 9383 } else { 9384 fromKeyHoldovers[fromKey] = currentFrom; 9385 currentFrom = context.addNodeBefore(from, currentTo, currentFrom); 9386 fromKeyHoldovers[fromKey].remove(); 9387 currentFrom = getNextSibling(from, currentFrom); 9388 currentTo = getNextSibling(to, currentTo); 9389 continue; 9390 } 9391 } 9392 } 9393 let currentFromNext = currentFrom && getNextSibling(from, currentFrom); 9394 context.patch(currentFrom, currentTo); 9395 currentTo = currentTo && getNextSibling(to, currentTo); 9396 currentFrom = currentFromNext; 9397 } 9398 let removals = []; 9399 while (currentFrom) { 9400 if (!shouldSkip(context.removing, currentFrom)) 9401 removals.push(currentFrom); 9402 currentFrom = getNextSibling(from, currentFrom); 9403 } 9404 while (removals.length) { 9405 let domForRemoval = removals.shift(); 9406 domForRemoval.remove(); 9407 context.removed(domForRemoval); 9408 } 9409 }; 9410 context.getKey = function(el) { 9411 return el && el.nodeType === 1 && context.key(el); 9412 }; 9413 context.keyToMap = function(els2) { 9414 let map = {}; 9415 for (let el of els2) { 9416 let theKey = context.getKey(el); 9417 if (theKey) { 9418 map[theKey] = el; 9419 } 9420 } 9421 return map; 9422 }; 9423 context.addNodeBefore = function(parent, node, beforeMe) { 9424 if (!shouldSkip(context.adding, node)) { 9425 let clone2 = node.cloneNode(true); 9426 parent.insertBefore(clone2, beforeMe); 9427 context.added(clone2); 9428 return clone2; 9429 } 9430 return node; 9431 }; 9432 return context; 9433 } 9434 morph.step = () => { 9435 }; 9436 morph.log = () => { 9437 }; 9438 function shouldSkip(hook, ...args) { 9439 let skip = false; 9440 hook(...args, () => skip = true); 9441 return skip; 9442 } 9443 function shouldSkipChildren(hook, skipChildren, skipUntil, ...args) { 9444 let skip = false; 9445 hook(...args, () => skip = true, skipChildren, skipUntil); 9446 return skip; 9447 } 9448 var patched = false; 9449 function createElement(html) { 9450 const template = document.createElement("template"); 9451 template.innerHTML = html; 9452 return template.content.firstElementChild; 9453 } 9454 function textOrComment(el) { 9455 return el.nodeType === 3 || el.nodeType === 8; 9456 } 9457 var Block = class { 9458 constructor(start3, end) { 9459 this.startComment = start3; 9460 this.endComment = end; 9461 } 9462 get children() { 9463 let children = []; 9464 let currentNode = this.startComment.nextSibling; 9465 while (currentNode && currentNode !== this.endComment) { 9466 children.push(currentNode); 9467 currentNode = currentNode.nextSibling; 9468 } 9469 return children; 9470 } 9471 appendChild(child) { 9472 this.endComment.before(child); 9473 } 9474 get firstChild() { 9475 let first2 = this.startComment.nextSibling; 9476 if (first2 === this.endComment) 9477 return; 9478 return first2; 9479 } 9480 nextNode(reference) { 9481 let next = reference.nextSibling; 9482 if (next === this.endComment) 9483 return; 9484 return next; 9485 } 9486 insertBefore(newNode, reference) { 9487 reference.before(newNode); 9488 return newNode; 9489 } 9490 }; 9491 function getFirstNode(parent) { 9492 return parent.firstChild; 9493 } 9494 function getNextSibling(parent, reference) { 9495 let next; 9496 if (parent instanceof Block) { 9497 next = parent.nextNode(reference); 9498 } else { 9499 next = reference.nextSibling; 9500 } 9501 return next; 9502 } 9503 function monkeyPatchDomSetAttributeToAllowAtSymbols() { 9504 if (patched) 9505 return; 9506 patched = true; 9507 let original = Element.prototype.setAttribute; 9508 let hostDiv = document.createElement("div"); 9509 Element.prototype.setAttribute = function newSetAttribute(name, value) { 9510 if (!name.includes("@")) { 9511 return original.call(this, name, value); 9512 } 9513 let escapedValue = value.replace(/&/g, "&").replace(/"/g, """); 9514 hostDiv.innerHTML = `<span ${name}="${escapedValue}"></span>`; 9515 let attr = hostDiv.firstElementChild.getAttributeNode(name); 9516 hostDiv.firstElementChild.removeAttributeNode(attr); 9517 this.setAttributeNode(attr); 9518 }; 9519 } 9520 function seedingMatchingId(to, from) { 9521 let fromId = from && from._x_bindings && from._x_bindings.id; 9522 if (!fromId) 9523 return; 9524 if (!to.setAttribute) 9525 return; 9526 to.setAttribute("id", fromId); 9527 to.id = fromId; 9528 } 9529 function src_default8(Alpine3) { 9530 Alpine3.morph = morph; 9531 Alpine3.morphBetween = morphBetween; 9532 } 9533 var module_default8 = src_default8; 9534 9535
vendor: 5,216 bytes, lines 9535-9686
9535// node_modules/@alpinejs/mask/dist/module.esm.js 9536 function src_default9(Alpine3) { 9537 Alpine3.directive("mask", (el, { value, expression }, { effect: effect3, evaluateLater: evaluateLater2, cleanup: cleanup2 }) => { 9538 let templateFn = () => expression; 9539 let lastInputValue = ""; 9540 queueMicrotask(() => { 9541 if (["function", "dynamic"].includes(value)) { 9542 let evaluator = evaluateLater2(expression); 9543 effect3(() => { 9544 templateFn = (input) => { 9545 let result; 9546 Alpine3.dontAutoEvaluateFunctions(() => { 9547 evaluator((value2) => { 9548 result = typeof value2 === "function" ? value2(input) : value2; 9549 }, { scope: { 9550 "$input": input, 9551 "$money": formatMoney.bind({ el }) 9552 } }); 9553 }); 9554 return result; 9555 }; 9556 processInputValue(el, false); 9557 }); 9558 } else { 9559 processInputValue(el, false); 9560 } 9561 if (el._x_model) { 9562 if (el._x_model.get() !== el.value) { 9563 if (!(el._x_model.get() === null && el.value === "")) { 9564 el._x_model.set(el.value); 9565 } 9566 } 9567 let updater = el._x_forceModelUpdate; 9568 el._x_forceModelUpdate = (value2) => { 9569 value2 = String(value2); 9570 let template = templateFn(value2); 9571 if (template && template !== "false") { 9572 value2 = formatInput(template, value2); 9573 } 9574 lastInputValue = value2; 9575 updater(value2); 9576 el._x_model.set(value2); 9577 }; 9578 } 9579 }); 9580 const controller = new AbortController(); 9581 cleanup2(() => { 9582 controller.abort(); 9583 }); 9584 el.addEventListener("input", () => processInputValue(el), { 9585 signal: controller.signal, 9586 capture: true 9587 }); 9588 el.addEventListener("blur", () => processInputValue(el, false), { signal: controller.signal }); 9589 function processInputValue(el2, shouldRestoreCursor = true) { 9590 let input = el2.value; 9591 let template = templateFn(input); 9592 if (!template || template === "false") 9593 return false; 9594 if (lastInputValue.length - el2.value.length === 1) { 9595 return lastInputValue = el2.value; 9596 } 9597 let setInput = () => { 9598 lastInputValue = el2.value = formatInput(template, input); 9599 }; 9600 if (shouldRestoreCursor) { 9601 restoreCursorPosition(el2, template, () => { 9602 setInput(); 9603 }); 9604 } else { 9605 setInput(); 9606 } 9607 } 9608 }).before("model"); 9609 } 9610 function restoreCursorPosition(el, template, callback) { 9611 let cursorPosition = el.selectionStart; 9612 let unformattedValue = el.value; 9613 callback(); 9614 let beforeLeftOfCursorBeforeFormatting = unformattedValue.slice(0, cursorPosition); 9615 let newPosition = formatInput(template, beforeLeftOfCursorBeforeFormatting).length; 9616 el.setSelectionRange(newPosition, newPosition); 9617 } 9618 var regexes = { 9619 "9": /[0-9]/, 9620 "a": /[a-zA-Z]/, 9621 "*": /[a-zA-Z0-9]/ 9622 }; 9623 function formatInput(template, input) { 9624 let templateMark = 0; 9625 let inputMark = 0; 9626 let output = ""; 9627 while (templateMark < template.length && inputMark < input.length) { 9628 let templateChar = template[templateMark]; 9629 let inputChar = input[inputMark]; 9630 if (templateChar in regexes) { 9631 if (regexes[templateChar].test(inputChar)) { 9632 output += inputChar; 9633 templateMark++; 9634 } 9635 inputMark++; 9636 } else { 9637 output += templateChar; 9638 templateMark++; 9639 if (templateChar === input[inputMark]) 9640 inputMark++; 9641 } 9642 } 9643 return output; 9644 } 9645 function formatMoney(input, delimiter = ".", thousands, precision = 2) { 9646 if (input === "-") 9647 return "-"; 9648 if (/^\D+$/.test(input)) 9649 return "9"; 9650 if (thousands === null || thousands === void 0) { 9651 thousands = delimiter === "," ? "." : ","; 9652 } 9653 let addThousands = (input2, thousands2) => { 9654 let output = ""; 9655 let counter = 0; 9656 for (let i = input2.length - 1; i >= 0; i--) { 9657 if (input2[i] === thousands2) 9658 continue; 9659 if (counter === 3) { 9660 output = input2[i] + thousands2 + output; 9661 counter = 0; 9662 } else { 9663 output = input2[i] + output; 9664 } 9665 counter++; 9666 } 9667 return output; 9668 }; 9669 let minus = input.startsWith("-") ? "-" : ""; 9670 let strippedInput = input.replaceAll(new RegExp(`[^0-9\\${delimiter}]`, "g"), ""); 9671 let template = Array.from({ length: strippedInput.split(delimiter)[0].length }).fill("9").join(""); 9672 template = `${minus}${addThousands(template, thousands)}`; 9673 if (precision > 0 && input.includes(delimiter)) 9674 template += `${delimiter}` + "9".repeat(precision); 9675 queueMicrotask(() => { 9676 if (this.el.value.endsWith(delimiter)) 9677 return; 9678 if (this.el.value[this.el.selectionStart - 1] === delimiter) { 9679 this.el.setSelectionRange(this.el.selectionStart - 1, this.el.selectionStart - 1); 9680 } 9681 }); 9682 return template; 9683 } 9684 var module_default9 = src_default9; 9685 9686
9686// js/lifecycle.js 9687 function start2() { 9688 setTimeout(() => ensureLivewireScriptIsntMisplaced()); 9689 dispatch(document, "livewire:init"); 9690 dispatch(document, "livewire:initializing"); 9691 module_default.plugin(module_default8); 9692 module_default.plugin(history2); 9693 module_default.plugin(module_default5); 9694 module_default.plugin(module_default6); 9695 module_default.plugin(module_default2); 9696 module_default.plugin(module_default7); 9697 module_default.plugin(module_default3); 9698 module_default.plugin(module_default4); 9699 module_default.plugin(navigate_default); 9700 module_default.plugin(module_default9); 9701 module_default.addRootSelector(() => "[wire\\:id]"); 9702 module_default.onAttributesAdded((el, attributes) => { 9703 if (!Array.from(attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 9704 return; 9705 let component = closestComponent(el, false); 9706 if (!component) 9707 return; 9708 attributes.forEach((attribute) => { 9709 if (!matchesForLivewireDirective(attribute.name)) 9710 return; 9711 let directive3 = extractDirective(el, attribute.name); 9712 trigger2("directive.init", { el, component, directive: directive3, cleanup: (callback) => { 9713 module_default.onAttributeRemoved(el, directive3.raw, callback); 9714 } }); 9715 }); 9716 }); 9717 module_default.interceptInit(module_default.skipDuringClone((el) => { 9718 if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 9719 return; 9720 if (el.hasAttribute("wire:id") && !el.__livewire && !hasComponent(el.getAttribute("wire:id"))) { 9721 let component2 = initComponent(el); 9722 module_default.onAttributeRemoved(el, "wire:id", () => { 9723 destroyComponent(component2.id); 9724 }); 9725 } 9726 let directives2 = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name)); 9727 directives2.forEach((directive3) => { 9728 trigger2("directive.global.init", { el, directive: directive3, cleanup: (callback) => { 9729 module_default.onAttributeRemoved(el, directive3.raw, callback); 9730 } }); 9731 }); 9732 let component = closestComponent(el, false); 9733 if (component) { 9734 trigger2("element.init", { el, component }); 9735 directives2.forEach((directive3) => { 9736 trigger2("directive.init", { el, component, directive: directive3, cleanup: (callback) => { 9737 module_default.onAttributeRemoved(el, directive3.raw, callback); 9738 } }); 9739 }); 9740 } 9741 }, (el) => { 9742 if (!Array.from(el.attributes).some((attribute) => matchesForLivewireDirective(attribute.name))) 9743 return; 9744 let directives2 = Array.from(el.getAttributeNames()).filter((name) => matchesForLivewireDirective(name)).map((name) => extractDirective(el, name)); 9745 directives2.forEach((directive3) => { 9746 trigger2("directive.global.init", { el, directive: directive3, cleanup: (callback) => { 9747 module_default.onAttributeRemoved(el, directive3.raw, callback); 9748 } }); 9749 }); 9750 })); 9751 module_default.start(); 9752 setTimeout(() => window.Livewire.initialRenderIsFinished = true); 9753 dispatch(document, "livewire:initialized"); 9754 } 9755 function ensureLivewireScriptIsntMisplaced() { 9756 let el = document.querySelector("script[data-update-uri][data-csrf]"); 9757 if (!el) 9758 return; 9759 let livewireEl = el.closest("[wire\\:id]"); 9760 if (livewireEl) { 9761 console.warn("Livewire: missing closing tags found. Ensure your template elements contain matching closing tags.", livewireEl); 9762 } 9763 } 9764 9765
9765// js/features/supportListeners.js 9766 on2("effect", ({ component, effects }) => { 9767 registerListeners(component, effects.listeners || []); 9768 }); 9769 function registerListeners(component, listeners2) { 9770 listeners2.forEach((name) => { 9771 let handler4 = (e) => { 9772 if (e.__livewire) 9773 e.__livewire.receivedBy.push(component); 9774 component.$wire.call("__dispatch", name, e.detail || {}); 9775 }; 9776 window.addEventListener(name, handler4); 9777 component.addCleanup(() => window.removeEventListener(name, handler4)); 9778 component.el.addEventListener(name, (e) => { 9779 if (!e.__livewire) 9780 return; 9781 if (e.bubbles) 9782 return; 9783 if (e.__livewire) 9784 e.__livewire.receivedBy.push(component.id); 9785 component.$wire.call("__dispatch", name, e.detail || {}); 9786 }); 9787 }); 9788 } 9789 9790
9790// js/features/supportScriptsAndAssets.js 9791 var executedScripts = /* @__PURE__ */ new WeakMap(); 9792 var executedAssets = /* @__PURE__ */ new Set(); 9793 on2("payload.intercept", async ({ assets }) => { 9794 if (!assets) 9795 return; 9796 for (let [key, asset] of Object.entries(assets)) { 9797 await onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, async () => { 9798 await addAssetsToHeadTagOfPage(asset); 9799 }); 9800 } 9801 }); 9802 on2("component.init", ({ component }) => { 9803 let assets = component.snapshot.memo.assets; 9804 if (assets) { 9805 assets.forEach((key) => { 9806 if (executedAssets.has(key)) 9807 return; 9808 executedAssets.add(key); 9809 }); 9810 } 9811 }); 9812 on2("effect", ({ component, effects }) => { 9813 let scripts = effects.scripts; 9814 if (scripts) { 9815 Object.entries(scripts).forEach(([key, content]) => { 9816 onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, () => { 9817 let scriptContent = extractScriptTagContent(content); 9818 module_default.dontAutoEvaluateFunctions(() => { 9819 module_default.evaluate(component.el, scriptContent, { "$wire": component.$wire, "$js": component.$wire.$js }); 9820 }); 9821 }); 9822 }); 9823 } 9824 }); 9825 function onlyIfScriptHasntBeenRunAlreadyForThisComponent(component, key, callback) { 9826 if (executedScripts.has(component)) { 9827 let alreadyRunKeys2 = executedScripts.get(component); 9828 if (alreadyRunKeys2.includes(key)) 9829 return; 9830 } 9831 callback(); 9832 if (!executedScripts.has(component)) 9833 executedScripts.set(component, []); 9834 let alreadyRunKeys = executedScripts.get(component); 9835 alreadyRunKeys.push(key); 9836 executedScripts.set(component, alreadyRunKeys); 9837 } 9838 function extractScriptTagContent(rawHtml) { 9839 let scriptRegex = /<script\b[^>]*>([\s\S]*?)<\/script>/gm; 9840 let matches2 = scriptRegex.exec(rawHtml); 9841 let innards = matches2 && matches2[1] ? matches2[1].trim() : ""; 9842 return innards; 9843 } 9844 async function onlyIfAssetsHaventBeenLoadedAlreadyOnThisPage(key, callback) { 9845 if (executedAssets.has(key)) 9846 return; 9847 await callback(); 9848 executedAssets.add(key); 9849 } 9850 async function addAssetsToHeadTagOfPage(rawHtml) { 9851 let newDocument = new DOMParser().parseFromString(rawHtml, "text/html"); 9852 let newHead = document.adoptNode(newDocument.head); 9853 for (let child of newHead.children) { 9854 try { 9855 await runAssetSynchronously(child); 9856 } catch (error2) { 9857 } 9858 } 9859 } 9860 async function runAssetSynchronously(child) { 9861 return new Promise((resolve, reject) => { 9862 if (isScript2(child)) { 9863 let script = cloneScriptTag2(child); 9864 if (script.src) { 9865 script.onload = () => resolve(); 9866 script.onerror = () => reject(); 9867 } else { 9868 resolve(); 9869 } 9870 document.head.appendChild(script); 9871 } else { 9872 document.head.appendChild(child); 9873 resolve(); 9874 } 9875 }); 9876 } 9877 function isScript2(el) { 9878 return el.tagName.toLowerCase() === "script"; 9879 } 9880 function cloneScriptTag2(el) { 9881 let script = document.createElement("script"); 9882 script.textContent = el.textContent; 9883 script.async = el.async; 9884 for (let attr of el.attributes) { 9885 script.setAttribute(attr.name, attr.value); 9886 } 9887 return script; 9888 } 9889 9890
9890// js/features/supportJsEvaluation.js 9891 module_default.magic("js", (el) => { 9892 let component = closestComponent(el); 9893 return component.$wire.js; 9894 }); 9895 on2("effect", ({ component, effects }) => { 9896 let js = effects.js; 9897 let xjs = effects.xjs; 9898 if (js) { 9899 Object.entries(js).forEach(([method, body]) => { 9900 overrideMethod(component, method, () => { 9901 module_default.evaluate(component.el, body); 9902 }); 9903 }); 9904 } 9905 if (xjs) { 9906 xjs.forEach(({ expression, params }) => { 9907 params = Object.values(params); 9908 module_default.evaluate(component.el, expression, { scope: component.jsActions, params }); 9909 }); 9910 } 9911 }); 9912 9913
9913// js/morph.js 9914 function morph2(component, el, html) { 9915 let wrapperTag = el.parentElement ? el.parentElement.tagName.toLowerCase() : "div"; 9916 let customElement = customElements.get(wrapperTag); 9917 wrapperTag = customElement ? customElement.name : wrapperTag; 9918 let wrapper = document.createElement(wrapperTag); 9919 wrapper.innerHTML = html; 9920 let parentComponent; 9921 try { 9922 parentComponent = closestComponent(el.parentElement); 9923 } catch (e) { 9924 } 9925 parentComponent && (wrapper.__livewire = parentComponent); 9926 let to = wrapper.firstElementChild; 9927 to.setAttribute("wire:snapshot", component.snapshotEncoded); 9928 let effects = { ...component.effects }; 9929 delete effects.html; 9930 to.setAttribute("wire:effects", JSON.stringify(effects)); 9931 to.__livewire = component; 9932 trigger2("morph", { el, toEl: to, component }); 9933 let existingComponentsMap = {}; 9934 el.querySelectorAll("[wire\\:id]").forEach((component2) => { 9935 existingComponentsMap[component2.getAttribute("wire:id")] = component2; 9936 }); 9937 to.querySelectorAll("[wire\\:id]").forEach((child) => { 9938 if (child.hasAttribute("wire:snapshot")) 9939 return; 9940 let wireId = child.getAttribute("wire:id"); 9941 let existingComponent = existingComponentsMap[wireId]; 9942 if (existingComponent) { 9943 child.replaceWith(existingComponent.cloneNode(true)); 9944 } 9945 }); 9946 module_default.morph(el, to, { 9947 updating: (el2, toEl, childrenOnly, skip, skipChildren) => { 9948 if (isntElement(el2)) 9949 return; 9950 trigger2("morph.updating", { el: el2, toEl, component, skip, childrenOnly, skipChildren }); 9951 if (el2.__livewire_replace === true) 9952 el2.innerHTML = toEl.innerHTML; 9953 if (el2.__livewire_replace_self === true) { 9954 el2.outerHTML = toEl.outerHTML; 9955 return skip(); 9956 } 9957 if (el2.__livewire_ignore === true) 9958 return skip(); 9959 if (el2.__livewire_ignore_self === true) 9960 childrenOnly(); 9961 if (el2.__livewire_ignore_children === true) 9962 return skipChildren(); 9963 if (isComponentRootEl(el2) && el2.getAttribute("wire:id") !== component.id) 9964 return skip(); 9965 if (isComponentRootEl(el2)) 9966 toEl.__livewire = component; 9967 }, 9968 updated: (el2) => { 9969 if (isntElement(el2)) 9970 return; 9971 trigger2("morph.updated", { el: el2, component }); 9972 }, 9973 removing: (el2, skip) => { 9974 if (isntElement(el2)) 9975 return; 9976 trigger2("morph.removing", { el: el2, component, skip }); 9977 }, 9978 removed: (el2) => { 9979 if (isntElement(el2)) 9980 return; 9981 trigger2("morph.removed", { el: el2, component }); 9982 }, 9983 adding: (el2) => { 9984 trigger2("morph.adding", { el: el2, component }); 9985 }, 9986 added: (el2) => { 9987 if (isntElement(el2)) 9988 return; 9989 const closestComponentId = closestComponent(el2).id; 9990 trigger2("morph.added", { el: el2 }); 9991 }, 9992 key: (el2) => { 9993 if (isntElement(el2)) 9994 return; 9995 return el2.hasAttribute(`wire:key`) ? el2.getAttribute(`wire:key`) : el2.hasAttribute(`wire:id`) ? el2.getAttribute(`wire:id`) : el2.id; 9996 }, 9997 lookahead: false 9998 }); 9999 trigger2("morphed", { el, component }); 10000 } 10001 function isntElement(el) { 10002 return typeof el.hasAttribute !== "function"; 10003 } 10004 function isComponentRootEl(el) { 10005 return el.hasAttribute("wire:id"); 10006 } 10007 10008
10008// js/features/supportMorphDom.js 10009 on2("effect", ({ component, effects }) => { 10010 let html = effects.html; 10011 if (!html) 10012 return; 10013 queueMicrotask(() => { 10014 queueMicrotask(() => { 10015 morph2(component, component.el, html); 10016 }); 10017 }); 10018 }); 10019 10020
10020// js/features/supportDispatches.js 10021 on2("effect", ({ component, effects }) => { 10022 queueMicrotask(() => { 10023 queueMicrotask(() => { 10024 queueMicrotask(() => { 10025 dispatchEvents(component, effects.dispatches || []); 10026 }); 10027 }); 10028 }); 10029 }); 10030 function dispatchEvents(component, dispatches) { 10031 dispatches.forEach(({ name, params = {}, self = false, to }) => { 10032 if (self) 10033 dispatchSelf(component, name, params); 10034 else if (to) 10035 dispatchTo(to, name, params); 10036 else 10037 dispatch3(component, name, params); 10038 }); 10039 } 10040 10041
10041// js/features/supportDisablingFormsDuringRequest.js 10042 var cleanups = new Bag(); 10043 on2("directive.init", ({ el, directive: directive3, cleanup: cleanup2, component }) => setTimeout(() => { 10044 if (directive3.value !== "submit") 10045 return; 10046 el.addEventListener("submit", () => { 10047 let componentId = directive3.expression.startsWith("$parent") ? component.parent.id : component.id; 10048 let cleanup3 = disableForm(el); 10049 cleanups.add(componentId, cleanup3); 10050 }); 10051 })); 10052 on2("commit", ({ component, respond }) => { 10053 respond(() => { 10054 cleanups.each(component.id, (i) => i()); 10055 cleanups.remove(component.id); 10056 }); 10057 }); 10058 function disableForm(formEl) { 10059 let undos = []; 10060 module_default.walk(formEl, (el, skip) => { 10061 if (!formEl.contains(el)) 10062 return; 10063 if (el.hasAttribute("wire:ignore")) 10064 return skip(); 10065 if (shouldMarkDisabled(el)) { 10066 undos.push(markDisabled(el)); 10067 } else if (shouldMarkReadOnly(el)) { 10068 undos.push(markReadOnly(el)); 10069 } 10070 }); 10071 return () => { 10072 while (undos.length > 0) 10073 undos.shift()(); 10074 }; 10075 } 10076 function shouldMarkDisabled(el) { 10077 let tag = el.tagName.toLowerCase(); 10078 if (tag === "select") 10079 return true; 10080 if (tag === "button" && el.type === "submit") 10081 return true; 10082 if (tag === "input" && (el.type === "checkbox" || el.type === "radio")) 10083 return true; 10084 return false; 10085 } 10086 function shouldMarkReadOnly(el) { 10087 return ["input", "textarea"].includes(el.tagName.toLowerCase()); 10088 } 10089 function markDisabled(el) { 10090 let undo = el.disabled ? () => { 10091 } : () => el.disabled = false; 10092 el.disabled = true; 10093 return undo; 10094 } 10095 function markReadOnly(el) { 10096 let undo = el.readOnly ? () => { 10097 } : () => el.readOnly = false; 10098 el.readOnly = true; 10099 return undo; 10100 } 10101 10102
10102// js/features/supportPropsAndModelables.js 10103 on2("commit.pooling", ({ commits }) => { 10104 commits.forEach((commit) => { 10105 let component = commit.component; 10106 getDeepChildrenWithBindings(component, (child) => { 10107 child.$wire.$commit(); 10108 }); 10109 }); 10110 }); 10111 on2("commit.pooled", ({ pools }) => { 10112 let commits = getPooledCommits(pools); 10113 commits.forEach((commit) => { 10114 let component = commit.component; 10115 getDeepChildrenWithBindings(component, (child) => { 10116 colocateCommitsByComponent(pools, component, child); 10117 }); 10118 }); 10119 }); 10120 function getPooledCommits(pools) { 10121 let commits = []; 10122 pools.forEach((pool) => { 10123 pool.commits.forEach((commit) => { 10124 commits.push(commit); 10125 }); 10126 }); 10127 return commits; 10128 } 10129 function colocateCommitsByComponent(pools, component, foreignComponent) { 10130 let pool = findPoolWithComponent(pools, component); 10131 let foreignPool = findPoolWithComponent(pools, foreignComponent); 10132 if (!foreignPool) 10133 return; 10134 let foreignCommit = foreignPool.findCommitByComponent(foreignComponent); 10135 foreignPool.delete(foreignCommit); 10136 pool.add(foreignCommit); 10137 pools.forEach((pool2) => { 10138 if (pool2.empty()) 10139 pools.delete(pool2); 10140 }); 10141 } 10142 function findPoolWithComponent(pools, component) { 10143 for (let [idx, pool] of pools.entries()) { 10144 if (pool.hasCommitFor(component)) 10145 return pool; 10146 } 10147 } 10148 function getDeepChildrenWithBindings(component, callback) { 10149 getDeepChildren(component, (child) => { 10150 if (child.isLazy && !child.hasBeenLazyLoaded) 10151 return; 10152 if (hasReactiveProps(child) || hasWireModelableBindings(child)) { 10153 callback(child); 10154 } 10155 }); 10156 } 10157 function hasReactiveProps(component) { 10158 let meta = component.snapshot.memo; 10159 let props = meta.props; 10160 return !!props; 10161 } 10162 function hasWireModelableBindings(component) { 10163 let meta = component.snapshot.memo; 10164 let bindings = meta.bindings; 10165 return !!bindings; 10166 } 10167 function getDeepChildren(component, callback) { 10168 component.children.forEach((child) => { 10169 callback(child); 10170 getDeepChildren(child, callback); 10171 }); 10172 } 10173 10174
10174// js/features/supportFileDownloads.js 10175 on2("commit", ({ succeed }) => { 10176 succeed(({ effects }) => { 10177 let download = effects.download; 10178 if (!download) 10179 return; 10180 let urlObject = window.webkitURL || window.URL; 10181 let url = urlObject.createObjectURL(base64toBlob(download.content, download.contentType)); 10182 let invisibleLink = document.createElement("a"); 10183 invisibleLink.style.display = "none"; 10184 invisibleLink.href = url; 10185 invisibleLink.download = download.name; 10186 document.body.appendChild(invisibleLink); 10187 invisibleLink.click(); 10188 setTimeout(function() { 10189 urlObject.revokeObjectURL(url); 10190 }, 0); 10191 }); 10192 }); 10193 function base64toBlob(b64Data, contentType = "", sliceSize = 512) { 10194 const byteCharacters = atob(b64Data); 10195 const byteArrays = []; 10196 if (contentType === null) 10197 contentType = ""; 10198 for (let offset2 = 0; offset2 < byteCharacters.length; offset2 += sliceSize) { 10199 let slice = byteCharacters.slice(offset2, offset2 + sliceSize); 10200 let byteNumbers = new Array(slice.length); 10201 for (let i = 0; i < slice.length; i++) { 10202 byteNumbers[i] = slice.charCodeAt(i); 10203 } 10204 let byteArray = new Uint8Array(byteNumbers); 10205 byteArrays.push(byteArray); 10206 } 10207 return new Blob(byteArrays, { type: contentType }); 10208 } 10209 10210
10210// js/features/supportLazyLoading.js 10211 var componentsThatWantToBeBundled = /* @__PURE__ */ new WeakSet(); 10212 var componentsThatAreLazy = /* @__PURE__ */ new WeakSet(); 10213 on2("component.init", ({ component }) => { 10214 let memo = component.snapshot.memo; 10215 if (memo.lazyLoaded === void 0) 10216 return; 10217 componentsThatAreLazy.add(component); 10218 if (memo.lazyIsolated !== void 0 && memo.lazyIsolated === false) { 10219 componentsThatWantToBeBundled.add(component); 10220 } 10221 }); 10222 on2("commit.pooling", ({ commits }) => { 10223 commits.forEach((commit) => { 10224 if (!componentsThatAreLazy.has(commit.component)) 10225 return; 10226 if (componentsThatWantToBeBundled.has(commit.component)) { 10227 commit.isolate = false; 10228 componentsThatWantToBeBundled.delete(commit.component); 10229 } else { 10230 commit.isolate = true; 10231 } 10232 componentsThatAreLazy.delete(commit.component); 10233 }); 10234 }); 10235 10236
10236// js/features/supportQueryString.js 10237 on2("effect", ({ component, effects, cleanup: cleanup2 }) => { 10238 let queryString = effects["url"]; 10239 if (!queryString) 10240 return; 10241 Object.entries(queryString).forEach(([key, value]) => { 10242 let { name, as, use, alwaysShow, except } = normalizeQueryStringEntry(key, value); 10243 if (!as) 10244 as = name; 10245 let initialValue = [false, null, void 0].includes(except) ? dataGet(component.ephemeral, name) : except; 10246 let { replace: replace2, push: push2, pop } = track2(as, initialValue, alwaysShow, except); 10247 if (use === "replace") { 10248 let effectReference = module_default.effect(() => { 10249 replace2(dataGet(component.reactive, name)); 10250 }); 10251 cleanup2(() => module_default.release(effectReference)); 10252 } else if (use === "push") { 10253 let forgetCommitHandler = on2("commit", ({ component: commitComponent, succeed }) => { 10254 if (component !== commitComponent) 10255 return; 10256 let beforeValue = dataGet(component.canonical, name); 10257 succeed(() => { 10258 let afterValue = dataGet(component.canonical, name); 10259 if (JSON.stringify(beforeValue) === JSON.stringify(afterValue)) 10260 return; 10261 push2(afterValue); 10262 }); 10263 }); 10264 let forgetPopHandler = pop(async (newValue) => { 10265 await component.$wire.set(name, newValue); 10266 document.querySelectorAll("input").forEach((el) => { 10267 el._x_forceModelUpdate && el._x_forceModelUpdate(el._x_model.get()); 10268 }); 10269 }); 10270 cleanup2(() => { 10271 forgetCommitHandler(); 10272 forgetPopHandler(); 10273 }); 10274 } 10275 }); 10276 }); 10277 function normalizeQueryStringEntry(key, value) { 10278 let defaults = { use: "replace", alwaysShow: false }; 10279 if (typeof value === "string") { 10280 return { ...defaults, name: value, as: value }; 10281 } else { 10282 let fullerDefaults = { ...defaults, name: key, as: key }; 10283 return { ...fullerDefaults, ...value }; 10284 } 10285 } 10286 10287
10287// js/features/supportLaravelEcho.js 10288 on2("request", ({ options }) => { 10289 if (window.Echo) { 10290 options.headers["X-Socket-ID"] = window.Echo.socketId(); 10291 } 10292 }); 10293 on2("effect", ({ component, effects }) => { 10294 let listeners2 = effects.listeners || []; 10295 listeners2.forEach((event) => { 10296 if (event.startsWith("echo")) { 10297 if (typeof window.Echo === "undefined") { 10298 console.warn("Laravel Echo cannot be found"); 10299 return; 10300 } 10301 let event_parts = event.split(/(echo:|echo-)|:|,/); 10302 if (event_parts[1] == "echo:") { 10303 event_parts.splice(2, 0, "channel", void 0); 10304 } 10305 if (event_parts[2] == "notification") { 10306 event_parts.push(void 0, void 0); 10307 } 10308 let [ 10309 s1, 10310 signature, 10311 channel_type, 10312 s2, 10313 channel, 10314 s3, 10315 event_name 10316 ] = event_parts; 10317 if (["channel", "private", "encryptedPrivate"].includes(channel_type)) { 10318 let handler4 = (e) => dispatchSelf(component, event, [e]); 10319 window.Echo[channel_type](channel).listen(event_name, handler4); 10320 component.addCleanup(() => { 10321 window.Echo[channel_type](channel).stopListening(event_name, handler4); 10322 }); 10323 } else if (channel_type == "presence") { 10324 if (["here", "joining", "leaving"].includes(event_name)) { 10325 window.Echo.join(channel)[event_name]((e) => { 10326 dispatchSelf(component, event, [e]); 10327 }); 10328 } else { 10329 let handler4 = (e) => dispatchSelf(component, event, [e]); 10330 window.Echo.join(channel).listen(event_name, handler4); 10331 component.addCleanup(() => { 10332 window.Echo.leaveChannel(channel); 10333 }); 10334 } 10335 } else if (channel_type == "notification") { 10336 window.Echo.private(channel).notification((notification) => { 10337 dispatchSelf(component, event, [notification]); 10338 }); 10339 } else { 10340 console.warn("Echo channel type not yet supported"); 10341 } 10342 } 10343 }); 10344 }); 10345 10346
10346// js/features/supportIsolating.js 10347 var componentsThatAreIsolated = /* @__PURE__ */ new WeakSet(); 10348 on2("component.init", ({ component }) => { 10349 let memo = component.snapshot.memo; 10350 if (memo.isolate !== true) 10351 return; 10352 componentsThatAreIsolated.add(component); 10353 }); 10354 on2("commit.pooling", ({ commits }) => { 10355 commits.forEach((commit) => { 10356 if (!componentsThatAreIsolated.has(commit.component)) 10357 return; 10358 commit.isolate = true; 10359 }); 10360 }); 10361 10362
10362// js/features/supportNavigate.js 10363 shouldHideProgressBar() && Alpine.navigate.disableProgressBar(); 10364 document.addEventListener("alpine:navigate", (e) => forwardEvent("livewire:navigate", e)); 10365 document.addEventListener("alpine:navigating", (e) => forwardEvent("livewire:navigating", e)); 10366 document.addEventListener("alpine:navigated", (e) => forwardEvent("livewire:navigated", e)); 10367 function forwardEvent(name, original) { 10368 let event = new CustomEvent(name, { cancelable: true, bubbles: true, detail: original.detail }); 10369 document.dispatchEvent(event); 10370 if (event.defaultPrevented) { 10371 original.preventDefault(); 10372 } 10373 } 10374 function shouldRedirectUsingNavigateOr(effects, url, or) { 10375 let forceNavigate = effects.redirectUsingNavigate; 10376 if (forceNavigate) { 10377 Alpine.navigate(url); 10378 } else { 10379 or(); 10380 } 10381 } 10382 function shouldHideProgressBar() { 10383 if (!!document.querySelector("[data-no-progress-bar]")) 10384 return true; 10385 if (window.livewireScriptConfig && window.livewireScriptConfig.progressBar === false) 10386 return true; 10387 return false; 10388 } 10389 10390
10390// js/features/supportRedirects.js 10391 on2("effect", ({ effects }) => { 10392 if (!effects["redirect"]) 10393 return; 10394 let url = effects["redirect"]; 10395 shouldRedirectUsingNavigateOr(effects, url, () => { 10396 window.location.href = url; 10397 }); 10398 }); 10399 10400
10400// js/directives/wire-transition.js 10401 on2("morph.added", ({ el }) => { 10402 el.__addedByMorph = true; 10403 }); 10404 directive2("transition", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 10405 for (let i = 0; i < el.attributes.length; i++) { 10406 if (el.attributes[i].name.startsWith("wire:show")) { 10407 module_default.bind(el, { 10408 [directive3.rawName.replace("wire:transition", "x-transition")]: directive3.expression 10409 }); 10410 return; 10411 } 10412 } 10413 let visibility = module_default.reactive({ state: el.__addedByMorph ? false : true }); 10414 module_default.bind(el, { 10415 [directive3.rawName.replace("wire:", "x-")]: "", 10416 "x-show"() { 10417 return visibility.state; 10418 } 10419 }); 10420 el.__addedByMorph && setTimeout(() => visibility.state = true); 10421 let cleanups2 = []; 10422 cleanups2.push(on2("morph.removing", ({ el: el2, skip }) => { 10423 skip(); 10424 el2.addEventListener("transitionend", () => { 10425 el2.remove(); 10426 }); 10427 visibility.state = false; 10428 cleanups2.push(on2("morph", ({ component: morphComponent }) => { 10429 if (morphComponent !== component) 10430 return; 10431 el2.remove(); 10432 cleanups2.forEach((i) => i()); 10433 })); 10434 })); 10435 cleanup2(() => cleanups2.forEach((i) => i())); 10436 }); 10437 10438
10438// js/debounce.js 10439 var callbacksByComponent = new WeakBag(); 10440 function callAndClearComponentDebounces(component, callback) { 10441 callbacksByComponent.each(component, (callbackRegister) => { 10442 callbackRegister.callback(); 10443 callbackRegister.callback = () => { 10444 }; 10445 }); 10446 callback(); 10447 } 10448 10449
10449// js/directives/wire-wildcard.js 10450 on2("directive.init", ({ el, directive: directive3, cleanup: cleanup2, component }) => { 10451 if (["snapshot", "effects", "model", "init", "loading", "poll", "ignore", "id", "data", "key", "target", "dirty"].includes(directive3.value)) 10452 return; 10453 if (customDirectiveHasBeenRegistered(directive3.value)) 10454 return; 10455 let attribute = directive3.rawName.replace("wire:", "x-on:"); 10456 if (directive3.value === "submit" && !directive3.modifiers.includes("prevent")) { 10457 attribute = attribute + ".prevent"; 10458 } 10459 let cleanupBinding = module_default.bind(el, { 10460 [attribute](e) { 10461 let execute = () => { 10462 callAndClearComponentDebounces(component, () => { 10463 module_default.evaluate(el, "$wire." + directive3.expression, { scope: { $event: e } }); 10464 }); 10465 }; 10466 if (el.__livewire_confirm) { 10467 el.__livewire_confirm(() => { 10468 execute(); 10469 }, () => { 10470 e.stopImmediatePropagation(); 10471 }); 10472 } else { 10473 execute(); 10474 } 10475 } 10476 }); 10477 cleanup2(cleanupBinding); 10478 }); 10479 10480
10480// js/directives/wire-navigate.js 10481 module_default.addInitSelector(() => `[wire\\:navigate]`); 10482 module_default.addInitSelector(() => `[wire\\:navigate\\.hover]`); 10483 module_default.addInitSelector(() => `[wire\\:navigate\\.preserve-scroll]`); 10484 module_default.addInitSelector(() => `[wire\\:navigate\\.preserve-scroll\\.hover]`); 10485 module_default.addInitSelector(() => `[wire\\:navigate\\.hover\\.preserve-scroll]`); 10486 module_default.interceptInit(module_default.skipDuringClone((el) => { 10487 if (el.hasAttribute("wire:navigate")) { 10488 module_default.bind(el, { ["x-navigate"]: true }); 10489 } else if (el.hasAttribute("wire:navigate.hover")) { 10490 module_default.bind(el, { ["x-navigate.hover"]: true }); 10491 } else if (el.hasAttribute("wire:navigate.preserve-scroll")) { 10492 module_default.bind(el, { ["x-navigate.preserve-scroll"]: true }); 10493 } else if (el.hasAttribute("wire:navigate.preserve-scroll.hover")) { 10494 module_default.bind(el, { ["x-navigate.preserve-scroll.hover"]: true }); 10495 } else if (el.hasAttribute("wire:navigate.hover.preserve-scroll")) { 10496 module_default.bind(el, { ["x-navigate.hover.preserve-scroll"]: true }); 10497 } 10498 })); 10499 document.addEventListener("alpine:navigating", () => { 10500 Livewire.all().forEach((component) => { 10501 component.inscribeSnapshotAndEffectsOnElement(); 10502 }); 10503 }); 10504 10505
10505// js/directives/wire-confirm.js 10506 directive2("confirm", ({ el, directive: directive3 }) => { 10507 let message = directive3.expression; 10508 let shouldPrompt = directive3.modifiers.includes("prompt"); 10509 message = message.replaceAll("\\n", "\n"); 10510 if (message === "") 10511 message = "Are you sure?"; 10512 el.__livewire_confirm = (action, instead) => { 10513 if (shouldPrompt) { 10514 let [question, expected] = message.split("|"); 10515 if (!expected) { 10516 console.warn("Livewire: Must provide expectation with wire:confirm.prompt"); 10517 } else { 10518 let input = prompt(question); 10519 if (input === expected) { 10520 action(); 10521 } else { 10522 instead(); 10523 } 10524 } 10525 } else { 10526 if (confirm(message)) 10527 action(); 10528 else 10529 instead(); 10530 } 10531 }; 10532 }); 10533 10534
10534// js/directives/wire-current.js 10535 module_default.addInitSelector(() => `[wire\\:current]`); 10536 var onPageChanges = /* @__PURE__ */ new Map(); 10537 document.addEventListener("livewire:navigated", () => { 10538 onPageChanges.forEach((i) => i(new URL(window.location.href))); 10539 }); 10540 globalDirective("current", ({ el, directive: directive3, cleanup: cleanup2 }) => { 10541 let expression = directive3.expression; 10542 let options = { 10543 exact: directive3.modifiers.includes("exact"), 10544 strict: directive3.modifiers.includes("strict"), 10545 ignore: directive3.modifiers.includes("ignore") 10546 }; 10547 if (options.ignore) 10548 return; 10549 if (expression.startsWith("#")) 10550 return; 10551 if (!el.hasAttribute("href")) 10552 return; 10553 let href = el.getAttribute("href"); 10554 let hrefUrl = new URL(href, window.location.href); 10555 let classes = expression.split(" ").filter(String); 10556 let refreshCurrent = (url) => { 10557 if (pathMatches(hrefUrl, url, options)) { 10558 el.classList.add(...classes); 10559 el.setAttribute("data-current", ""); 10560 } else { 10561 el.classList.remove(...classes); 10562 el.removeAttribute("data-current"); 10563 } 10564 };
10565 refreshCurrent(new URL(window.location.href)); 10566 onPageChanges.set(el, refreshCurrent); 10567 cleanup2(() => onPageChanges.delete(el)); 10568 }); 10569 function pathMatches(hrefUrl, actualUrl, options) { 10570 if (hrefUrl.hostname !== actualUrl.hostname) 10571 return false; 10572 let hrefPath = options.strict ? hrefUrl.pathname : hrefUrl.pathname.replace(/\/+$/, ""); 10573 let actualPath = options.strict ? actualUrl.pathname : actualUrl.pathname.replace(/\/+$/, ""); 10574 if (options.exact) { 10575 return hrefPath === actualPath; 10576 } 10577 let hrefPathSegments = hrefPath.split("/"); 10578 let actualPathSegments = actualPath.split("/"); 10579 for (let i = 0; i < hrefPathSegments.length; i++) { 10580 if (hrefPathSegments[i] !== actualPathSegments[i]) 10581 return false; 10582 } 10583 return true; 10584 } 10585 10586
10586// js/directives/shared.js 10587 function toggleBooleanStateDirective(el, directive3, isTruthy, cachedDisplay = null) { 10588 isTruthy = directive3.modifiers.includes("remove") ? !isTruthy : isTruthy; 10589 if (directive3.modifiers.includes("class")) { 10590 let classes = directive3.expression.split(" ").filter(String); 10591 if (isTruthy) { 10592 el.classList.add(...classes); 10593 } else { 10594 el.classList.remove(...classes); 10595 } 10596 } else if (directive3.modifiers.includes("attr")) { 10597 if (isTruthy) { 10598 el.setAttribute(directive3.expression, true); 10599 } else { 10600 el.removeAttribute(directive3.expression); 10601 } 10602 } else { 10603 let cache = cachedDisplay ?? window.getComputedStyle(el, null).getPropertyValue("display"); 10604 let display = ["inline", "block", "table", "flex", "grid", "inline-flex"].filter((i) => directive3.modifiers.includes(i))[0] || "inline-block"; 10605 display = directive3.modifiers.includes("remove") && !isTruthy ? cache : display; 10606 el.style.display = isTruthy ? display : "none"; 10607 } 10608 } 10609 10610
10610// js/directives/wire-offline.js 10611 var offlineHandlers = /* @__PURE__ */ new Set(); 10612 var onlineHandlers = /* @__PURE__ */ new Set(); 10613 window.addEventListener("offline", () => offlineHandlers.forEach((i) => i())); 10614 window.addEventListener("online", () => onlineHandlers.forEach((i) => i())); 10615 directive2("offline", ({ el, directive: directive3, cleanup: cleanup2 }) => { 10616 let setOffline = () => toggleBooleanStateDirective(el, directive3, true); 10617 let setOnline = () => toggleBooleanStateDirective(el, directive3, false); 10618 offlineHandlers.add(setOffline); 10619 onlineHandlers.add(setOnline); 10620 cleanup2(() => { 10621 offlineHandlers.delete(setOffline); 10622 onlineHandlers.delete(setOnline); 10623 }); 10624 }); 10625 10626
10626// js/directives/wire-loading.js 10627 directive2("loading", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 10628 let { targets, inverted } = getTargets(el); 10629 let [delay3, abortDelay] = applyDelay(directive3); 10630 let cleanupA = whenTargetsArePartOfRequest(component, targets, inverted, [ 10631 () => delay3(() => toggleBooleanStateDirective(el, directive3, true)), 10632 () => abortDelay(() => toggleBooleanStateDirective(el, directive3, false)) 10633 ]); 10634 let cleanupB = whenTargetsArePartOfFileUpload(component, targets, [ 10635 () => delay3(() => toggleBooleanStateDirective(el, directive3, true)), 10636 () => abortDelay(() => toggleBooleanStateDirective(el, directive3, false)) 10637 ]); 10638 cleanup2(() => { 10639 cleanupA(); 10640 cleanupB(); 10641 }); 10642 }); 10643 function applyDelay(directive3) { 10644 if (!directive3.modifiers.includes("delay") || directive3.modifiers.includes("none")) 10645 return [(i) => i(), (i) => i()]; 10646 let duration = 200; 10647 let delayModifiers = { 10648 "shortest": 50, 10649 "shorter": 100, 10650 "short": 150, 10651 "default": 200, 10652 "long": 300, 10653 "longer": 500, 10654 "longest": 1e3 10655 }; 10656 Object.keys(delayModifiers).some((key) => { 10657 if (directive3.modifiers.includes(key)) { 10658 duration = delayModifiers[key]; 10659 return true; 10660 } 10661 }); 10662 let timeout; 10663 let started2 = false; 10664 return [ 10665 (callback) => { 10666 timeout = setTimeout(() => { 10667 callback(); 10668 started2 = true; 10669 }, duration); 10670 }, 10671 async (callback) => { 10672 if (started2) { 10673 await callback(); 10674 started2 = false; 10675 } else { 10676 clearTimeout(timeout); 10677 } 10678 } 10679 ]; 10680 } 10681 function whenTargetsArePartOfRequest(component, targets, inverted, [startLoading, endLoading]) { 10682 return on2("commit", ({ component: iComponent, commit: payload, respond }) => { 10683 if (iComponent !== component) 10684 return; 10685 if (targets.length > 0 && containsTargets(payload, targets) === inverted) 10686 return; 10687 startLoading(); 10688 respond(() => { 10689 endLoading(); 10690 }); 10691 }); 10692 } 10693 function whenTargetsArePartOfFileUpload(component, targets, [startLoading, endLoading]) { 10694 let eventMismatch = (e) => { 10695 let { id, property } = e.detail; 10696 if (id !== component.id) 10697 return true; 10698 if (targets.length > 0 && !targets.map((i) => i.target).includes(property)) 10699 return true; 10700 return false; 10701 }; 10702 let cleanupA = listen(window, "livewire-upload-start", (e) => { 10703 if (eventMismatch(e)) 10704 return; 10705 startLoading(); 10706 }); 10707 let cleanupB = listen(window, "livewire-upload-finish", (e) => { 10708 if (eventMismatch(e)) 10709 return; 10710 endLoading(); 10711 }); 10712 let cleanupC = listen(window, "livewire-upload-error", (e) => { 10713 if (eventMismatch(e)) 10714 return; 10715 endLoading(); 10716 }); 10717 return () => { 10718 cleanupA(); 10719 cleanupB(); 10720 cleanupC(); 10721 }; 10722 } 10723 function containsTargets(payload, targets) { 10724 let { updates, calls } = payload; 10725 return targets.some(({ target, params }) => { 10726 if (params) { 10727 return calls.some(({ method, params: methodParams }) => { 10728 return target === method && params === quickHash(JSON.stringify(methodParams)); 10729 }); 10730 } 10731 let hasMatchingUpdate = Object.keys(updates).some((property) => { 10732 if (property.includes(".")) { 10733 let propertyRoot = property.split(".")[0]; 10734 if (propertyRoot === target) 10735 return true; 10736 } 10737 return property === target; 10738 }); 10739 if (hasMatchingUpdate) 10740 return true; 10741 if (calls.map((i) => i.method).includes(target)) 10742 return true; 10743 }); 10744 } 10745 function getTargets(el) { 10746 let directives2 = getDirectives(el); 10747 let targets = []; 10748 let inverted = false; 10749 if (directives2.has("target")) { 10750 let directive3 = directives2.get("target"); 10751 if (directive3.modifiers.includes("except")) 10752 inverted = true; 10753 directive3.methods.forEach(({ method, params }) => { 10754 targets.push({ 10755 target: method, 10756 params: params && params.length > 0 ? quickHash(JSON.stringify(params)) : void 0 10757 }); 10758 }); 10759 } else { 10760 let nonActionOrModelLivewireDirectives = ["init", "dirty", "offline", "target", "loading", "poll", "ignore", "key", "id"]; 10761 directives2.all().filter((i) => !nonActionOrModelLivewireDirectives.includes(i.value)).map((i) =>
10761 i.expression.split("(")[0]).forEach((target) => targets.push({ target })); 10762 } 10763 return { targets, inverted }; 10764 } 10765 function quickHash(subject) { 10766 return btoa(encodeURIComponent(subject)); 10767 } 10768 10769
10769// js/directives/wire-stream.js 10770 directive2("stream", ({ el, directive: directive3, cleanup: cleanup2 }) => { 10771 let { expression, modifiers } = directive3; 10772 let off = on2("stream", ({ name, content, replace: replace2 }) => { 10773 if (name !== expression) 10774 return; 10775 if (modifiers.includes("replace") || replace2) { 10776 el.innerHTML = content; 10777 } else { 10778 el.insertAdjacentHTML("beforeend", content); 10779 } 10780 }); 10781 cleanup2(off); 10782 }); 10783 on2("request", ({ respond }) => { 10784 respond((mutableObject) => { 10785 let response = mutableObject.response; 10786 if (!response.headers.has("X-Livewire-Stream")) 10787 return; 10788 mutableObject.response = { 10789 ok: true, 10790 redirected: false, 10791 status: 200, 10792 async text() { 10793 let finalResponse = await interceptStreamAndReturnFinalResponse(response, (streamed) => { 10794 trigger2("stream", streamed); 10795 }); 10796 if (contentIsFromDump(finalResponse)) { 10797 this.ok = false; 10798 } 10799 return finalResponse; 10800 } 10801 }; 10802 }); 10803 }); 10804 async function interceptStreamAndReturnFinalResponse(response, callback) { 10805 let reader = response.body.getReader(); 10806 let remainingResponse = ""; 10807 while (true) { 10808 let { done, value: chunk } = await reader.read(); 10809 let decoder = new TextDecoder(); 10810 let output = decoder.decode(chunk); 10811 let [streams, remaining] = extractStreamObjects(remainingResponse + output); 10812 streams.forEach((stream) => { 10813 callback(stream); 10814 }); 10815 remainingResponse = remaining; 10816 if (done) 10817 return remainingResponse; 10818 } 10819 } 10820 function extractStreamObjects(raw2) { 10821 let regex = /({"stream":true.*?"endStream":true})/g; 10822 let matches2 = raw2.match(regex); 10823 let parsed = []; 10824 if (matches2) { 10825 for (let i = 0; i < matches2.length; i++) { 10826 parsed.push(JSON.parse(matches2[i]).body); 10827 } 10828 } 10829 let remaining = raw2.replace(regex, ""); 10830 return [parsed, remaining]; 10831 } 10832 10833
10833// js/directives/wire-replace.js 10834 directive2("replace", ({ el, directive: directive3 }) => { 10835 if (directive3.modifiers.includes("self")) { 10836 el.__livewire_replace_self = true; 10837 } else { 10838 el.__livewire_replace = true; 10839 } 10840 }); 10841 10842
10842// js/directives/wire-ignore.js 10843 directive2("ignore", ({ el, directive: directive3 }) => { 10844 if (directive3.modifiers.includes("self")) { 10845 el.__livewire_ignore_self = true; 10846 } else if (directive3.modifiers.includes("children")) { 10847 el.__livewire_ignore_children = true; 10848 } else { 10849 el.__livewire_ignore = true; 10850 } 10851 }); 10852 10853
10853// js/directives/wire-cloak.js 10854 module_default.interceptInit((el) => { 10855 if (el.hasAttribute("wire:cloak")) { 10856 module_default.mutateDom(() => el.removeAttribute("wire:cloak")); 10857 } 10858 }); 10859 10860
10860// js/directives/wire-dirty.js 10861 var refreshDirtyStatesByComponent = new WeakBag(); 10862 on2("commit", ({ component, respond }) => { 10863 respond(() => { 10864 setTimeout(() => { 10865 refreshDirtyStatesByComponent.each(component, (i) => i(false)); 10866 }); 10867 }); 10868 }); 10869 directive2("dirty", ({ el, directive: directive3, component }) => { 10870 let targets = dirtyTargets(el); 10871 let oldIsDirty = false; 10872 let initialDisplay = el.style.display; 10873 let refreshDirtyState = (isDirty) => { 10874 toggleBooleanStateDirective(el, directive3, isDirty, initialDisplay); 10875 oldIsDirty = isDirty; 10876 }; 10877 refreshDirtyStatesByComponent.add(component, refreshDirtyState); 10878 Alpine.effect(() => { 10879 let isDirty = false; 10880 if (targets.length === 0) { 10881 isDirty = JSON.stringify(component.canonical) !== JSON.stringify(component.reactive); 10882 } else { 10883 for (let i = 0; i < targets.length; i++) { 10884 if (isDirty) 10885 break; 10886 let target = targets[i]; 10887 isDirty = JSON.stringify(dataGet(component.canonical, target)) !== JSON.stringify(dataGet(component.reactive, target)); 10888 } 10889 } 10890 if (oldIsDirty !== isDirty) { 10891 refreshDirtyState(isDirty); 10892 } 10893 oldIsDirty = isDirty; 10894 }); 10895 }); 10896 function dirtyTargets(el) { 10897 let directives2 = getDirectives(el); 10898 let targets = []; 10899 if (directives2.has("model")) { 10900 targets.push(directives2.get("model").expression); 10901 } 10902 if (directives2.has("target")) { 10903 targets = targets.concat(directives2.get("target").expression.split(",").map((s) => s.trim())); 10904 } 10905 return targets; 10906 } 10907 10908
10908// js/directives/wire-model.js 10909 directive2("model", ({ el, directive: directive3, component, cleanup: cleanup2 }) => { 10910 let { expression, modifiers } = directive3; 10911 if (!expression) { 10912 return console.warn("Livewire: [wire:model] is missing a value.", el); 10913 } 10914 if (componentIsMissingProperty(component, expression)) { 10915 return console.warn('Livewire: [wire:model="' + expression + '"] property does not exist on component: [' + component.name + "]", el); 10916 } 10917 if (el.type && el.type.toLowerCase() === "file") { 10918 return handleFileUpload(el, expression, component, cleanup2); 10919 } 10920 let isLive = modifiers.includes("live"); 10921 let isLazy = modifiers.includes("lazy") || modifiers.includes("change"); 10922 let onBlur = modifiers.includes("blur"); 10923 let isDebounced = modifiers.includes("debounce"); 10924 let update = expression.startsWith("$parent") ? () => component.$wire.$parent.$commit() : () => component.$wire.$commit(); 10925 let debouncedUpdate = isRealtimeInput(el) && !isDebounced && isLive ? debounce2(update, 150) : update; 10926 module_default.bind(el, { 10927 ["@change"]() { 10928 isLazy && update(); 10929 }, 10930 ["@blur"]() { 10931 onBlur && update(); 10932 }, 10933 ["x-model" + getModifierTail(modifiers)]() { 10934 return { 10935 get() { 10936 return dataGet(component.$wire, expression); 10937 }, 10938 set(value) { 10939 dataSet(component.$wire, expression, value); 10940 isLive && !isLazy && !onBlur && debouncedUpdate(); 10941 } 10942 }; 10943 } 10944 }); 10945 }); 10946 function getModifierTail(modifiers) { 10947 modifiers = modifiers.filter((i) => ![ 10948 "lazy", 10949 "defer" 10950 ].includes(i)); 10951 if (modifiers.length === 0) 10952 return ""; 10953 return "." + modifiers.join("."); 10954 } 10955 function isRealtimeInput(el) { 10956 return ["INPUT", "TEXTAREA"].includes(el.tagName.toUpperCase()) && !["checkbox", "radio"].includes(el.type) || el.tagName.toUpperCase() === "UI-SLIDER"; 10957 } 10958 function componentIsMissingProperty(component, property) { 10959 if (property.startsWith("$parent")) { 10960 let parent = closestComponent(component.el.parentElement, false); 10961 if (!parent) 10962 return true; 10963 return componentIsMissingProperty(parent, property.split("$parent.")[1]); 10964 } 10965 let baseProperty = property.split(".")[0]; 10966 return !Object.keys(component.canonical).includes(baseProperty); 10967 } 10968 function debounce2(func, wait) { 10969 var timeout; 10970 return function() { 10971 var context = this, args = arguments; 10972 var later = function() { 10973 timeout = null; 10974 func.apply(context, args); 10975 }; 10976 clearTimeout(timeout); 10977 timeout = setTimeout(later, wait); 10978 }; 10979 } 10980 10981
10981// js/directives/wire-init.js 10982 directive2("init", ({ el, directive: directive3 }) => { 10983 let fullMethod = directive3.expression ?? "$refresh"; 10984 module_default.evaluate(el, `$wire.${fullMethod}`); 10985 }); 10986 10987
10987// js/directives/wire-poll.js 10988 directive2("poll", ({ el, directive: directive3 }) => { 10989 let interval = extractDurationFrom(directive3.modifiers, 2e3); 10990 let { start: start3, pauseWhile, throttleWhile, stopWhen } = poll(() => { 10991 triggerComponentRequest(el, directive3); 10992 }, interval); 10993 start3(); 10994 throttleWhile(() => theTabIsInTheBackground() && theDirectiveIsMissingKeepAlive(directive3)); 10995 pauseWhile(() => theDirectiveHasVisible(directive3) && theElementIsNotInTheViewport(el)); 10996 pauseWhile(() => theDirectiveIsOffTheElement(el)); 10997 pauseWhile(() => livewireIsOffline()); 10998 stopWhen(() => theElementIsDisconnected(el)); 10999 }); 11000 function triggerComponentRequest(el, directive3) { 11001 module_default.evaluate(el, directive3.expression ? "$wire." + directive3.expression : "$wire.$commit()"); 11002 } 11003 function poll(callback, interval = 2e3) { 11004 let pauseConditions = []; 11005 let throttleConditions = []; 11006 let stopConditions = []; 11007 return { 11008 start() { 11009 let clear2 = syncronizedInterval(interval, () => { 11010 if (stopConditions.some((i) => i())) 11011 return clear2(); 11012 if (pauseConditions.some((i) => i())) 11013 return; 11014 if (throttleConditions.some((i) => i()) && Math.random() < 0.95) 11015 return; 11016 callback(); 11017 }); 11018 }, 11019 pauseWhile(condition) { 11020 pauseConditions.push(condition); 11021 }, 11022 throttleWhile(condition) { 11023 throttleConditions.push(condition); 11024 }, 11025 stopWhen(condition) { 11026 stopConditions.push(condition); 11027 } 11028 }; 11029 } 11030 var clocks = []; 11031 function syncronizedInterval(ms, callback) { 11032 if (!clocks[ms]) { 11033 let clock = { 11034 timer: setInterval(() => clock.callbacks.forEach((i) => i()), ms), 11035 callbacks: /* @__PURE__ */ new Set() 11036 }; 11037 clocks[ms] = clock; 11038 } 11039 clocks[ms].callbacks.add(callback); 11040 return () => { 11041 clocks[ms].callbacks.delete(callback); 11042 if (clocks[ms].callbacks.size === 0) { 11043 clearInterval(clocks[ms].timer); 11044 delete clocks[ms]; 11045 } 11046 }; 11047 } 11048 var isOffline = false; 11049 window.addEventListener("offline", () => isOffline = true); 11050 window.addEventListener("online", () => isOffline = false); 11051 function livewireIsOffline() { 11052 return isOffline; 11053 } 11054 var inBackground = false; 11055 document.addEventListener("visibilitychange", () => { 11056 inBackground = document.hidden; 11057 }, false); 11058 function theTabIsInTheBackground() { 11059 return inBackground; 11060 } 11061 function theDirectiveIsOffTheElement(el) { 11062 return !getDirectives(el).has("poll"); 11063 } 11064 function theDirectiveIsMissingKeepAlive(directive3) { 11065 return !directive3.modifiers.includes("keep-alive"); 11066 } 11067 function theDirectiveHasVisible(directive3) { 11068 return directive3.modifiers.includes("visible"); 11069 } 11070 function theElementIsNotInTheViewport(el) { 11071 let bounding = el.getBoundingClientRect(); 11072 return !(bounding.top < (window.innerHeight || document.documentElement.clientHeight) && bounding.left < (window.innerWidth || document.documentElement.clientWidth) && bounding.bottom > 0 && bounding.right > 0); 11073 } 11074 function theElementIsDisconnected(el) { 11075 return el.isConnected === false; 11076 } 11077 function extractDurationFrom(modifiers, defaultDuration) { 11078 let durationInMilliSeconds; 11079 let durationInMilliSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)ms/)); 11080 let durationInSecondsString = modifiers.find((mod) => mod.match(/([0-9]+)s/)); 11081 if (durationInMilliSecondsString) { 11082 durationInMilliSeconds = Number(durationInMilliSecondsString.replace("ms", "")); 11083 } else if (durationInSecondsString) { 11084 durationInMilliSeconds = Number(durationInSecondsString.replace("s", "")) * 1e3; 11085 } 11086 return durationInMilliSeconds || defaultDuration; 11087 } 11088 11089
11089// js/directives/wire-show.js 11090 module_default.interceptInit((el) => { 11091 for (let i = 0; i < el.attributes.length; i++) { 11092 if (el.attributes[i].name.startsWith("wire:show")) { 11093 let { name, value } = el.attributes[i]; 11094 let modifierString = name.split("wire:show")[1]; 11095 let expression = value.startsWith("!") ? "!$wire." + value.slice(1).trim() : "$wire." + value.trim(); 11096 module_default.bind(el, { 11097 ["x-show" + modifierString]() { 11098 return module_default.evaluate(el, expression); 11099 } 11100 }); 11101 } 11102 } 11103 }); 11104 11105
11105// js/directives/wire-text.js 11106 module_default.interceptInit((el) => { 11107 for (let i = 0; i < el.attributes.length; i++) { 11108 if (el.attributes[i].name.startsWith("wire:text")) { 11109 let { name, value } = el.attributes[i]; 11110 let modifierString = name.split("wire:text")[1]; 11111 let expression = value.startsWith("!") ? "!$wire." + value.slice(1).trim() : "$wire." + value.trim(); 11112 module_default.bind(el, { 11113 ["x-text" + modifierString]() { 11114 return module_default.evaluate(el, expression); 11115 } 11116 }); 11117 } 11118 } 11119 }); 11120 11121
11121// js/index.js 11122 var Livewire2 = { 11123 directive: directive2, 11124 dispatchTo, 11125 start: start2, 11126 first, 11127 find, 11128 getByName, 11129 all, 11130 hook: on2, 11131 trigger: trigger2, 11132 triggerAsync, 11133 dispatch: dispatchGlobal, 11134 on: on3, 11135 get navigate() { 11136 return module_default.navigate; 11137 } 11138 }; 11139 var warnAboutMultipleInstancesOf = (entity) => console.warn(`Detected multiple instances of ${entity} running`); 11140 if (window.Livewire) 11141 warnAboutMultipleInstancesOf("Livewire"); 11142 if (window.Alpine) 11143 warnAboutMultipleInstancesOf("Alpine"); 11144 window.Livewire = Livewire2; 11145 window.Alpine = module_default; 11146 if (window.livewireScriptConfig === void 0) { 11147 window.Alpine.__fromLivewire = true; 11148 document.addEventListener("DOMContentLoaded", () => { 11149 if (window.Alpine.__fromLivewire === void 0) { 11150 warnAboutMultipleInstancesOf("Alpine"); 11151 } 11152 Livewire2.start(); 11153 }); 11154 } 11155})(); 11156/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress 11157 * @license MIT */ 11158/*! Bundled license information: 11159 11160tabbable/dist/index.esm.js: 11161 (*! 11162 * tabbable 6.4.0 11163 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE 11164 *) 11165 11166focus-trap/dist/focus-trap.esm.js: 11167 (*! 11168 * focus-trap 8.0.0 11169 * @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE 11170 *) 11171 (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *) 11172*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.