import{a as e,t}from"./rolldown-runtime-CNC7AqOf.js";var n=typeof globalThis==`object`&&globalThis||typeof window==`object`&&window||typeof self==`object`&&self||typeof global==`object`&&global||(function(){return this})();function r(e,t,{signal:n,edges:r}={}){let i,a=null,o=r!=null&&r.includes(`leading`),s=r==null||r.includes(`trailing`),c=()=>{a!==null&&(e.apply(i,a),i=void 0,a=null)},l=()=>{s&&c(),p()},u=null,d=()=>{u!=null&&clearTimeout(u),u=setTimeout(()=>{u=null,l()},t)},f=()=>{u!==null&&(clearTimeout(u),u=null)},p=()=>{f(),i=void 0,a=null},m=()=>{c()},h=function(...e){if(n?.aborted)return;i=this,a=e;let t=u==null;d(),o&&t&&c()};return h.schedule=d,h.cancel=p,h.flush=m,n?.addEventListener(`abort`,p,{once:!0}),h}function i(){}function a(e){return e==null||typeof e!=`object`&&typeof e!=`function`}function o(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function s(e){if(a(e))return e;if(Array.isArray(e)||o(e)||e instanceof ArrayBuffer||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e);if(t==null)return Object.assign(Object.create(t),e);let n=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new n(e);if(e instanceof RegExp){let t=new n(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new n(e.buffer.slice(0));if(e instanceof Error){let t;return t=e instanceof AggregateError?new n(e.errors,e.message,{cause:e.cause}):new n(e.message,{cause:e.cause}),t.stack=e.stack,Object.assign(t,e),t}return typeof File<`u`&&e instanceof File?new n([e],e.name,{type:e.type,lastModified:e.lastModified}):typeof e==`object`?Object.assign(Object.create(t),e):e}function c(e){return n.Buffer!==void 0&&n.Buffer.isBuffer(e)}function l(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function u(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var d=`[object RegExp]`,f=`[object String]`,p=`[object Number]`,m=`[object Boolean]`,h=`[object Arguments]`,g=`[object Symbol]`,_=`[object Date]`,v=`[object Map]`,y=`[object Set]`,b=`[object Array]`,x=`[object Function]`,S=`[object ArrayBuffer]`,C=`[object Object]`,w=`[object Error]`,T=`[object DataView]`,E=`[object Uint8Array]`,ee=`[object Uint8ClampedArray]`,te=`[object Uint16Array]`,ne=`[object Uint32Array]`,re=`[object BigUint64Array]`,ie=`[object Int8Array]`,D=`[object Int16Array]`,O=`[object Int32Array]`,k=`[object BigInt64Array]`,ae=`[object Float32Array]`,oe=`[object Float64Array]`;function se(e,t){return A(e,void 0,e,new Map,t)}function A(e,t,n,r=new Map,i=void 0){let s=i?.(e,t,n,r);if(s!==void 0)return s;if(a(e))return e;if(r.has(e))return r.get(e);if(Array.isArray(e)){let t=Array(e.length);r.set(e,t);for(let a=0;ape(s,i,void 0,e,t,n,r));if(c===-1)return!1;a.splice(c,1)}return!0}case b:case E:case ee:case te:case ne:case re:case ie:case D:case O:case k:case ae:case oe:if(c(e)!==c(t)||e.length!==t.length)return!1;for(let i=0;i=0}var _e={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`};function ve(e){return e.replace(/[&<>"']/g,e=>_e[e])}function ye(e){return e!=null&&typeof e!=`function`&&ge(e.length)}function be(e){if(e==null)return``;if(typeof e==`string`)return e;if(Array.isArray(e))return e.map(be).join(`,`);let t=String(e);return t===`0`&&Object.is(Number(e),-0)?`-0`:t}function xe(e){return typeof e==`string`||typeof e==`symbol`?e:Object.is(e?.valueOf?.(),-0)?`-0`:String(e)}function Se(e){if(Array.isArray(e))return e.map(xe);if(typeof e==`symbol`)return[e];e=be(e);let t=[],n=e.length;if(n===0)return t;let r=0,i=``,a=``,o=!1;for(e.charCodeAt(0)===46&&t.push(``);r{let o=t?.(n,r,i,a);if(o!==void 0)return o;if(typeof e==`object`){if(u(e)===`[object Object]`&&typeof e.constructor!=`function`){let t={};return a.set(e,t),j(t,e,i,a),t}switch(Object.prototype.toString.call(e)){case p:case f:case m:{let t=new e.constructor(e?.valueOf());return j(t,e),t}case h:{let t={};return j(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}}})}function Oe(e){return De(e)}function ke(e){return typeof e==`object`&&!!e&&u(e)===`[object Arguments]`}var Ae=/^(?:0|[1-9]\d*)$/;function je(e,t=2**53-1){switch(typeof e){case`number`:return Number.isInteger(e)&&e>=0&&e{let r=e[t];(!(Object.hasOwn(e,t)&&de(r,n))||n===void 0&&!(t in e))&&(e[t]=n)};function Ve(e,t,n,r){if(e==null&&!Ee(e))return e;let i;i=Re(t,e)?[t]:Array.isArray(t)?t:Se(t);let a=n(P(e,i)),o=e;for(let t=0;tn,()=>void 0)}function Ue(e,t=0,n={}){typeof n!=`object`&&(n={});let{leading:i=!1,trailing:a=!0,maxWait:o}=n,s=[,,];i&&(s[0]=`leading`),a&&(s[1]=`trailing`);let c,l=null,u=r(function(...t){c=e.apply(this,t),l=null},t,{edges:s}),d=function(...t){return o!=null&&(l===null&&(l=Date.now()),Date.now()-l>=o)?(c=e.apply(this,t),l=Date.now(),u.cancel(),u.schedule(),c):(u.apply(this,t),c)};return d.cancel=u.cancel,d.flush=()=>(u.flush(),c),d}function We(e,...t){let n=t.slice(0,-1),r=t[t.length-1],i=e;for(let e=0;etypeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0,Ye=e=>e instanceof FormData||Je(e)||typeof e==`object`&&!!e&&Object.values(e).some(e=>Ye(e)),Xe=class extends Error{response;constructor(e){super(`HTTP error ${e.status}`),this.name=`HttpResponseError`,this.response=e}},Ze=class extends Error{constructor(e=`Request was cancelled`){super(e),this.name=`HttpCancelledError`}},Qe=class extends Error{constructor(e=`Network error`){super(e),this.name=`HttpNetworkError`}};function $e(e){let t=new URLSearchParams;return Object.entries(e).forEach(([e,n])=>{n!=null&&(Array.isArray(n)?n.forEach(n=>t.append(`${e}[]`,String(n))):typeof n==`object`?t.append(e,JSON.stringify(n)):t.append(e,String(n)))}),t.toString()}function et(e,t,n){if(t&&!e.startsWith(`http://`)&&!e.startsWith(`https://`)&&(e=t.replace(/\/$/,``)+`/`+e.replace(/^\//,``)),n&&Object.keys(n).length>0){let t=$e(n);t&&(e+=(e.includes(`?`)?`&`:`?`)+t)}return e}function tt(){return typeof window>`u`?null:window.axios?.defaults?.headers?.common?.[`X-Requested-With`]??null}function nt(e,t=new FormData,n=null){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&rt(t,n?`${n}[${r}]`:r,e[r]);return t}function rt(e,t,n){if(Array.isArray(n))return n.forEach((n,r)=>rt(e,`${t}[${r}]`,n));if(n instanceof Date)return e.append(t,n.toISOString());if(typeof File<`u`&&n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(n==null)return e.append(t,``);nt(n,e,t)}function it(e,t){if(e!=null)return e instanceof FormData?e:typeof e==`object`&&Ye(e)?nt(e):typeof e==`object`||t[`Content-Type`]?.includes(`application/json`)?JSON.stringify(e):String(e)}function at(e){let t={};return e.forEach((e,n)=>{t[n.toLowerCase()]=e}),t}function ot(e={}){let t=e.xsrfCookieName??`XSRF-TOKEN`,n=e.xsrfHeaderName??`X-XSRF-TOKEN`;function r(){if(typeof document>`u`)return null;let e=document.cookie.match(RegExp(`(^|;\\s*)`+t+`=([^;]*)`));return e?decodeURIComponent(e[2]):null}return{setXsrfCookieName(e){t=e},setXsrfHeaderName(e){n=e},async request(e){let t=et(e.url,e.baseURL,e.params),i=e.method.toUpperCase(),a={},o=tt();o&&(a[`X-Requested-With`]=o),e.data!==void 0&&![`GET`,`DELETE`].includes(i)&&!(e.data instanceof FormData)&&!Ye(e.data)&&(a[`Content-Type`]=`application/json`),e.headers&&Object.entries(e.headers).forEach(([e,t])=>{t!==void 0&&(a[e]=String(t))});let s=r();s&&![`GET`,`HEAD`,`OPTIONS`].includes(i)&&(a[n]=s);let c=e.signal,l,u=e.timeout??3e4;if(u>0&&!c){let e=new AbortController;c=e.signal,l=setTimeout(()=>e.abort(),u)}let d=[`GET`,`DELETE`].includes(i)?void 0:it(e.data,a);d instanceof FormData&&delete a[`Content-Type`];try{let n=await fetch(t,{method:i,headers:a,body:d,signal:c,credentials:e.credentials??`same-origin`});l&&clearTimeout(l);let r;r=n.headers.get(`content-type`)?.includes(`application/json`)?await n.json():await n.text();let o={status:n.status,data:r,headers:at(n.headers)};if(!n.ok)throw new Xe(o);return o}catch(e){throw l&&clearTimeout(l),e instanceof Xe?e:e instanceof DOMException&&e.name===`AbortError`?new Ze:e instanceof TypeError?new Qe(e.message):e}}}}var st=ot(),ct=st,lt=void 0,ut=void 0,dt=`same-origin`,ft=e=>`${e.method}:${e.baseURL??lt??``}${e.url}`,pt=e=>e.status===204&&e.headers[`precognition-success`]===`true`,mt={},ht={get:(e,t={},n={})=>_t(gt(`get`,e,t,n)),post:(e,t={},n={})=>_t(gt(`post`,e,t,n)),patch:(e,t={},n={})=>_t(gt(`patch`,e,t,n)),put:(e,t={},n={})=>_t(gt(`put`,e,t,n)),delete:(e,t={},n={})=>_t(gt(`delete`,e,t,n)),useHttpClient(e){return ct=e,ht},withBaseURL(e){return lt=e,ht},withTimeout(e){return ut=e,ht},withCredentials(e){return dt=typeof e==`string`?e:e?`include`:`omit`,ht},fingerprintRequestsUsing(e){return ft=e===null?()=>null:e,ht},determineSuccessUsing(e){return pt=e,ht},withXsrfCookieName(e){return st.setXsrfCookieName(e),ht},withXsrfHeaderName(e){return st.setXsrfHeaderName(e),ht}},gt=(e,t,n,r)=>({url:t,method:e,...r,...[`get`,`delete`].includes(e)?{params:Ke({},n,r?.params)}:{data:Ke({},n,r?.data)}}),_t=(e={})=>{let t=[vt,bt,xt].reduce((e,t)=>t(e),e);return(t.onBefore??(()=>!0))()===!1?Promise.resolve(null):((t.onStart??(()=>null))(),ct.request({method:t.method,url:t.url,baseURL:t.baseURL??lt,data:t.data,params:t.params,headers:t.headers,signal:t.signal,timeout:t.timeout,credentials:dt}).then(async e=>{t.precognitive&&St(e);let n=e.status,r=e;return t.precognitive&&t.onPrecognitionSuccess&&pt(e)&&(r=await Promise.resolve(t.onPrecognitionSuccess(e)??r)),t.onSuccess&&yt(n)&&(r=await Promise.resolve(t.onSuccess(r)??r)),(wt(t,n)??(e=>e))(r)??r},e=>{if(Ct(e))return Promise.reject(e);let n=e;return t.precognitive&&St(n.response),(wt(t,n.response.status)??((e,t)=>Promise.reject(t)))(n.response,n)}).finally(t.onFinish??(()=>null)))},vt=e=>{let t=e.only??e.validate;return{...e,timeout:e.timeout??ut,precognitive:e.precognitive!==!1,fingerprint:e.fingerprint===void 0?ft(e,ct):e.fingerprint,headers:{...e.headers,Accept:`application/json`,"Content-Type":Tt(e),...e.precognitive===!1?{}:{Precognition:!0},...t?{"Precognition-Validate-Only":Array.from(t).join()}:{}}}},yt=e=>e>=200&&e<300,bt=e=>typeof e.fingerprint==`string`?(mt[e.fingerprint]?.abort(),delete mt[e.fingerprint],e):e,xt=e=>typeof e.fingerprint!=`string`||e.signal||!e.precognitive?e:(mt[e.fingerprint]=new AbortController,{...e,signal:mt[e.fingerprint].signal}),St=e=>{if(e.headers?.precognition!==`true`)throw Error(`Did not receive a Precognition response. Ensure you have the Precognition middleware in place for the route.`)},Ct=e=>!(e instanceof Xe)||typeof e.response?.status!=`number`,wt=(e,t)=>({401:e.onUnauthorized,403:e.onForbidden,404:e.onNotFound,409:e.onConflict,422:e.onValidationError,423:e.onLocked})[t],Tt=e=>e.headers?.[`Content-Type`]??e.headers?.[`Content-type`]??e.headers?.[`content-type`]??(Ye(e.data)?`multipart/form-data`:`application/json`),Et=(e,t)=>{if(!e.includes(`*`))return[e];let n=e.split(`.`),r=[``];for(let e of n)if(e===`*`){let e=[];for(let n of r){let r=n?P(t,n):t;if(Array.isArray(r))for(let t=0;tt?`${t}.${e}`:e);return r},Dt=(e,t)=>t.includes(`*`)?RegExp(`^`+t.replace(/\./g,`\\.`).replace(/\*/g,`[^.]+`)+`$`).test(e):e===t,Ot=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.some(t=>Dt(e,t)))),kt=(e,t={})=>{let n={errorsChanged:[],touchedChanged:[],validatingChanged:[],validatedChanged:[]},r=!1,i=!1,a=e=>e===i?[]:(i=e,n.validatingChanged),o=[],s=e=>{let t=[...new Set(e)];return o.length!==t.length||!t.every(e=>o.includes(e))?(o=t,n.validatedChanged):[]},c=()=>o.filter(e=>d[e]===void 0),l=[],u=e=>{let t=[...new Set(e)];return l.length!==t.length||!t.every(e=>l.includes(e))?(l=t,n.touchedChanged):[]},d={},f=e=>{let t=jt(e);return he(d,t)?[]:(d=t,n.errorsChanged)},p=e=>{let t={...d};return delete t[Mt(e)],f(t)},m=()=>Object.keys(d).length>0,h=1500,g=e=>{h=e,S.cancel(),S=x()},_=t,v=null,y=[],b=null,x=()=>Ue(t=>{e({get:(e,n={},r={})=>ht.get(e,T(n),C(r,t,n)),post:(e,n={},r={})=>ht.post(e,T(n),C(r,t,n)),patch:(e,n={},r={})=>ht.patch(e,T(n),C(r,t,n)),put:(e,n={},r={})=>ht.put(e,T(n),C(r,t,n)),delete:(e,n={},r={})=>ht.delete(e,T(n),C(r,t,n))}).catch(e=>e instanceof Ze||e instanceof Xe&&e.response?.status===422?null:Promise.reject(e))},h,{leading:!0,trailing:!0}),S=x(),C=(e,t,n={})=>{let r={...e,...t},i=Array.from(r.only??r.validate??l);return{...t,...Ke({},e,t),only:i,timeout:r.timeout??5e3,onValidationError:(e,t)=>([...s([...o,...i]),...f(Ke(Ot({...d},i),e.data.errors))].forEach(e=>e()),r.onValidationError?r.onValidationError(e,t):Promise.reject(t)),onSuccess:e=>(s([...o,...i]).forEach(e=>e()),r.onSuccess?r.onSuccess(e):e),onPrecognitionSuccess:e=>([...s([...o,...i]),...f(Ot({...d},i))].forEach(e=>e()),r.onPrecognitionSuccess?r.onPrecognitionSuccess(e):e),onBefore:()=>{let e=l.some(e=>e.includes(`*`)),t=e?[...new Set(l.flatMap(e=>Et(e,n)))]:l;return r.onBeforeValidation&&r.onBeforeValidation({data:n,touched:t},{data:_,touched:y})===!1||(r.onBefore||(()=>!0))()===!1?!1:(e&&u(t).forEach(e=>e()),b=l,v=n,!0)},onStart:()=>{a(!0).forEach(e=>e()),(r.onStart??(()=>null))()},onFinish:()=>{a(!1).forEach(e=>e()),y=b,_=v,b=v=null,(r.onFinish??(()=>null))()}}},w=(e,t,n)=>{if(e===void 0){let e=Array.from(n?.only??n?.validate??[]);u([...l,...e]).forEach(e=>e()),S(n??{});return}if(Je(t)&&!r){console.warn(`Precognition file validation is not active. Call the "validateFiles" function on your form to enable it.`);return}e=Mt(e),(e.includes(`*`)||P(_,e)!==t)&&(u([e,...l]).forEach(e=>e()),S(n??{}))},T=e=>r===!1?Nt(e):e,E={touched:()=>l,validate(e,t,n){return typeof e==`object`&&!(`target`in e)&&(n=e,e=t=void 0),w(e,t,n),E},touch(e){let t=Array.isArray(e)?e:[Mt(e)];return u([...l,...t]).forEach(e=>e()),E},validating:()=>i,valid:c,errors:()=>d,hasErrors:m,setErrors(e){return f(e).forEach(e=>e()),E},forgetError(e){return p(e).forEach(e=>e()),E},defaults(e){return t=e,_=e,E},reset(...e){if(e.length===0)u([]).forEach(e=>e());else{let n=[...l];e.forEach(e=>{n.includes(e)&&n.splice(n.indexOf(e),1),He(_,e,P(t,e))}),u(n).forEach(e=>e())}return E},setTimeout(e){return g(e),E},on(e,t){return n[e].push(t),E},validateFiles(){return r=!0,E},withoutFileValidation(){return r=!1,E}};return E},At=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:Array.isArray(e[n])?e[n][0]:e[n]}),{}),jt=e=>Object.keys(e).reduce((t,n)=>({...t,[n]:typeof e[n]==`string`?[e[n]]:e[n]}),{}),Mt=e=>typeof e==`string`?e:e.target.name,Nt=e=>{let t={...e};return Object.keys(t).forEach(e=>{let n=t[e];if(n!==null){if(Je(n)){delete t[e];return}if(Array.isArray(n)){t[e]=Object.values(Nt({...n}));return}if(typeof n==`object`){t[e]=Nt(t[e]);return}}}),t},Pt=new class{config={};defaults;constructor(e){this.defaults=e}extend(e){return e&&(this.defaults={...this.defaults,...e}),this}replace(e){this.config=e}get(e){return Me(this.config,e)?P(this.config,e):P(this.defaults,e)}set(e,t){typeof e==`string`?He(this.config,e,t):Object.entries(e).forEach(([e,t])=>{He(this.config,e,t)})}}({form:{recentlySuccessfulDuration:2e3,forceIndicesArrayFormatInFormData:!0,withAllErrors:!1},prefetch:{cacheFor:3e4,hoverDelay:75}});function Ft(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}function It(e,t){return document.dispatchEvent(new CustomEvent(`inertia:${e}`,t))}var Lt=e=>It(`before`,{cancelable:!0,detail:{visit:e}}),Rt=(e,{page:t,visitId:n}={})=>It(`error`,{detail:{errors:e,page:t,visitId:n}}),zt=e=>It(`networkError`,{cancelable:!0,detail:{error:e}}),Bt=e=>It(`finish`,{detail:{visit:e}}),Vt=e=>It(`httpException`,{cancelable:!0,detail:{response:e}}),Ht=e=>It(`beforeUpdate`,{detail:{page:e}}),Ut=(e,{cached:t=!1,visitId:n}={})=>It(`navigate`,{detail:{page:e,cached:t,visitId:n}}),Wt=(e,{replace:t,visitId:n})=>It(`clientVisit`,{detail:{page:e,replace:t,visitId:n}}),Gt=e=>It(`progress`,{detail:{progress:e}}),Kt=e=>It(`start`,{detail:{visit:e}}),qt=(e,{visitId:t}={})=>It(`success`,{detail:{page:e,visitId:t}}),Jt=(e,t)=>It(`prefetched`,{detail:{fetchedAt:Date.now(),response:e,visit:t}}),Yt=e=>It(`prefetching`,{detail:{visit:e}}),Xt=e=>It(`flash`,{detail:{flash:e}}),Zt=(e,t)=>It(`location`,{cancelable:!0,detail:{url:e,versionChange:t}}),Qt=class{static locationVisitKey=`inertiaLocationVisit`;static set(e,t){typeof window<`u`&&window.sessionStorage.setItem(e,JSON.stringify(t))}static get(e){if(typeof window<`u`)return JSON.parse(window.sessionStorage.getItem(e)||`null`)}static merge(e,t){let n=this.get(e);n===null?this.set(e,t):this.set(e,{...n,...t})}static remove(e){typeof window<`u`&&window.sessionStorage.removeItem(e)}static removeNested(e,t){let n=this.get(e);n!==null&&(delete n[t],this.set(e,n))}static exists(e){try{return this.get(e)!==null}catch{return!1}}static clear(){typeof window<`u`&&window.sessionStorage.clear()}},$t=async e=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);let t=an(),n=await cn(await ln());if(!n)throw Error(`Unable to encrypt history`);return await nn(t,n,e)},en={key:`historyKey`,iv:`historyIv`},tn=async e=>{let t=an(),n=await ln();if(!n)throw Error(`Unable to decrypt history`);return await rn(t,n,e)},nn=async(e,t,n)=>{if(typeof window>`u`)throw Error(`Unable to encrypt history`);if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=new TextEncoder,i=JSON.stringify(n),a=new Uint8Array(i.length*3),o=r.encodeInto(i,a);return window.crypto.subtle.encrypt({name:`AES-GCM`,iv:e},t,a.subarray(0,o.written))},rn=async(e,t,n)=>{if(window.crypto.subtle===void 0)return console.warn(`Decryption is not supported in this environment. SSL is required.`),Promise.resolve(n);let r=await window.crypto.subtle.decrypt({name:`AES-GCM`,iv:e},t,n);return JSON.parse(new TextDecoder().decode(r))},an=()=>{let e=Qt.get(en.iv);if(e)return new Uint8Array(e);let t=window.crypto.getRandomValues(new Uint8Array(12));return Qt.set(en.iv,Array.from(t)),t},on=async()=>window.crypto.subtle===void 0?(console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve(null)):window.crypto.subtle.generateKey({name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]),sn=async e=>{if(window.crypto.subtle===void 0)return console.warn(`Encryption is not supported in this environment. SSL is required.`),Promise.resolve();let t=await window.crypto.subtle.exportKey(`raw`,e);Qt.set(en.key,Array.from(new Uint8Array(t)))},cn=async e=>{if(e)return e;let t=await on();return t?(await sn(t),t):null},ln=async()=>{let e=Qt.get(en.key);return e?await window.crypto.subtle.importKey(`raw`,new Uint8Array(e),{name:`AES-GCM`,length:256},!0,[`encrypt`,`decrypt`]):null},un=e=>{let t={};for(let n of Object.keys(e))e[n]!==void 0&&(t[n]=e[n]);return t},dn=(e,t,n)=>{if(e===t)return!0;for(let r in e)if(!n.includes(r)&&e[r]!==t[r]&&!fn(e[r],t[r]))return!1;for(let r in t)if(!n.includes(r)&&!(r in e))return!1;return!0},fn=(e,t)=>{switch(typeof e){case`object`:return dn(e,t,[]);case`function`:return e.toString()===t.toString();default:return e===t}},pn={ms:1,s:1e3,m:1e3*60,h:1e3*60*60,d:1e3*60*60*24},mn=e=>{if(typeof e==`number`)return e;for(let[t,n]of Object.entries(pn))if(e.endsWith(t))return parseFloat(e)*n;return parseInt(e)},hn=new class{cached=[];inFlightRequests=[];removalTimers=[];currentUseId=null;add(e,t,{cacheFor:n,cacheTags:r}){if(this.findInFlight(e))return Promise.resolve();let i=this.findCached(e);if(!e.fresh&&i&&i.staleTimestamp>Date.now())return Promise.resolve();let[a,o]=this.extractStaleValues(n),s=new Promise((n,r)=>{t({...e,onCancel:()=>{this.remove(e),e.onCancel(),r()},onError:t=>{this.remove(e),e.onError(t),r()},onPrefetching(t){e.onPrefetching(t)},onPrefetched(t,n){e.onPrefetched(t,n)},onPrefetchResponse(e){n(e)},onPrefetchError(t){hn.removeFromInFlight(e),r(t)}})}).then(t=>{this.remove(e);let n=t.getPageResponse();F.mergeOncePropsIntoResponse(n),this.cached.push({params:{...e},staleTimestamp:Date.now()+a,expiresAt:Date.now()+o,response:s,singleUse:o===0,timestamp:Date.now(),inFlight:!1,tags:Array.isArray(r)?r:[r]});let i=this.getShortestOncePropTtl(n);return this.scheduleForRemoval(e,i?Math.min(o,i):o),this.removeFromInFlight(e),t.handlePrefetch(),t});return this.inFlightRequests.push({params:{...e},response:s,staleTimestamp:null,inFlight:!0}),s}removeAll(){this.cached=[],this.removalTimers.forEach(e=>{clearTimeout(e.timer)}),this.removalTimers=[]}removeByTags(e){this.cached=this.cached.filter(t=>!t.tags.some(t=>e.includes(t)))}remove(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)),this.clearTimer(e)}removeFromInFlight(e){this.inFlightRequests=this.inFlightRequests.filter(t=>!this.paramsAreEqual(t.params,e))}extractStaleValues(e){let[t,n]=this.cacheForToStaleAndExpires(e);return[mn(t),mn(n)]}cacheForToStaleAndExpires(e){if(!Array.isArray(e))return[e,e];switch(e.length){case 0:return[0,0];case 1:return[e[0],e[0]];default:return[e[0],e[1]]}}clearTimer(e){let t=this.removalTimers.find(t=>this.paramsAreEqual(t.params,e));t&&(clearTimeout(t.timer),this.removalTimers=this.removalTimers.filter(e=>e!==t))}scheduleForRemoval(e,t){if(!(typeof window>`u`)&&(this.clearTimer(e),t>0)){let n=window.setTimeout(()=>this.remove(e),t);this.removalTimers.push({params:e,timer:n})}}get(e){return this.findCached(e)||this.findInFlight(e)}use(e,t){let n=`${t.url.pathname}-${Date.now()}-${Math.random().toString(36).substring(7)}`;this.currentUseId=n;let r={...t,cached:!0};return e.response.then(e=>{if(this.currentUseId===n)return e.mergeParams({...r,onPrefetched:()=>{}}),this.removeSingleUseItems(t),e.handle()})}removeSingleUseItems(e){this.cached=this.cached.filter(t=>!this.paramsAreEqual(t.params,e)||!t.singleUse)}findCached(e){return this.cached.find(t=>this.paramsAreEqual(t.params,e))||null}findInFlight(e){return this.inFlightRequests.find(t=>this.paramsAreEqual(t.params,e))||null}withoutPurposePrefetchHeader(e){let t=N(e);return t.headers.Purpose===`prefetch`&&delete t.headers.Purpose,t}paramsAreEqual(e,t){return dn(this.withoutPurposePrefetchHeader(e),this.withoutPurposePrefetchHeader(t),[`id`,`showProgress`,`replace`,`prefetch`,`preserveScroll`,`preserveState`,`onBefore`,`onBeforeUpdate`,`onStart`,`onProgress`,`onFinish`,`onCancel`,`onSuccess`,`onError`,`onFlash`,`onPrefetched`,`onCancelToken`,`onPrefetching`,`async`,`viewTransition`,`optimistic`,`component`,`pageProps`,`cached`])}updateCachedOncePropsFromCurrentPage(){this.cached.forEach(e=>{e.response.then(t=>{let n=t.getPageResponse();F.mergeOncePropsIntoResponse(n,{force:!0});for(let[e,t]of Object.entries(n.deferredProps??{})){let r=t.filter(e=>P(n.props,e)===void 0);r.length>0?n.deferredProps[e]=r:delete n.deferredProps[e]}let r=this.getShortestOncePropTtl(n);if(r===null)return;let i=e.expiresAt-Date.now(),a=Math.min(i,r);a>0?this.scheduleForRemoval(e.params,a):this.remove(e.params)})})}getShortestOncePropTtl(e){let t=Object.values(e.onceProps??{}).map(e=>e.expiresAt).filter(e=>!!e);return t.length===0?null:Math.min(...t)-Date.now()}},gn=e=>{if(e.offsetParent===null)return!1;let t=e.getBoundingClientRect(),n=t.top=0,r=t.left=0;return n&&r},_n=e=>{let t=e=>{let t=window.getComputedStyle(e);return t.overflowY===`scroll`?!0:t.overflowY===`auto`?[`visible`,`clip`].includes(t.overflowX)?!0:r(t.maxHeight,e.style.height)||i(e,`height`):!1},n=e=>{let t=window.getComputedStyle(e);return t.overflowX===`scroll`?!0:t.overflowX===`auto`?[`visible`,`clip`].includes(t.overflowY)?!0:r(t.maxWidth,e.style.width)||i(e,`width`):!1},r=(e,t)=>!!(e&&e!==`none`&&e!==`0px`||t&&t!==`auto`&&t!==`0`),i=(e,t)=>{let n=e.parentElement;if(!n)return!1;let r=window.getComputedStyle(n);if([`flex`,`inline-flex`].includes(r.display)){let e=[`column`,`column-reverse`].includes(r.flexDirection);return t===`height`?e:!e}return[`grid`,`inline-grid`].includes(r.display)},a=e?.parentElement;for(;a;){let e=t(a)||n(a);if(window.getComputedStyle(a).display!==`contents`&&e)return a;a=a.parentElement}return null},vn=(e,t)=>{if(!t)return e.filter(e=>gn(e));let n=e.indexOf(t),r=[],i=[];for(let t=n;t>=0;t--){let n=e[t];if(gn(n))r.push(n);else break}for(let t=n+1;t{window.requestAnimationFrame(()=>{t>1?yn(e,t-1):e()})},bn=e=>{if(typeof window>`u`)return null;let t=document.querySelector(`script[data-page="${e}"][type="application/json"]`);return t?.textContent?JSON.parse(t.textContent):null},xn=typeof window>`u`,Sn=!xn&&/Firefox/i.test(window.navigator.userAgent),Cn=class{static save(){I.saveScrollPositions(this.getScrollRegions())}static getScrollRegions(){return Array.from(this.regions()).map(e=>({top:e.scrollTop,left:e.scrollLeft}))}static regions(){return document.querySelectorAll(`[scroll-region]`)}static scrollToTop(){if(Sn&&getComputedStyle(document.documentElement).scrollBehavior===`smooth`)return yn(()=>window.scrollTo(0,0),2);window.scrollTo(0,0)}static reset(){!xn&&window.location.hash||this.scrollToTop(),this.regions().forEach(e=>{typeof e.scrollTo==`function`?e.scrollTo(0,0):(e.scrollTop=0,e.scrollLeft=0)}),this.save(),this.scrollToAnchor()}static scrollToAnchor(){let e=xn?null:window.location.hash;e&&setTimeout(()=>{let t=document.getElementById(e.slice(1));t?t.scrollIntoView():this.scrollToTop()})}static restore(e){xn||window.requestAnimationFrame(()=>{this.restoreDocument(),this.restoreScrollRegions(e)})}static restoreScrollRegions(e){xn||this.regions().forEach((t,n)=>{let r=e[n];r&&(typeof t.scrollTo==`function`?t.scrollTo(r.left,r.top):(t.scrollTop=r.top,t.scrollLeft=r.left))})}static restoreDocument(){let e=I.getDocumentScrollPosition();window.scrollTo(e.left,e.top)}static onScroll(e){let t=e.target;typeof t.hasAttribute==`function`&&t.hasAttribute(`scroll-region`)&&this.save()}static onWindowScroll(){I.saveDocumentScrollPosition({top:window.scrollY,left:window.scrollX})}},wn=e=>typeof File<`u`&&e instanceof File||e instanceof Blob||typeof FileList<`u`&&e instanceof FileList&&e.length>0;function Tn(e){return wn(e)||e instanceof FormData&&Array.from(e.values()).some(e=>Tn(e))||typeof e==`object`&&!!e&&Object.values(e).some(e=>Tn(e))}var En=e=>e instanceof FormData;function Dn(e,t=new FormData,n=null,r=`brackets`){e||={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&kn(t,On(n,i,`indices`),e[i],r);return t}function On(e,t,n){return e?n===`brackets`?`${e}[]`:`${e}[${t}]`:t}function kn(e,t,n,r){if(Array.isArray(n))return Array.from(n.keys()).forEach(i=>kn(e,On(t,i.toString(),r),n[i],r));if(n instanceof Date)return e.append(t,n.toISOString());if(n instanceof File)return e.append(t,n,n.name);if(n instanceof Blob)return e.append(t,n);if(typeof n==`boolean`)return e.append(t,n?`1`:`0`);if(typeof n==`string`)return e.append(t,n);if(typeof n==`number`)return e.append(t,`${n}`);if(n==null)return e.append(t,``);Dn(n,e,t,r)}function An(e){return/\[\d+\]/.test(decodeURIComponent(e.search))}function jn(e){if(!e||e===`?`)return{};let t={};return e.replace(/^\?/,``).split(`&`).filter(Boolean).forEach(e=>{let[n,r]=Nn(e);Fn(t,Pn(n),Pn(r))}),t}function Mn(e,t){let n=[];return Ln(e,``,n,t),n.length?`?`+n.join(`&`):``}function Nn(e){let t=e.indexOf(`=`);return t===-1?[e,``]:[e.substring(0,t),e.substring(t+1)]}function Pn(e){return decodeURIComponent(e.replace(/\+/g,` `))}function Fn(e,t,n){let r=In(t);if(r.some(e=>e===`__proto__`))return;let i=e;for(;r.length>1;){let e=r.shift(),t=r[0]===``;(typeof i[e]!=`object`||i[e]===null)&&(i[e]=t?[]:{}),i=i[e]}let a=r.shift();a===``&&Array.isArray(i)?i.push(n):i[a]=n}function In(e){let t=[],n=e.split(`[`)[0];n&&t.push(n);let r,i=/\[([^\]]*)\]/g;for(;(r=i.exec(e))!==null;)t.push(r[1]);return t}function Ln(e,t,n,r){if(e!==void 0){if(e===null){n.push(`${t}=`);return}if(Array.isArray(e)){e.forEach((e,i)=>{Ln(e,r===`indices`?`${t}[${i}]`:`${t}[]`,n,r)});return}if(typeof e==`object`){Object.keys(e).forEach(i=>{Ln(e[i],t?`${t}[${i}]`:i,n,r)});return}n.push(`${t}=${encodeURIComponent(String(e))}`)}}function Rn(e){return new URL(e.toString(),typeof window>`u`?void 0:window.location.toString())}var zn=(e,t,n,r,i)=>{let a=typeof e==`string`?Rn(e):e;if((Tn(t)||r)&&!En(t)&&(Pt.get(`form.forceIndicesArrayFormatInFormData`)&&(i=`indices`),t=Dn(t,new FormData,null,i)),En(t))return[a,t];let[o,s]=Bn(n,a,t,i);return[Rn(o),s]};function Bn(e,t,n,r=`brackets`){let i=e===`get`&&!En(n)&&Object.keys(n).length>0,a=qn(t.toString()),o=a||t.toString().startsWith(`/`)||t.toString()===``,s=!o&&!t.toString().startsWith(`#`)&&!t.toString().startsWith(`?`),c=/^[.]{1,2}([/]|$)/.test(t.toString()),l=t.toString().includes(`?`)||i,u=t.toString().includes(`#`),d=new URL(t.toString(),typeof window>`u`?`http://localhost`:window.location.toString());if(i){let e=An(d)?`indices`:r;d.search=Mn({...jn(d.search),...n},e)}return[[a?`${d.protocol}//${d.host}`:``,o?d.pathname:``,s?d.pathname.substring(+!c):``,l?d.search:``,u?d.hash:``].join(``),i?{}:n]}function Vn(e){return e=new URL(e.href),e.hash=``,e}var Hn=(e,t)=>{e.hash&&!t.hash&&Vn(e).href===t.href&&(t.hash=e.hash)},Un=(e,t)=>Vn(e).href===Vn(t).href,Wn=(e,t)=>e.origin===t.origin&&e.pathname===t.pathname;function Gn(e){return typeof e==`object`&&!!e&&e!==void 0&&`url`in e&&`method`in e}function Kn(e){return e.component?typeof e.component==`string`?e.component:(console.error(`The "component" property on the URL method pair received multiple components (${Object.keys(e.component).join(`, `)}), but only a single component string is supported for instant visits. Use the withComponent() method to specify which component to use.`),null):null}function qn(e){return/^([a-z][a-z0-9+.-]*:)?\/\/[^/]/i.test(e)}function Jn(e,t){let n=typeof e==`string`?Rn(e):e;return t?`${n.protocol}//${n.host}${n.pathname}${n.search}${n.hash}`:`${n.pathname}${n.search}${n.hash}`}var F=new class{page;swapComponent;resolveComponent;onFlashCallback;componentId={};listeners=[];isFirstPageLoad=!0;cleared=!1;pendingDeferredProps=null;historyQuotaExceeded=!1;optimisticBaseline={};pendingOptimistics=[];optimisticCounter=0;init({initialPage:e,swapComponent:t,resolveComponent:n,onFlash:r}){return this.page={...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]},this.swapComponent=t,this.resolveComponent=n,this.onFlashCallback=r,er.on(`historyQuotaExceeded`,()=>{this.historyQuotaExceeded=!0}),this}set(e,{replace:t=!1,preserveScroll:n=!1,preserveState:r=!1,viewTransition:i=!1,cached:a=!1,visitId:o}={}){Object.keys(e.deferredProps||{}).length&&(this.pendingDeferredProps={deferredProps:e.deferredProps,component:e.component,url:e.url},e.initialDeferredProps===void 0&&(e.initialDeferredProps=e.deferredProps)),this.componentId={};let s=this.componentId;return e.clearHistory&&I.clear(),this.resolve(e.component,e).then(c=>{if(s!==this.componentId)return;e.rememberedState??={};let l=typeof window>`u`,u=l?new URL(e.url):window.location,d=!l&&n?Cn.getScrollRegions():[];t||=Un(Rn(e.url),u);let f={...e,flash:{}};return new Promise(e=>t?I.replaceState(f,e):I.pushState(f,e)).then(()=>{let s=!this.isTheSame(e);if(!s&&Object.keys(e.props.errors||{}).length>0&&(i=!1),this.page=e,this.cleared=!1,this.hasOnceProps()&&hn.updateCachedOncePropsFromCurrentPage(),s&&this.fireEventsFor(`newComponent`),this.isFirstPageLoad&&this.fireEventsFor(`firstLoad`),this.isFirstPageLoad=!1,this.historyQuotaExceeded){this.historyQuotaExceeded=!1;return}return this.swap({component:c,page:e,preserveState:r,viewTransition:i}).then(()=>{n?window.requestAnimationFrame(()=>Cn.restoreScrollRegions(d)):Cn.reset(),this.pendingDeferredProps&&this.pendingDeferredProps.component===e.component&&this.pendingDeferredProps.url===e.url&&er.fireInternalEvent(`loadDeferredProps`,this.pendingDeferredProps.deferredProps),this.pendingDeferredProps=null,t||Ut(e,{cached:a,visitId:o})})})})}setQuietly(e,{preserveState:t=!1}={}){return this.resolve(e.component,e).then(n=>(this.page=e,this.cleared=!1,I.setCurrent(e),this.swap({component:n,page:e,preserveState:t,viewTransition:!1})))}clear(){this.cleared=!0}isCleared(){return this.cleared}get(){return this.page}getWithoutFlashData(){return{...this.page,flash:{}}}hasOnceProps(){return Object.keys(this.page.onceProps??{}).length>0}merge(e){this.page={...this.page,...e}}setPropsQuietly(e){return this.page={...this.page,props:e},this.resolve(this.page.component,this.page).then(e=>this.swap({component:e,page:this.page,preserveState:!0,viewTransition:!1}))}setFlash(e){this.page={...this.page,flash:e},this.onFlashCallback?.(e)}setUrlHash(e){this.page.url.includes(e)||(this.page.url+=e)}remember(e){this.page.rememberedState=e}swap({component:e,page:t,preserveState:n,viewTransition:r}){let i=()=>this.swapComponent({component:e,page:t,preserveState:n});if(!r||!document?.startViewTransition||document.visibilityState===`hidden`)return i();let a=typeof r==`boolean`?()=>null:r;return new Promise(e=>{let t=document.startViewTransition(()=>i().then(e));t.ready.catch(()=>{}),a(t)})}resolve(e,t){return Promise.resolve(this.resolveComponent(e,t))}nextOptimisticId(){return++this.optimisticCounter}setBaseline(e,t){e in this.optimisticBaseline||(this.optimisticBaseline[e]=t)}updateBaseline(e,t){e in this.optimisticBaseline&&(this.optimisticBaseline[e]=t)}hasBaseline(e){return e in this.optimisticBaseline}registerOptimistic(e,t){this.pendingOptimistics.push({id:e,callback:t})}unregisterOptimistic(e){this.pendingOptimistics=this.pendingOptimistics.filter(t=>t.id!==e)}replayOptimistics(){let e=Object.keys(this.optimisticBaseline);if(e.length===0)return{};let t=N(this.page.props);for(let n of e)t[n]=N(this.optimisticBaseline[n]);for(let{callback:e}of this.pendingOptimistics){let n=e(N(t));n&&Object.assign(t,n)}let n={};for(let r of e)n[r]=t[r];return n}pendingOptimisticCount(){return this.pendingOptimistics.length}clearOptimisticState(){this.optimisticBaseline={},this.pendingOptimistics=[]}isTheSame(e){return this.page.component===e.component}on(e,t){return this.listeners.push({event:e,callback:t}),()=>{this.listeners=this.listeners.filter(n=>n.event!==e&&n.callback!==t)}}fireEventsFor(e){this.listeners.filter(t=>t.event===e).forEach(e=>e.callback())}mergeOncePropsIntoResponse(e,{force:t=!1}={}){Object.entries(e.onceProps??{}).forEach(([n,r])=>{let i=this.page.onceProps?.[n];i!==void 0&&(t||P(e.props,r.prop)===void 0)&&(He(e.props,r.prop,P(this.page.props,i.prop)),e.onceProps[n].expiresAt=i.expiresAt)})}},Yn=class{items=[];processingPromise=null;add(e){return this.items.push(e),this.process()}process(){return this.processingPromise??=this.processNext().finally(()=>{this.processingPromise=null}),this.processingPromise}processNext(){let e=this.items.shift();return e?Promise.resolve(e()).then(()=>this.processNext()):Promise.resolve()}},Xn=typeof window>`u`,Zn=new Yn,Qn=!Xn&&/CriOS/.test(window.navigator.userAgent),$n=class{rememberedState=`rememberedState`;scrollRegions=`scrollRegions`;preserveUrl=!1;current={};initialState=null;remember(e,t){this.replaceState({...F.getWithoutFlashData(),rememberedState:{...F.get()?.rememberedState??{},[t]:e}})}restore(e){if(!Xn)return this.current[this.rememberedState]?.[e]===void 0?this.initialState?.[this.rememberedState]?.[e]:this.current[this.rememberedState]?.[e]}pushState(e,t=null){if(!Xn){if(this.preserveUrl){t&&t();return}this.current=e,Zn.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doPushState({page:n},e.url).then(()=>t?.());return Qn?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))}}clonePageProps(e){try{return structuredClone(e.props),e}catch{return{...e,props:N(e.props)}}}getPageData(e){let t=this.clonePageProps(e);return new Promise(n=>e.encryptHistory?$t(t).then(n):n(t))}processQueue(){return Zn.process()}decrypt(e=null){if(Xn)return Promise.resolve(e??F.get());let t=e??window.history.state?.page;return this.decryptPageData(t).then(e=>{if(!e)throw Error(`Unable to decrypt history`);return this.initialState===null?this.initialState=e??void 0:this.current=e??{},e})}decryptPageData(e){return e instanceof ArrayBuffer?tn(e):Promise.resolve(e)}saveScrollPositions(e){Zn.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!he(this.getScrollRegions(),e))return this.doReplaceState({page:window.history.state.page,scrollRegions:e})}))}saveDocumentScrollPosition(e){Zn.add(()=>Promise.resolve().then(()=>{if(window.history.state?.page&&!he(this.getDocumentScrollPosition(),e))return this.doReplaceState({page:window.history.state.page,documentScrollPosition:e})}))}getScrollRegions(){return window.history.state?.scrollRegions||[]}getDocumentScrollPosition(){return window.history.state?.documentScrollPosition||{top:0,left:0}}replaceState(e,t=null){if(he(this.current,e)){t&&t();return}let{flash:n,...r}=e;if(F.merge(r),!Xn){if(this.preserveUrl){t&&t();return}this.current=e,Zn.add(()=>this.getPageData(e).then(n=>{let r=()=>this.doReplaceState({page:n},e.url).then(()=>t?.());return Qn?new Promise(e=>{setTimeout(()=>r().then(e))}):r()}))}}isHistoryThrottleError(e){return e instanceof Error&&e.name===`SecurityError`&&(e.message.includes(`history.pushState`)||e.message.includes(`history.replaceState`))}isQuotaExceededError(e){return e instanceof Error&&e.name===`QuotaExceededError`}withThrottleProtection(e){return Promise.resolve().then(()=>{try{return e()}catch(e){if(!this.isHistoryThrottleError(e))throw e;console.error(e.message)}})}doReplaceState(e,t){return this.withThrottleProtection(()=>{window.history.replaceState({...e,scrollRegions:e.scrollRegions??window.history.state?.scrollRegions,documentScrollPosition:e.documentScrollPosition??window.history.state?.documentScrollPosition},``,t)})}doPushState(e,t){return this.withThrottleProtection(()=>{try{window.history.pushState(e,``,t)}catch(e){if(!this.isQuotaExceededError(e))throw e;er.fireInternalEvent(`historyQuotaExceeded`,t)}})}getState(e,t){return this.current?.[e]??t}deleteState(e){this.current[e]!==void 0&&(delete this.current[e],this.replaceState(this.current))}clearInitialState(e){this.initialState&&this.initialState[e]!==void 0&&delete this.initialState[e]}browserHasHistoryEntry(){return!Xn&&!!window.history.state?.page}clear(){Qt.remove(en.key),Qt.remove(en.iv)}setCurrent(e){this.current=e}isValidState(e){return!!e.page}getAllState(){return this.current}};typeof window<`u`&&window.history.scrollRestoration&&(window.history.scrollRestoration=`manual`);var I=new $n,er=new class{internalListeners=[];init(){typeof window<`u`&&(window.addEventListener(`popstate`,this.handlePopstateEvent.bind(this)),window.addEventListener(`pageshow`,this.handlePageshowEvent.bind(this)),window.addEventListener(`scroll`,Ft(Cn.onWindowScroll.bind(Cn),100),!0)),typeof document<`u`&&document.addEventListener(`scroll`,Ft(Cn.onScroll.bind(Cn),100),!0)}onGlobalEvent(e,t){return this.registerListener(`inertia:${e}`,(e=>{let n=t(e);e.cancelable&&!e.defaultPrevented&&n===!1&&e.preventDefault()}))}on(e,t){return this.internalListeners.push({event:e,listener:t}),()=>{this.internalListeners=this.internalListeners.filter(e=>e.listener!==t)}}onMissingHistoryItem(){F.clear(),this.fireInternalEvent(`missingHistoryItem`)}fireInternalEvent(e,...t){this.internalListeners.filter(t=>t.event===e).forEach(e=>e.listener(...t))}registerListener(e,t){return document.addEventListener(e,t),()=>document.removeEventListener(e,t)}handlePageshowEvent(e){e.persisted&&I.decrypt().catch(()=>this.onMissingHistoryItem())}handlePopstateEvent(e){let t=e.state||null;if(t===null){let e=Rn(F.get().url);e.hash=window.location.hash,I.replaceState({...F.getWithoutFlashData(),url:e.href}),Cn.reset();return}if(!I.isValidState(t))return this.onMissingHistoryItem();I.decrypt(t.page).then(e=>{if(F.get().version!==e.version){this.onMissingHistoryItem();return}H.cancelAll({prefetch:!1}),F.setQuietly(e,{preserveState:!1}).then(()=>{Cn.restore(I.getScrollRegions()),Ut(F.get());let t={},n=F.get().props;for(let[r,i]of Object.entries(e.initialDeferredProps??e.deferredProps??{})){let e=i.filter(e=>P(n,e)===void 0);e.length>0&&(t[r]=e)}Object.keys(t).length>0&&this.fireInternalEvent(`loadDeferredProps`,t)})}).catch(()=>{this.onMissingHistoryItem()})}},tr=new class{type;constructor(){this.type=this.resolveType()}resolveType(){return typeof window>`u`?`navigate`:window.performance?.getEntriesByType(`navigation`)[0]?.type??`navigate`}get(){return this.type}isBackForward(){return this.type===`back_forward`}isReload(){return this.type===`reload`}};function nr(){let e=typeof window<`u`?window.crypto:void 0;if(e?.randomUUID)return e.randomUUID();let t=()=>e?.getRandomValues?e.getRandomValues(new Uint8Array(1))[0]:Math.floor(Math.random()*256);return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^t()&15>>e/4).toString(16))}var rr=class{static handle(){this.clearRememberedStateOnReload(),[this.handleBackForward,this.handleLocation,this.handleDefault].find(e=>e.bind(this)())}static clearRememberedStateOnReload(){tr.isReload()&&(I.deleteState(I.rememberedState),I.clearInitialState(I.rememberedState))}static handleBackForward(){if(!tr.isBackForward()||!I.browserHasHistoryEntry())return!1;let e=I.getScrollRegions();return I.decrypt().then(t=>{let n=nr();F.set(t,{preserveScroll:!0,preserveState:!0,visitId:n}).then(()=>{Cn.restore(e),Ut(F.get(),{visitId:n})})}).catch(()=>{er.onMissingHistoryItem()}),!0}static handleLocation(){if(!Qt.exists(Qt.locationVisitKey))return!1;let e=Qt.get(Qt.locationVisitKey)||{};return Qt.remove(Qt.locationVisitKey),typeof window<`u`&&F.setUrlHash(window.location.hash),I.decrypt(F.get()).then(()=>{let t=nr(),n=I.getState(I.rememberedState,{}),r=I.getScrollRegions();F.remember(n),F.set(F.get(),{preserveScroll:e.preserveScroll,preserveState:!0,visitId:t}).then(()=>{e.preserveScroll&&Cn.restore(r),this.fireInitialEvents(t)})}).catch(()=>{er.onMissingHistoryItem()}),!0}static handleDefault(){typeof window<`u`&&F.setUrlHash(window.location.hash);let e=nr();F.set(F.get(),{preserveScroll:!0,preserveState:!0,visitId:e}).then(()=>{tr.isReload()?Cn.restore(I.getScrollRegions()):Cn.scrollToAnchor(),this.fireInitialEvents(e)})}static fireInitialEvents(e){let t=F.get();Ut(t,{visitId:e}),Object.keys(t.flash).length>0&&queueMicrotask(()=>Xt(t.flash))}},ir=class{intervalId=null;timeoutId=null;throttle=!1;keepAlive=!1;cb;interval;cbCount=0;mode;inFlight=!1;currentCancel=null;stopped=!0;instanceId=0;constructor(e,t,n){this.keepAlive=n.keepAlive??!1,this.mode=n.mode??`overlap`,this.cb=t,this.interval=e,(n.autoStart??!0)&&this.start()}stop(){this.stopped=!0,this.instanceId++,this.inFlight=!1,this.currentCancel=null,this.intervalId&&=(clearInterval(this.intervalId),null),this.timeoutId&&=(clearTimeout(this.timeoutId),null)}start(){if(!(typeof window>`u`)){if(this.stop(),this.stopped=!1,this.mode===`rest`){this.scheduleNext();return}this.intervalId=window.setInterval(()=>this.tick(),this.interval)}}isInBackground(e){this.throttle=!this.keepAlive&&e,this.throttle&&(this.cbCount=0)}scheduleNext(){this.stopped||(this.timeoutId=window.setTimeout(()=>{this.timeoutId=null,this.tick()},this.interval))}tick(){!this.throttle||this.cbCount%10==0?this.fire():this.mode===`rest`&&this.scheduleNext(),this.throttle&&this.cbCount++}fire(){this.inFlight&&this.mode===`cancel`&&this.currentCancel?.();let e=this.instanceId;this.cb({onStart:t=>{e===this.instanceId&&(this.inFlight=!0,this.currentCancel=t)},onFinish:()=>{e===this.instanceId&&(this.inFlight=!1,this.currentCancel=null,this.mode===`rest`&&this.scheduleNext())}})}},ar=new class{polls=[];constructor(){this.setupVisibilityListener()}get count(){return this.polls.length}add(e,t,n){let r=new ir(e,t,n);return this.polls.push(r),{stop:()=>r.stop(),start:()=>r.start(),destroy:()=>{r.stop(),this.polls=this.polls.filter(e=>e!==r)}}}clear(){this.polls.forEach(e=>e.stop()),this.polls=[]}setupVisibilityListener(){typeof document>`u`||document.addEventListener(`visibilitychange`,()=>{this.polls.forEach(e=>e.isInBackground(document.hidden))},!1)}},or=new class{requestHandlers=[];responseHandlers=[];errorHandlers=[];onRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}onError(e){return this.errorHandlers.push(e),()=>{this.errorHandlers=this.errorHandlers.filter(t=>t!==e)}}async processRequest(e){let t=e;for(let e of this.requestHandlers)t=await e(t);return t}async processResponse(e){let t=e;for(let e of this.responseHandlers)t=await e(t);return t}async processError(e){for(let t of this.errorHandlers)await t(e)}},sr=class extends Error{code;url;constructor(e,t,n){super(n?`${e} (${n})`:e),this.name=`HttpError`,this.code=t,this.url=n}},cr=class extends sr{response;constructor(e,t,n){super(e,`ERR_HTTP_RESPONSE`,n),this.name=`HttpResponseError`,this.response=t}},lr=class extends sr{constructor(e=`Request was cancelled`,t){super(e,`ERR_CANCELLED`,t),this.name=`HttpCancelledError`}},ur=class extends sr{cause;constructor(e,t,n){super(e,`ERR_NETWORK`,t),this.name=`HttpNetworkError`,this.cause=n}};function dr(e){let t=document.cookie.match(RegExp(`(^|;\\s*)(`+e+`)=([^;]*)`));return t?decodeURIComponent(t[3]):null}function fr(e){let t={};return e.getAllResponseHeaders().split(`\r `).forEach(e=>{let n=e.indexOf(`:`);n>0&&(t[e.slice(0,n).toLowerCase().trim()]=e.slice(n+1).trim())}),t}function pr(e){return typeof FormData<`u`&&e instanceof FormData}function mr(e){return typeof e==`string`||pr(e)||typeof Blob<`u`&&e instanceof Blob||typeof ArrayBuffer<`u`&&e instanceof ArrayBuffer||typeof ArrayBuffer<`u`&&ArrayBuffer.isView(e)||typeof URLSearchParams<`u`&&e instanceof URLSearchParams}function hr(e,t){if(!t.headers)return;let n=pr(t.data);Object.entries(t.headers).forEach(([t,r])=>{(t.toLowerCase()!==`content-type`||!n)&&e.setRequestHeader(t,String(r))})}function gr(e,t){if(!t||Object.keys(t).length===0)return e;let[n]=Bn(`get`,e,t);return n}var _r=class{xsrfCookieName;xsrfHeaderName;constructor(e={}){this.xsrfCookieName=e.xsrfCookieName??`XSRF-TOKEN`,this.xsrfHeaderName=e.xsrfHeaderName??`X-XSRF-TOKEN`}async request(e){let t=await or.processRequest(e);try{let e=await this.doRequest(t);return await or.processResponse(e)}catch(e){throw(e instanceof cr||e instanceof ur||e instanceof lr)&&await or.processError(e),e}}doRequest(e){return new Promise((t,n)=>{let r=new XMLHttpRequest,i=gr(e.url,e.params);r.open(e.method.toUpperCase(),i,!0);let a=dr(this.xsrfCookieName);a&&r.setRequestHeader(this.xsrfHeaderName,a),Object.keys(e.headers??{}).some(e=>e.toLowerCase()===`x-requested-with`)||r.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`);let o=null;e.data!==null&&e.data!==void 0&&(mr(e.data)?o=e.data:typeof e.data==`object`?(o=JSON.stringify(e.data),!e.headers?.[`Content-Type`]&&!e.headers?.[`content-type`]&&r.setRequestHeader(`Content-Type`,`application/json`)):o=String(e.data)),hr(r,e),e.onUploadProgress&&(r.upload.onprogress=t=>{let n=t.lengthComputable?t.loaded/t.total:void 0;e.onUploadProgress({progress:n,percentage:n?Math.round(n*100):0,loaded:t.loaded,total:t.lengthComputable?t.total:void 0})}),e.signal&&e.signal.addEventListener(`abort`,()=>r.abort()),r.onabort=()=>n(new lr(`Request was cancelled`,e.url)),r.onerror=()=>n(new ur(`Network error`,e.url)),r.onload=()=>{let i={status:r.status,data:r.responseText,headers:fr(r)};r.status>=400?n(new cr(`Request failed with status ${r.status}`,i,e.url)):t(i)},r.send(o)})}},vr=new _r;function yr(e){return!(`request`in e)}var br={getClient(){return vr},setClient(e){if(!yr(e)){vr=e;return}vr=new _r(e),e.xsrfCookieName&&ht.withXsrfCookieName(e.xsrfCookieName),e.xsrfHeaderName&&ht.withXsrfHeaderName(e.xsrfHeaderName)},onRequest:or.onRequest.bind(or),onResponse:or.onResponse.bind(or),onError:or.onError.bind(or),processRequest:or.processRequest.bind(or),processResponse:or.processResponse.bind(or),processError:or.processError.bind(or)},xr=new class{requestHandlers=[];responseHandlers=[];onVisitRequest(e){return this.requestHandlers.push(e),()=>{this.requestHandlers=this.requestHandlers.filter(t=>t!==e)}}onVisitResponse(e){return this.responseHandlers.push(e),()=>{this.responseHandlers=this.responseHandlers.filter(t=>t!==e)}}async processRequest(e,t){let n=t;for(let t of this.requestHandlers)n=await t(e,n);return n}async processResponse(e,t){let n=t;for(let t of this.responseHandlers)n=await t(e,n);return n}};function Sr(){typeof window>`u`||(window.__inertia_interceptors__=xr)}var Cr=class e{callbacks=[];params;constructor(e){if(!e.prefetch)this.params=e;else{let t={onBefore:this.wrapCallback(e,`onBefore`),onBeforeUpdate:this.wrapCallback(e,`onBeforeUpdate`),onStart:this.wrapCallback(e,`onStart`),onProgress:this.wrapCallback(e,`onProgress`),onFinish:this.wrapCallback(e,`onFinish`),onCancel:this.wrapCallback(e,`onCancel`),onSuccess:this.wrapCallback(e,`onSuccess`),onError:this.wrapCallback(e,`onError`),onHttpException:this.wrapCallback(e,`onHttpException`),onNetworkError:this.wrapCallback(e,`onNetworkError`),onFlash:this.wrapCallback(e,`onFlash`),onCancelToken:this.wrapCallback(e,`onCancelToken`),onPrefetched:this.wrapCallback(e,`onPrefetched`),onPrefetching:this.wrapCallback(e,`onPrefetching`)};this.params={...e,...t,onPrefetchResponse:e.onPrefetchResponse||(()=>{}),onPrefetchError:e.onPrefetchError||(()=>{})}}}static create(t){return new e(t)}data(){return this.params.method===`get`?null:this.params.data}queryParams(){return this.params.method===`get`?this.params.data:{}}isPartial(){return this.params.only.length>0||this.params.except.length>0||this.params.reset.length>0}isPrefetch(){return this.params.prefetch===!0}isDeferredPropsRequest(){return this.params.deferredProps===!0}isPollRequest(){return this.params.poll===!0}onCancelToken(e){this.params.onCancelToken({cancel:e})}markAsFinished(){this.params.completed=!0,this.params.cancelled=!1,this.params.interrupted=!1}markAsCancelled({cancelled:e=!0,interrupted:t=!1}){this.params.onCancel(),this.params.completed=!1,this.params.cancelled=e,this.params.interrupted=t}wasCancelledAtAll(){return this.params.cancelled||this.params.interrupted}onFinish(){this.params.onFinish(this.params)}onStart(){this.params.onStart(this.params)}onPrefetching(){this.params.onPrefetching(this.params)}onPrefetchResponse(e){this.params.onPrefetchResponse&&this.params.onPrefetchResponse(e)}onPrefetchError(e){this.params.onPrefetchError&&this.params.onPrefetchError(e)}all(){return this.params}headers(){let e={...this.params.headers};this.isPartial()&&(e[`X-Inertia-Partial-Component`]=F.get().component);let t=this.params.only.concat(this.params.reset);return t.length>0&&(e[`X-Inertia-Partial-Data`]=t.join(`,`)),this.params.except.length>0&&(e[`X-Inertia-Partial-Except`]=this.params.except.join(`,`)),this.params.reset.length>0&&(e[`X-Inertia-Reset`]=this.params.reset.join(`,`)),this.params.errorBag&&this.params.errorBag.length>0&&(e[`X-Inertia-Error-Bag`]=this.params.errorBag),e}setPreserveOptions(t){this.params.preserveScroll=e.resolvePreserveOption(this.params.preserveScroll,t),this.params.preserveState=e.resolvePreserveOption(this.params.preserveState,t)}runCallbacks(){this.callbacks.forEach(({name:e,args:t})=>{this.params[e](...t)})}merge(e){this.params={...this.params,...e}}wrapCallback(e,t){return(...n)=>{this.recordCallback(t,n),e[t](...n)}}recordCallback(e,t){this.callbacks.push({name:e,args:t})}static resolvePreserveOption(e,t){return typeof e==`function`?e(t):e===`errors`?Object.keys(t.props.errors||{}).length>0:e}},wr={createIframeAndPage(e){typeof e==`object`&&(e=`All Inertia requests must receive a valid Inertia response, however a plain JSON response was received.
${JSON.stringify(e)}`);let t=document.createElement(`html`);t.innerHTML=e,t.querySelectorAll(`a`).forEach(e=>e.setAttribute(`target`,`_top`));let n=document.createElement(`iframe`);return n.style.backgroundColor=`white`,n.style.borderRadius=`5px`,n.style.width=`100%`,n.style.height=`100%`,n.setAttribute(`sandbox`,`allow-scripts`),{iframe:n,page:t}},show(e){let{iframe:t,page:n}=this.createIframeAndPage(e);t.style.boxSizing=`border-box`,t.style.display=`block`;let r=document.createElement(`dialog`);r.id=`inertia-error-dialog`,Object.assign(r.style,{width:`calc(100vw - 100px)`,height:`calc(100vh - 100px)`,padding:`0`,margin:`auto`,border:`none`,backgroundColor:`transparent`});let i=document.createElement(`style`);i.textContent=` dialog#inertia-error-dialog::backdrop { background-color: rgba(0, 0, 0, 0.6); } dialog#inertia-error-dialog:focus { outline: none; } `;let a=Pt.get(`nonce`);a&&(i.nonce=a),document.head.appendChild(i),r.addEventListener(`click`,e=>{e.target===r&&r.close()}),r.addEventListener(`close`,()=>{i.remove(),r.remove()}),r.appendChild(t),document.body.prepend(r),r.showModal(),r.focus(),t.srcdoc=n.outerHTML}},Tr=(e,t)=>e===t||e.startsWith(`${t}.`),Er=(e,t)=>{let{only:n,except:r}=e;return!(n.length===0&&r.length===0||n.length>0&&!n.some(e=>Tr(t,e))||r.length>0&&r.some(e=>Tr(t,e)))},Dr=(e,t)=>t.some(t=>Er(e,t)),Or=new Yn,kr=class e{constructor(e,t,n){this.requestParams=e,this.response=t,this.originatingPage=n}requestParams;response;originatingPage;wasPrefetched=!1;processed=!1;static create(t,n,r){return new e(t,n,r)}isProcessed(){return this.processed}async handlePrefetch(){Un(this.requestParams.all().url,window.location)&&this.handle()}async handle(){return Or.add(()=>this.process())}async process(){if(this.requestParams.all().prefetch)return this.wasPrefetched=!0,this.requestParams.all().prefetch=!1,this.requestParams.all().onPrefetched(this.response,this.requestParams.all()),Jt(this.response,this.requestParams.all()),Promise.resolve();if(this.requestParams.runCallbacks(),this.processed=!0,!this.isInertiaResponse())return this.handleNonInertiaResponse();if(this.isHttpException()){let e={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(e)===!1||!Vt(e))return}await I.processQueue(),I.preserveUrl=this.requestParams.all().preserveUrl,await this.setPage();let{flash:e}=F.get();Object.keys(e).length>0&&!this.requestParams.isDeferredPropsRequest()&&(Xt(e),this.requestParams.all().onFlash(e));let t=F.get().props.errors||{};if(Object.keys(t).length>0){let e=this.getScopedErrors(t);return Rt(e,{page:F.get(),visitId:this.requestParams.all().id}),this.requestParams.all().onError(e)}H.flushByCacheTags(this.requestParams.all().invalidateCacheTags||[]),this.wasPrefetched||H.flush(F.get().url),qt(F.get(),{visitId:this.requestParams.all().id}),await this.requestParams.all().onSuccess(F.get()),I.preserveUrl=!1}mergeParams(e){this.requestParams.merge(e)}getPageResponse(){let e=this.getDataFromResponse(this.response.data);return typeof e==`object`?this.response.data={...e,flash:e.flash??{},rescuedProps:e.rescuedProps??[]}:this.response.data=e}async handleNonInertiaResponse(){if(this.isInertiaRedirect()){H.visit(this.getHeader(`x-inertia-redirect`),{...this.requestParams.all(),method:`get`,data:{}});return}if(this.isLocationVisit()){let e=Rn(this.getHeader(`x-inertia-location`));return Hn(this.requestParams.all().url,e),this.locationVisit(e)}let e={...this.response,data:this.getDataFromResponse(this.response.data)};if(this.requestParams.all().onHttpException(e)!==!1&&Vt(e))return wr.show(e.data)}isInertiaResponse(){return this.hasHeader(`x-inertia`)}isHttpException(){return this.response.status>=400}hasStatus(e){return this.response.status===e}getHeader(e){return this.response.headers[e]}hasHeader(e){return this.getHeader(e)!==void 0}isInertiaRedirect(){return this.hasStatus(409)&&this.hasHeader(`x-inertia-redirect`)}isLocationVisit(){return this.hasStatus(409)&&this.hasHeader(`x-inertia-location`)}locationVisit(e){try{if(typeof window>`u`)return;let t=this.getHeader(`x-inertia-version`),n=!!t&&t!==F.get().version;if(!Zt(e,n)||n&&this.requestParams.all().async)return;Qt.set(Qt.locationVisitKey,{preserveScroll:this.requestParams.all().preserveScroll===!0}),Un(window.location,e)?window.location.reload():window.location.href=e.href}catch{return!1}}async setPage(){let e=this.getPageResponse();return this.shouldSetPage(e)?(this.response=await xr.processResponse(this.requestParams.all(),this.response),this.mergeProps(e),F.mergeOncePropsIntoResponse(e),this.preserveOptimisticProps(e),this.preserveEqualProps(e),await this.setRememberedState(e),this.requestParams.setPreserveOptions(e),e.url=I.preserveUrl?F.get().url:this.pageUrl(e),this.requestParams.all().onBeforeUpdate(e),Ht(e),F.set(e,{replace:this.requestParams.all().replace,preserveScroll:this.requestParams.all().preserveScroll,preserveState:this.requestParams.all().preserveState,viewTransition:this.requestParams.all().viewTransition,cached:this.requestParams.all().cached,visitId:this.requestParams.all().id})):Promise.resolve()}getDataFromResponse(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}shouldSetPage(e){if(!this.requestParams.all().async||this.originatingPage.component!==e.component)return!0;if(this.originatingPage.component!==F.get().component)return!1;let t=Rn(this.originatingPage.url),n=Rn(F.get().url);return t.origin===n.origin&&t.pathname===n.pathname}pageUrl(e){let t=Rn(e.url);return e.preserveFragment?t.hash=this.requestParams.all().url.hash:Hn(this.requestParams.all().url,t),t.pathname+t.search+t.hash}preserveOptimisticProps(e){if(H.hasPendingOptimistic())for(let t of Object.keys(e.props))F.hasBaseline(t)&&(F.updateBaseline(t,e.props[t]),e.props[t]=F.get().props[t])}preserveEqualProps(e){if(e.component!==F.get().component)return;let t=F.get().props;Object.entries(e.props).forEach(([n,r])=>{he(r,t[n])&&(e.props[n]=t[n])})}mergeProps(e){if(!this.requestParams.isPartial()||e.component!==F.get().component)return;let t=e.mergeProps||[],n=e.prependProps||[],r=e.deepMergeProps||[],i=e.matchPropsOn||[],a=(t,n)=>{let r=P(F.get().props,t),a=P(e.props,t);if(Array.isArray(a)){let o=this.mergeOrMatchItems(r||[],a,t,i,n);He(e.props,t,o)}else if(typeof a==`object`&&a){let n={...r||{},...a};He(e.props,t,n)}};t.forEach(e=>a(e,!0)),n.forEach(e=>a(e,!1)),r.forEach(t=>{let n=P(F.get().props,t),r=P(e.props,t),a=(e,t,n)=>Array.isArray(t)?this.mergeOrMatchItems(e,t,n,i):typeof t==`object`&&t?Object.keys(t).reduce((r,i)=>(r[i]=a(e?e[i]:void 0,t[i],`${n}.${i}`),r),{...e}):t;He(e.props,t,a(n,r,t))});let o=new Set([...this.requestParams.all().only,...this.requestParams.all().except].filter(e=>e.includes(`.`)).map(e=>e.split(`.`)[0]));for(let t of o){let n=F.get().props[t];this.isObject(n)&&this.isObject(e.props[t])&&(e.props[t]=this.deepMergeObjects(n,e.props[t]))}e.props={...F.get().props,...e.props},this.shouldPreserveErrors(e)&&(e.props.errors=F.get().props.errors),F.get().scrollProps&&(e.scrollProps={...F.get().scrollProps||{},...e.scrollProps||{}}),F.hasOnceProps()&&(e.onceProps={...F.get().onceProps||{},...e.onceProps||{}}),this.requestParams.isDeferredPropsRequest()&&(e.flash={...F.get().flash});let s=F.get().initialDeferredProps;s&&Object.keys(s).length>0&&(e.initialDeferredProps=s),e.rescuedProps=this.mergeRescuedProps(e)}mergeRescuedProps(e){let t=F.get().rescuedProps??[],n=e.rescuedProps??[],r=new Set(t.filter(e=>!Er(this.requestParams.all(),e)));return n.forEach(e=>r.add(e)),Array.from(r)}shouldPreserveErrors(e){if(!this.requestParams.all().preserveErrors)return!1;let t=F.get().props.errors;if(!t||Object.keys(t).length===0)return!1;let n=e.props.errors;return!(n&&Object.keys(n).length>0)}isObject(e){return e&&typeof e==`object`&&!Array.isArray(e)}deepMergeObjects(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];this.isObject(i)&&this.isObject(a)?n[r]=this.deepMergeObjects(i,a):n[r]=a}return n}mergeOrMatchItems(e,t,n,r,i=!0){let a=Array.isArray(e)?e:[],o=r.find(e=>e.split(`.`).slice(0,-1).join(`.`)===n);if(!o)return i?[...a,...t]:[...t,...a];let s=o.split(`.`).pop()||``,c=new Map;return t.forEach(e=>{this.hasUniqueProperty(e,s)&&c.set(e[s],e)}),i?this.appendWithMatching(a,t,c,s):this.prependWithMatching(a,t,c,s)}appendWithMatching(e,t,n,r){let i=e.map(e=>this.hasUniqueProperty(e,r)&&n.has(e[r])?n.get(e[r]):e),a=t.filter(t=>!this.hasUniqueProperty(t,r)||!e.some(e=>this.hasUniqueProperty(e,r)&&e[r]===t[r]));return[...i,...a]}prependWithMatching(e,t,n,r){let i=e.filter(e=>!this.hasUniqueProperty(e,r)||!n.has(e[r]));return[...t,...i]}hasUniqueProperty(e,t){return e&&typeof e==`object`&&t in e}async setRememberedState(e){let t=await I.getState(I.rememberedState,{});this.requestParams.all().preserveState&&t&&e.component===F.get().component&&(e.rememberedState=t)}getScopedErrors(e){return this.requestParams.all().errorBag?e[this.requestParams.all().errorBag||``]||{}:e}},Ar=class e{constructor(e,t,{optimistic:n=!1}={}){this.page=t,this.requestParams=Cr.create(e),this.cancelToken=new AbortController,this.optimistic=n}page;response;cancelToken;requestParams;requestHasFinished=!1;optimistic;static create(t,n,r){return new e(t,n,r)}isPrefetch(){return this.requestParams.isPrefetch()}isOptimistic(){return this.optimistic}isPendingOptimistic(){return this.isOptimistic()&&(!this.response||!this.response.isProcessed())}async send(){this.requestParams.onCancelToken(()=>this.cancel({cancelled:!0})),Kt(this.requestParams.all()),this.requestParams.onStart(),this.requestParams.all().prefetch&&(this.requestParams.onPrefetching(),Yt(this.requestParams.all()));let e=this.requestParams.all().prefetch,t={method:this.requestParams.all().method,url:Vn(this.requestParams.all().url).href,data:this.requestParams.data(),signal:this.cancelToken.signal,headers:this.getHeaders(),onUploadProgress:this.onProgress.bind(this)},n=await xr.processRequest(this.requestParams.all(),t);return br.getClient().request(n).then(e=>(this.response=kr.create(this.requestParams,e,this.page),this.response.handle())).catch(e=>e instanceof cr?(this.response=kr.create(this.requestParams,e.response,this.page),this.response.handle()):Promise.reject(e)).catch(t=>{if(!(t instanceof lr)&&this.requestParams.all().onNetworkError(t)!==!1&&zt(t))return e&&this.requestParams.onPrefetchError(t),Promise.reject(t)}).finally(()=>{this.finish(),e&&this.response&&this.requestParams.onPrefetchResponse(this.response)})}finish(){this.requestParams.wasCancelledAtAll()||(this.requestParams.markAsFinished(),this.fireFinishEvents())}fireFinishEvents(){this.requestHasFinished||(this.requestHasFinished=!0,Bt(this.requestParams.all()),this.requestParams.onFinish())}cancel({cancelled:e=!1,interrupted:t=!1}){this.requestHasFinished||(this.cancelToken.abort(),this.requestParams.markAsCancelled({cancelled:e,interrupted:t}),this.fireFinishEvents())}onProgress(e){this.requestParams.data()instanceof FormData&&(Gt(e),this.requestParams.all().onProgress(e))}getHeaders(){let e={...this.requestParams.headers(),Accept:`text/html, application/xhtml+xml`,"X-Requested-With":`XMLHttpRequest`,"X-Inertia":!0},t=F.get();t.version&&(e[`X-Inertia-Version`]=t.version);let n=Object.entries(t.onceProps||{}).filter(([,e])=>P(t.props,e.prop)===void 0?!1:!e.expiresAt||e.expiresAt>Date.now()).map(([e])=>e);return n.length>0&&(e[`X-Inertia-Except-Once-Props`]=n.join(`,`)),e}},jr=class{requests=[];maxConcurrent;interruptible;constructor({maxConcurrent:e,interruptible:t}){this.maxConcurrent=e,this.interruptible=t}send(e){this.requests.push(e),e.send().finally(()=>{this.requests=this.requests.filter(t=>t!==e)})}interruptInFlight(){this.cancel({interrupted:!0},!1)}cancelInFlight({prefetch:e=!0,optimistic:t=!0}={}){this.requests.filter(t=>e||!t.isPrefetch()).filter(e=>t||!e.isOptimistic()).forEach(e=>e.cancel({cancelled:!0}))}cancel({cancelled:e=!1,interrupted:t=!1}={},n=!1){!n&&!this.shouldCancel()||this.requests.shift()?.cancel({cancelled:e,interrupted:t})}shouldCancel(){return this.interruptible&&this.requests.length>=this.maxConcurrent}hasPendingOptimistic(){return this.requests.some(e=>e.isPendingOptimistic())}},Mr=()=>{},Nr=class{syncRequestStream=new jr({maxConcurrent:1,interruptible:!0});asyncRequestStream=new jr({maxConcurrent:1/0,interruptible:!1});clientVisitQueue=new Yn;pendingOptimisticCallback=void 0;init({initialPage:e,resolveComponent:t,swapComponent:n,onFlash:r}){F.init({initialPage:e,resolveComponent:t,swapComponent:n,onFlash:r}),rr.handle(),er.init(),er.on(`missingHistoryItem`,()=>{typeof window<`u`&&this.visit(window.location.href,{preserveState:!0,preserveScroll:!0,replace:!0})}),er.on(`loadDeferredProps`,e=>{this.loadDeferredProps(e)}),er.on(`historyQuotaExceeded`,e=>{window.location.href=e})}optimistic(e){return this.pendingOptimisticCallback=e,this}get(e,t={},n={}){return this.visit(e,{...n,method:`get`,data:t})}post(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`post`,data:t})}put(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`put`,data:t})}patch(e,t={},n={}){return this.visit(e,{preserveState:!0,...n,method:`patch`,data:t})}delete(e,t={}){return this.visit(e,{preserveState:!0,...t,method:`delete`})}reload(e={}){return this.doReload(e)}doReload(e={}){if(!(typeof window>`u`))return this.visit(window.location.href,{...e,preserveScroll:!0,preserveState:!0,async:!0,headers:{...e.headers||{},"Cache-Control":`no-cache`}})}remember(e,t=`default`){I.remember(e,t)}restore(e=`default`){return I.restore(e)}on(e,t){return typeof window>`u`?()=>{}:er.onGlobalEvent(e,t)}once(e,t){if(typeof window>`u`)return()=>{};let n=this.on(e,e=>(n(),t(e)));return n}hasPendingOptimistic(){return this.asyncRequestStream.hasPendingOptimistic()}get activePolls(){return ar.count}cancelAll({async:e=!0,prefetch:t=!0,sync:n=!0}={}){e&&this.asyncRequestStream.cancelInFlight({prefetch:t}),n&&this.syncRequestStream.cancelInFlight()}poll(e,t={},n={}){return ar.add(e,({onStart:e,onFinish:n})=>{let r=typeof t==`function`?t():t;this.doReload({poll:!0,preserveErrors:!0,...r,onCancelToken:t=>{e(t.cancel),r.onCancelToken?.(t)},onFinish:e=>{n(),r.onFinish?.(e)}})},{autoStart:n.autoStart??!0,keepAlive:n.keepAlive??!1,mode:n.mode})}visit(e,t={}){t.optimistic=t.optimistic??this.pendingOptimisticCallback,this.pendingOptimisticCallback=void 0,t.optimistic&&(t.async=t.async??!0);let n=this.getPendingVisit(e,{...t,showProgress:t.showProgress??(!t.async||!!t.optimistic)}),r=this.getVisitEvents(t);if(r.onBefore(n)===!1||!Lt(n))return;let i=Rn(F.get().url);(n.only.length>0||n.except.length>0||n.reset.length>0?Wn(n.url,i):Un(n.url,i))||this.asyncRequestStream.cancelInFlight({prefetch:!1,optimistic:!1}),n.async||this.syncRequestStream.interruptInFlight(),t.optimistic&&this.applyOptimisticUpdate(t.optimistic,r),!F.isCleared()&&!n.preserveUrl&&Cn.save();let a={...n,...r},o=()=>{let e=hn.get(a);e?(Fi.reveal(e.inFlight),hn.use(e,a)):(Fi.reveal(!0),(n.async?this.asyncRequestStream:this.syncRequestStream).send(Ar.create(a,F.get(),{optimistic:!!t.optimistic})))};Array.isArray(n.component)&&(console.error(`The "component" prop received an array of components (${n.component.join(`, `)}), but only a single component string is supported for instant visits. Pass an explicit component name instead.`),n.component=null),n.component?I.processQueue().then(()=>{this.performInstantSwap(n).then(()=>{a.preserveScroll=!0,a.preserveState=!0,a.replace=!0,a.viewTransition=!1,o()})}):o()}getCached(e,t={}){return hn.findCached(this.getPrefetchParams(e,t))}flush(e,t={}){hn.remove(this.getPrefetchParams(e,t))}flushAll(){hn.removeAll()}flushByCacheTags(e){hn.removeByTags(Array.isArray(e)?e:[e])}getPrefetching(e,t={}){return hn.findInFlight(this.getPrefetchParams(e,t))}prefetch(e,t={},n={}){if((t.method??(Gn(e)?e.method:`get`))!==`get`)throw Error(`Prefetch requests must use the GET method`);let r=this.getPendingVisit(e,{...t,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1});if(r.url.origin+r.url.pathname+r.url.search===window.location.origin+window.location.pathname+window.location.search)return;let i=this.getVisitEvents(t);if(i.onBefore(r)===!1||!Lt(r))return;Fi.hide(),this.asyncRequestStream.interruptInFlight();let a={...r,...i};new Promise(e=>{let t=()=>{F.get()?e():setTimeout(t,50)};t()}).then(()=>{hn.add(a,e=>{this.asyncRequestStream.send(Ar.create(e,F.get()))},{cacheFor:Pt.get(`prefetch.cacheFor`),cacheTags:[],...n})})}clearHistory(){I.clear()}decryptHistory(){return I.decrypt()}resolveComponent(e,t){return F.resolve(e,t)}replace(e){this.clientVisit(e,{replace:!0})}replaceProp(e,t,n){this.replace({preserveScroll:!0,preserveState:!0,props(n){let r=typeof t==`function`?t(P(n,e),n):t;return He(N(n),e,r)},...n||{}})}appendToProp(e,t,n){this.replaceProp(e,(e,n)=>{let r=typeof t==`function`?t(e,n):t;return Array.isArray(e)||(e=e===void 0?[]:[e]),[...e,r]},n)}prependToProp(e,t,n){this.replaceProp(e,(e,n)=>{let r=typeof t==`function`?t(e,n):t;return Array.isArray(e)||(e=e===void 0?[]:[e]),[r,...e]},n)}push(e){this.clientVisit(e)}flash(e,t){let n=F.get().flash,r;if(typeof e==`function`)r=e(n);else if(typeof e==`string`)r={...n,[e]:t};else if(e&&Object.keys(e).length)r={...n,...e};else return;F.setFlash(r),Object.keys(r).length&&Xt(r)}clientVisit(e,{replace:t=!1}={}){this.clientVisitQueue.add(()=>this.performClientVisit(e,{replace:t}))}performClientVisit(e,{replace:t=!1}={}){let n=F.get(),r=typeof e.props==`function`?Object.fromEntries(Object.values(n.onceProps??{}).map(e=>[e.prop,P(n.props,e.prop)])):{},i=typeof e.props==`function`?e.props(n.props,r):e.props??n.props,a=typeof e.flash==`function`?e.flash(n.flash):e.flash,{viewTransition:o,onError:s,onFinish:c,onFlash:l,onSuccess:u,...d}=e,f={...n,...d,flash:a??{},props:i},p=Cr.resolvePreserveOption(e.preserveScroll??!1,f),m=Cr.resolvePreserveOption(e.preserveState??!1,f),h=this.createVisitId();return F.set(f,{replace:t,preserveScroll:p,preserveState:m,viewTransition:o,visitId:h}).then(()=>{Wt(F.get(),{replace:t,visitId:h});let n=F.get().flash;Object.keys(n).length>0&&(Xt(n),l?.(n));let r=F.get().props.errors||{};if(Object.keys(r).length===0){u?.(F.get());return}let i=e.errorBag?r[e.errorBag||``]||{}:r;s?.(i)}).finally(()=>c?.(e))}performInstantSwap(e){let t=F.get(),n=Object.fromEntries((t.sharedProps??[]).filter(e=>e in t.props).map(e=>[e,t.props[e]])),r=typeof e.pageProps==`function`?e.pageProps(N(t.props),N(n)):e.pageProps,i=r===null?{...n}:{...r},a={component:e.component,url:e.url.pathname+e.url.search+e.url.hash,version:t.version,props:{...i,errors:{}},flash:{},rescuedProps:[],clearHistory:!1,encryptHistory:t.encryptHistory,sharedProps:t.sharedProps,rememberedState:{}};return F.set(a,{replace:e.replace,preserveScroll:Cr.resolvePreserveOption(e.preserveScroll,a),preserveState:!1,viewTransition:e.viewTransition,visitId:e.id})}getPrefetchParams(e,t){return{...this.getPendingVisit(e,{...t,async:!0,showProgress:!1,prefetch:!0,viewTransition:!1}),...this.getVisitEvents(t)}}createVisitId(){return nr()}getPendingVisit(e,t){if(Gn(e)){let n=e;e=n.url,t.method=t.method??n.method}let n=Pt.get(`visitOptions`),r=n&&n(e.toString(),N(t))||{},i={method:`get`,data:{},replace:!1,preserveScroll:!1,preserveState:!1,only:[],except:[],headers:{},errorBag:``,forceFormData:!1,queryStringArrayFormat:`brackets`,async:!1,showProgress:!0,fresh:!1,reset:[],preserveUrl:!1,preserveErrors:!1,prefetch:!1,invalidateCacheTags:[],viewTransition:!1,component:null,pageProps:null,cached:!1,...un(t),...un(r)},[a,o]=zn(e,i.data,i.method,i.forceFormData,i.queryStringArrayFormat),s={id:this.createVisitId(),cancelled:!1,completed:!1,interrupted:!1,...i,url:a,data:o};return s.prefetch&&(s.headers.Purpose=`prefetch`),s}getVisitEvents(e){return{onCancelToken:e.onCancelToken||Mr,onBefore:e.onBefore||Mr,onBeforeUpdate:e.onBeforeUpdate||Mr,onStart:e.onStart||Mr,onProgress:e.onProgress||Mr,onFinish:e.onFinish||Mr,onCancel:e.onCancel||Mr,onSuccess:e.onSuccess||Mr,onError:e.onError||Mr,onHttpException:e.onHttpException||Mr,onNetworkError:e.onNetworkError||Mr,onFlash:e.onFlash||Mr,onPrefetched:e.onPrefetched||Mr,onPrefetching:e.onPrefetching||Mr}}applyOptimisticUpdate(e,t){let n=F.get().props,r=e(N(n));if(!r)return;let i=[];for(let e of Object.keys(r))he(n[e],r[e])||i.push(e);if(i.length===0)return;let a=F.nextOptimisticId(),o=F.get().component;for(let e of i)F.setBaseline(e,N(n[e]));F.registerOptimistic(a,e),F.setPropsQuietly({...n,...r});let s=!0,c=t.onSuccess;t.onSuccess=e=>(s=!1,c(e));let l=t.onFinish;t.onFinish=e=>{if(F.unregisterOptimistic(a),s&&F.get().component===o){let e=F.replayOptimistics();Object.keys(e).length>0&&F.setPropsQuietly({...F.get().props,...e})}return F.pendingOptimisticCount()===0&&F.clearOptimisticState(),l(e)}}loadDeferredProps(e){e&&Object.values(e).forEach(e=>{this.doReload({only:e,deferredProps:!0,preserveErrors:!0})})}},Pr=class{static createWayfinderCallback(...e){return()=>e.length===1?Gn(e[0])?e[0]:e[0]():{method:typeof e[0]==`function`?e[0]():e[0],url:typeof e[1]==`function`?e[1]():e[1]}}static parseUseFormArguments(...e){return e.length===0?{rememberKey:null,data:{},precognitionEndpoint:null}:e.length===1?{rememberKey:null,data:e[0],precognitionEndpoint:null}:e.length===2?typeof e[0]==`string`?{rememberKey:e[0],data:e[1],precognitionEndpoint:null}:{rememberKey:null,data:e[1],precognitionEndpoint:this.createWayfinderCallback(e[0])}:{rememberKey:null,data:e[2],precognitionEndpoint:this.createWayfinderCallback(e[0],e[1])}}static parseSubmitArguments(e,t){return e.length===3||e.length===2&&typeof e[0]==`string`?{method:e[0],url:e[1],options:e[2]??{}}:Gn(e[0])?{...e[0],options:e[1]??{}}:{...t(),options:e[0]??{}}}static mergeHeadersForValidation(e,t,n){let r=e=>(e.headers={...n??{},...e.headers??{}},e);return e&&typeof e==`object`&&!(`target`in e)?e=r(e):t&&typeof t==`object`?t=r(t):typeof e==`string`?t=r(t??{}):e=r(e??{}),[e,t]}};function Fr(e){return e.includes(`.`)?e.replace(/\\\./g,`__ESCAPED_DOT__`).split(/(\[[^\]]*\])/).filter(Boolean).map(e=>e.startsWith(`[`)&&e.endsWith(`]`)?e:e.split(`.`).reduce((e,t,n)=>n===0?t:`${e}[${t}]`)).join(``).replace(/__ESCAPED_DOT__/g,`.`):e}function Ir(e){let t=[],n=/([^\[\]]+)|\[(\d*)\]/g,r;for(;(r=n.exec(e))!==null;)r[1]===void 0?r[2]!==void 0&&t.push(r[2]===``?``:Number(r[2])):t.push(r[1]);return t}function Lr(e,t,n){let r=e;for(let e=0;e/^\d+$/.test(e)).map(Number).sort((e,t)=>e-t);return t.length===n.length&&n.length>0&&n[0]===0&&n.every((e,t)=>e===t)}function zr(e){if(Array.isArray(e))return e.map(zr);if(typeof e!=`object`||!e||wn(e))return e;if(Rr(e)){let t=[];for(let n=0;n/^\d+$/.test(e)).map(Number).sort((e,t)=>e-t);He(t,n,e.length>0?[...e.map(e=>i[e]),r]:[r])}else He(t,n,[r]);continue}Lr(t,e.map(String),r)}return zr(t)}var Vr=`server`;function Hr(e,t){return e.match(/\sdata-inertia(=|\s|>)/)?e:e.replace(/^<([a-zA-Z][^\s/>]*)/,`<$1 data-inertia="server-head-${t}"`)}function Ur(e,t){if(!t)return[];let n=typeof t==`function`?t(e):e.props[t===!0?`head`:t];return Array.isArray(n)?n.map(e=>typeof e==`string`?e.trim():e).filter(e=>typeof e==`string`&&e.length>0).map(Hr):[]}var Wr={buildDOMElement(e){let t=document.createElement(`template`);t.innerHTML=e;let n=t.content.firstChild;if(!e.startsWith(`