1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,320557,e=>{"use strict";var t=e.i(290032);let r=(e,t)=>({scope:"project-site"===e||"site"===e?"site":e,...t?{projectId:t}:{}}),i=(e,t,i)=>({...t,...r(e,i)});async function s(e,r,i){return(await t.axios.post("/products/imports/sign",{filename:e.name,mimeType:e.type,size:e.size,owner:r,...i?{projectId:i}:{}},{showMessage:!1})).data.data}async function a(e){let r;return(await t.axios.post((r=e,`/products/imports/${r}/start`),void 0,{showMessage:!1})).data.data}async function n(e){return(await t.axios.post("/products/imports/statuses",{ids:e},{showMessage:!1})).data.data}e.s(["createProductItinerarySignedUpload",0,s,"deleteManagedItineraries",0,(e,r,s)=>t.axios.patch("/products/delete",i(e,r,s)),"fetchManagedItineraries",0,(e,i,s)=>{let a;return t.axios.get("/products/my_itineraries",(a=i?.params??{},{...i,params:{...a,...r(e,s)}}))},"fetchProductInfo",0,(e,r)=>{let i;return t.axios.get((i=e,`/products/info/${i}`),r)},"fetchProductItineraryImports",0,n,"startProductItineraryImport",0,a,"updateManagedItinerary",0,(e,r,s,a)=>{let n;return t.axios.patch((n=e,`/products/list/update/${n}`),i(r,s,a))},"updateManagedItineraryStatus",0,(e,r,s)=>t.axios.patch("/products/status/update",i(e,r,s)),"updateProduct",0,(e,r,i)=>{let s;return t.axios.post((s=e,`/products/update/${s}`),r,i)}])},779158,e=>{"use strict";var t=e.i(281919),r=e.i(758680);let i=(0,r.createContext)(!1);e.s(["PortalModeProvider",0,function(e){let{isPortal:r,children:s}=e;return(0,t.jsx)(i.Provider,{value:r,children:s})},"useIsPortalMode",0,function(){return(0,r.useContext)(i)}])},743664,e=>{"use strict";var t=e.i(281919),r=e.i(758680),i=e.i(530852),s=e.i(97618),a=e.i(861107),n=e.i(324378),o=e.i(375110),u=e.i(41954);let l=e=>(0,t.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,t.jsx)("g",{clipPath:"url(#clip0_11845_123385)",children:(0,t.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 2V8.5C12 8.89782 12.158 9.27936 12.4393 9.56066C12.7206 9.84196 13.1022 10 13.5 10H20V20C20 20.5304 19.7893 21.0391 19.4142 21.4142C19.0391 21.7893 18.5304 22 18 22H6C5.46957 22 4.96086 21.7893 4.58579 21.4142C4.21071 21.0391 4 20.5304 4 20V4C4 3.46957 4.21071 2.96086 4.58579 2.58579C4.96086 2.21071 5.46957 2 6 2H12ZM11.011 11.848C10.7714 13.371 9.97498 14.7508 8.776 15.72C7.889 16.436 8.7 17.841 9.764 17.432C11.2029 16.8781 12.7961 16.8781 14.235 17.432C15.299 17.842 16.11 16.437 15.223 15.72C14.0241 14.7507 13.2277 13.371 12.988 11.848C12.811 10.722 11.188 10.721 11.011 11.848ZM12 14.303L12.806 15.697H11.196L12 14.303ZM14 2.043C14.3789 2.12336 14.7263 2.31199 15 2.586L19.414 7C19.688 7.27373 19.8766 7.62112 19.957 8H14V2.043Z",fill:"#F44336"})}),(0,t.jsx)("defs",{children:(0,t.jsx)("clipPath",{id:"clip0_11845_123385",children:(0,t.jsx)("rect",{width:"24",height:"24",fill:"white"})})})]});e.i(555172);var c=e.i(975461),d=e.i(860684);e.i(622183);var h=e.i(616737),p=e.i(860850),f=e.i(792672),m=e.i(329654),g=e.i(320557);let y=(e,t,r,i)=>{if("portal"===e.destination.scope){r.invalidateQueries({queryKey:["itineraries",t.id]}),e.destination.portalSlug&&(r.invalidateQueries({queryKey:["portal-itineraries",e.destination.portalSlug]}),r.invalidateQueries({queryKey:["portal-dashboard",e.destination.portalSlug]}));return}"project"===e.destination.scope||i?r.invalidateQueries({queryKey:["itineraries",t.id,"project"]}):r.invalidateQueries({queryKey:["itineraries",t.id,"channel-t"]})};e.s(["UploadStatus",0,function(){let{queue:e,update:v,remove:w,clear:b,set:x}=(0,i.useUploadQueue)(),[j,C]=(0,r.useState)(!0),[I,N]=(0,r.useState)(!0),{t:k}=(0,h.useTranslations)(),q=(0,p.useUser)(),M=(0,f.useQueryClient)(),E=(0,r.useRef)(new Set),Q=(0,r.useRef)(!1),P=(0,r.useCallback)(e=>{switch(e){case"content":return k("home-page.upload.error-content");case"ai":return k("home-page.upload.error-ai");default:return k("home-page.upload.error-upload")}},[k]);(0,r.useEffect)(()=>{0===e.length||!q.query.isLoading&&(q.user||b())},[q,e,b]);let S=(0,r.useCallback)(async e=>{if("pending"!==e.status)return;let t=e.payload.get("file");if(!(t instanceof File))return void v({id:e.id,status:"error"});v({id:e.id,status:"uploading"});let r="upload";try{let i="portal"===e.destination.scope?await (0,m.createPortalItinerarySignedUpload)(e.destination.portalSlug??"",t,e.payload.has("uploadDestination")?{destination:String(e.payload.get("uploadDestination")),includeWebsite:"true"===e.payload.get("includeWebsite")}:void 0):await (0,g.createProductItinerarySignedUpload)(t,"project"===e.destination.scope?"project":"user",e.destination.projectId),s=await fetch(i.uploadUrl,{method:"PUT",headers:i.headers,body:t});if(!s.ok)throw Error(`Upload failed with status ${s.status}`);r="ai";let a="portal"===e.destination.scope?await (0,m.startPortalItineraryImport)(e.destination.portalSlug??"",i.importId):await (0,g.startProductItineraryImport)(i.importId),n=i.projectId??e.destination.projectId;if("completed"===a.status){v({id:e.id,status:"success",uri:a.itineraryGroupId??a.id,projectId:n}),q.user&&y(e,q.user,M);return}v({id:e.id,status:"queued"===a.status?"queued":"processing",importId:i.importId,projectId:n})}catch(a){let t=(0,s.isAxiosError)(a)?a.response:void 0,i="ai"===r&&(t?.status===422||t?.data?.errorCode==="invalid_itinerary_content"||t?.data?.data?.errorType==="content")?"content":r;v({id:e.id,status:"error",errorType:i,errorMessage:"upload"===i?P(i):t?.data?.msg||P(i)})}},[P,M,v,q.user]);(0,r.useEffect)(()=>{let t=e.filter(e=>"pending"===e.status);if(0!==t.length)for(let e of(C(!1),N(!1),t))E.current.has(e.id)||(E.current.add(e.id),S(e))},[e,S]);let O=(0,r.useCallback)(async(e,t)=>
1{if("completed"===t.status){v({id:e.id,status:"success",uri:t.itineraryGroupId??t.id,projectId:t.projectId??e.destination.projectId}),q.user&&y(e,q.user,M,t.projectId??e.destination.projectId);return}if("failed"===t.status){let r="content"===t.errorType?"content":"ai";v({id:e.id,status:"error",errorType:r,errorMessage:P(r)});return}("queued"===t.status||"processing"===t.status)&&e.status!==t.status&&v({id:e.id,status:t.status})},[P,M,v,q.user]);return(0,r.useEffect)(()=>{if(0===e.filter(e=>("queued"===e.status||"processing"===e.status)&&e.importId).length||Q.current)return;Q.current=!0;let t=!1,r=async()=>{let e=i.useUploadQueue.getState().queue.filter(e=>("queued"===e.status||"processing"===e.status)&&e.importId);if(0===e.length){Q.current=!1;return}try{let t=new Map,r=[];for(let i of e)if("portal"===i.destination.scope&&i.destination.portalSlug){let e=t.get(i.destination.portalSlug)??[];e.push(i),t.set(i.destination.portalSlug,e)}else r.push(i);let i=Array.from(t.entries()).map(async e=>{let[t,r]=e,i=await (0,m.fetchPortalItineraryImports)(t,r.map(e=>e.importId)),s=new Map(i.map(e=>[e.id,e]));await Promise.all(r.map(e=>{let t=s.get(e.importId);return t?O(e,t):void 0}))});r.length>0&&i.push((0,g.fetchProductItineraryImports)(r.map(e=>e.importId)).then(e=>{let t=new Map(e.map(e=>[e.id,e]));return Promise.all(r.map(e=>{let r=t.get(e.importId);return r?O(e,r):void 0}))})),await Promise.all(i)}finally{t||window.setTimeout(r,5e3)}};return r(),()=>{t=!0,Q.current=!1}},[e,O]),!I&&e.filter(e=>"deleting"!==e.status).length>0&&(0,t.jsxs)("div",{className:"max-w-90 flex-auto min-w-0 z-51 rounded-t-2xl bg-white shadow-[0_4px_10px_0_rgba(0,0,0,0.25)]",children:[(0,t.jsxs)("div",{className:"p-4 bg-btn-primary flex flex-row gap-4 rounded-t-2xl text-white",children:[(0,t.jsx)("p",{className:"text-[1rem]/[1.25] font-bold flex-1",children:k("home-page.upload-status")}),(0,t.jsx)("button",{type:"button",onClick:()=>C(!j),className:"cursor-pointer","aria-label":"Minimize upload widget",children:(0,t.jsx)(o.ChevronDown,{className:`size-6 ${j?"rotate-180":""} transition-transform duration-300`})}),(0,t.jsx)("button",{type:"button",onClick:()=>void(N(!0),x(e.filter(e=>"success"!==e.status))),className:"cursor-pointer","aria-label":"Close upload widget",children:(0,t.jsx)(u.X,{className:"size-6"})})]}),!j&&(0,t.jsx)("div",{className:"max-h-70 overflow-y-auto",children:(0,t.jsx)("div",{className:"flex flex-col-reverse gap-0",children:e.map(e=>{let r="portal"===e.destination.scope?e.destination.projectName||"Portal":"project"===e.destination.scope?e.destination.projectName||k("home-page.upload.projectb2b"):k("home-page.upload.b2b");switch(e.status){case"deleting":return null;case"success":return(0,t.jsx)("div",{className:"group h-14 relative hover:cursor-pointer hover:bg-btn-sunset-mist px-4 py-2.5 overflow-hidden",children:(0,t.jsxs)(a.default,{href:(e=>{if("portal"===e.destination.scope)return e.destination.portalSlug?`/workspaces
1/${e.destination.portalSlug}/itineraries?tab=${"channel-t"===e.destination.audience?"channel-t":"storefront"}`:"/";if(e.uploaderIdentity.startsWith("project:")){let t=e.uploaderIdentity.replace("project:","")||e.destination.projectId;return`/my-itineraries?tab=channel-t&project=${t}`}return e.destination.projectId?`/my-itineraries?tab=channel-t&project=${e.destination.projectId}`:"/my-itineraries?tab=channel-t"})(e),className:"relative h-full w-full flex flex-row items-center justify-between gap-1 overflow-hidden bg-transparent text-left appearance-none",onClick:()=>w(e.id),title:e.name,children:[(0,t.jsx)(l,{className:"size-6 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 h-full group/text overflow-hidden relative mr-2",children:[(0,t.jsx)("p",{className:"whitespace-nowrap overflow-hidden text-ellipsis absolute inset-0 group-hover/text:[transform:translateY(-100%)] transition-transform duration-700 ease-quint-out leading-9",children:e.name}),(0,t.jsxs)("div",{className:"absolute inset-0 text-[14px]/[18px] [transform:translateY(100%)] group-hover/text:[transform:translateY(0%)] transition-transform duration-700 ease-quint-out",children:[k("home-page.upload.upload-to"),(0,t.jsx)("br",{}),(0,t.jsx)("span",{className:"font-bold text-[12px]/[18px]",children:r})]})]}),(0,t.jsx)(d.SuccessTick,{className:"size-6 shrink-0 group-hover:[transform:opacity-100] transition-transform duration-500"})]})},e.id);case"error":{let r=e.errorType??"upload",i=e.errorMessage||P(r);return(0,t.jsxs)("div",{className:"px-4 py-2.5 min-h-14 hover:bg-btn-sunset-mist flex flex-row justify-between items-start gap-2 cursor-pointer",onClick:()=>w(e.id),title:i,children:[(0,t.jsx)(l,{className:"mt-0.5 size-6 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)("p",{className:"truncate text-sm",children:e.name}),(0,t.jsx)("p",{className:"whitespace-normal break-words text-xs text-red-600",children:i})]}),(0,t.jsx)(c.FailureCross,{className:"mt-0.5 size-6 shrink-0"})]},e.id)}default:return(0,t.jsxs)("div",{className:"px-4 py-2.5 h-14 hover:bg-btn-sunset-mist flex flex-row justify-between items-center gap-1",title:e.name,children:[(0,t.jsx)(l,{className:"size-6 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 h-full group/text overflow-hidden relative mr-2",children:[(0,t.jsx)("p",{className:"whitespace-nowrap overflow-hidden text-ellipsis absolute inset-0 group-hover/text:[transform:translateY(-100%)] transition-transform duration-700 ease-quint-out leading-9",children:e.name}),(0,t.jsxs)("div",{className:"absolute inset-0 text-[14px]/[18px] [transform:translateY(100%)] group-hover/text:[transform:translateY(0%)] transition-transform duration-700 ease-quint-out",children:[k("home-page.upload.upload-to"),(0,t.jsx)("br",{}),(0,t.jsx)("span",{className:"font-bold text-[12px]/[18px]",children:r})]})]}),(0,t.jsx)(n.Loader2Icon,{className:"size-6 shrink-0 animate-spin stroke-btn-primary"}),"uploading"===e.status&&(0,t.jsx)("p",{className:"text-neutral-light whitespace-nowrap",children:"æªæ¡ä¸å³ä¸"}),"queued"===e.status&&(0,t.jsx)("p",{className:"text-neutral-light whitespace-nowrap",children:"çå¾
è§£æä¸"}),"processing"===e.status&&(0,t.jsx)("p",{className:"text-neutral-light whitespace-nowrap",children:"AIè§£æä¸"})]},e.id)}})})})]})}],743664)},260307,e=>{"use strict";e.i(715090);var t=e.i(281919),r=e.i(229634),i=e.i(482260),s=e.i(804466),a=e.i(985652),n=class extends a.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,s){let a=t.queryKey,n=t.queryHash??(0,r.hashQueryKeyByOptions)(a,t),o=this.get(n);return o||(o=new i.Query({client:e,queryKey:a,queryHash:n,options:e.defaultQueryOptions(t),state:s,defaultOptions:e.getQueryDefaults(a)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){s.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,r.matchQuery)(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,r.matchQuery)(e,t)):t}notify(e){s.notifyManager.batch(()=>
1{this.listeners.forEach(t=>{t(e)})})}onFocus(){s.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){s.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},o=e.i(528135),u=a,l=class extends u.Subscribable{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#r=new Map,this.#i=0}#t;#r;#i;build(e,t,r){let i=new o.Mutation({mutationCache:this,mutationId:++this.#i,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){this.#t.add(e);let t=c(e);if("string"==typeof t){let r=this.#r.get(t);r?r.push(e):this.#r.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#r.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#r.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#r.get(t),i=r?.find(e=>"pending"===e.state.status);return!i||i===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#r.get(t)?.find(t=>
1t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){s.notifyManager.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#r.clear()})}getAll(){return Array.from(this.#t)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,r.matchMutation)(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(t=>(0,r.matchMutation)(e,t))}notify(e){s.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return s.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(r.noop))))}};function c(e){return e.options.scope?.id}var d=e.i(729838),h=e.i(862734),p=e.i(890567),f=class{#s;#a;#n;#o;#u;#l;#c;#d;constructor(e={}){this.#s=e.queryCache||new n,this.#a=e.mutationCache||new l,this.#n=e.defaultOptions||{},this.#o=new Map,this.#u=new Map,this.#l=0}mount(){this.#l++,1===this.#l&&(this.#c=d.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#s.onFocus())}),this.#d=h.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#s.onOnline())}))}unmount(){this.#l--,0===this.#l&&(this.#c?.(),this.#c=void 0,this.#d?.(),this.#d=void 0)}isFetching(e){return this.#s.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#a.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#s.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),i=this.#s.build(this,t),s=i.state.data;return void 0===s?this.fetchQuery(e):(e.revalidateIfStale&&i.isStaleByTime((0,r.resolveStaleTime)(t.staleTime,i))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return this.#s.findAll(e).map(e=>{let{queryKey:t,state:r}=e;return[t,r.data]})}setQueryData(e,t,i){let s=this.defaultQueryOptions({queryKey:e}),a=this.#s.get(s.queryHash),n=a?.state.data,o=(0,r.functionalUpdate)(t,n);if(void 0!==o)return this.#s.build(this,s).setData(o,{...i,manual:!0})}setQueriesData(e,t,r){return s.notifyManager.batch(()=>this.#s.findAll(e).map(e=>{let{queryKey:i}=e;return[i,this.setQueryData(i,t,r)]}))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#s.get(t.queryHash)?.state}removeQueries(e){let t=this.#s;s.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#s;return s.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={revert:!0,...t};return Promise.all(s.notifyManager.batch(()=>this.#s.findAll(e).map(e=>e.cancel(i)))).then(r.noop).catch(r.noop)}invalidateQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return s.notifyManager.batch(()=>(this.#s.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(s.notifyManager.batch(()=>this.#s.findAll(e).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,i);return i.throwOnError||(t=t.catch(r.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(r.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let i=this.#s.build(this,t);return i.isStaleByTime((0,r.resolveStaleTime)(t.staleTime,i))?i.fetch(t):Promise.resolve(i.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(r.noop).catch(r.noop)}fetchInfiniteQuery(e){return e.behavior=(0,p.infiniteQueryBehavior)(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(r.noop).catch(r.noop)}ensureInfiniteQueryData(e){return e.behavior=(0,p.infiniteQueryBehavior)(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return h.onlineManager.isOnline()?this.#a.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#s}getMutationCache(){return this.#a}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#o.set((0,r.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#o.values()],i={};return t.forEach(t=>{(0,r.partialMatchKey)(e,t.queryKey)&&Object.assign(i,t.defaultOptions)}),i}setMutationDefaults(e,t){this.#u.set((0,r.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#u.values()],i={};return t.forEach(t=>{(0,r.partialMatchKey)(e,t.mutationKey)&&Object.assign(i,t.defaultOptions)}),i}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,r.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===r.skipToken&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#s.clear(),this.#a.clear()}},m=e.i(792672);let g=new f;e.s(["QueryClientProvider",0,e=>{let{children:r}=e;return(0,t.jsxs)(m.QueryClientProvider,{client:g,children:[r,!1]})}],260307)},463226,e=>{"use strict";
1var t=e.i(758680),r=e.i(792672);e.i(622183);var i=e.i(860850),s=e.i(845886);let a="browser-notification-shown:",n="browser-notification-permission",o="/favicon.ico",u="browser-notification-client-tab-id",l=e=>{localStorage.setItem(`${a}${e}`,Date.now().toString())},c=e=>{let{userId:t,userName:r,userAvatar:i}=e;t&&window.dispatchEvent(new CustomEvent("chat-notification-open",{detail:{userId:t,userName:r,userAvatar:i}}))},d=async e=>{let{id:t,title:r,body:i,icon:n,clickUrl:o,onClick:u,notificationData:c,serviceWorkerRegistration:d}=e;if(!("Notification"in window)||"granted"!==Notification.permission||null!==localStorage.getItem(`${a}${t}`))return!1;try{let e=new Notification(r,{body:i,icon:n,tag:t});return e.onclick=()=>{window.focus(),u?u():o&&(window.location.href=o),e.close()},l(t),!0}catch(e){try{let s=d??("u">typeof navigator&&"serviceWorker"in navigator?await navigator.serviceWorker.ready:null);if(!s)throw e;return await s.showNotification(r,{body:i,icon:n,tag:t,data:c??(o?{url:o}:void 0)}),l(t),!0}catch(t){return console.error("Failed to display browser notification:",{pageNotificationError:e,serviceWorkerNotificationError:t}),s.error("ç覽å¨éç¥é¡¯ç¤ºå¤±æï¼è«æª¢æ¥ç³»çµ±éç¥è¨å®",{id:"browser-notification-failure"}),!1}}};e.s(["BrowserNotificationsProvider",0,function(e){let{children:a}=e,l=(0,r.useQueryClient)(),{user:h}=(0,i.useUser)(),p=(0,t.useRef)(!1),f=(0,t.useRef)(null),m=(0,t.useRef)((()=>{let e=window.sessionStorage.getItem(u);if(e)return e;let t="u">typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return window.sessionStorage.setItem(u,t),t})());return(0,t.useEffect)(()=>{"serviceWorker"in navigator&&"Notification"in window&&navigator.serviceWorker.register("/browser-notifications-sw.js").then(e=>{f.current=e;let t=()=>{if(!m.current)return;let t=e.active??e.waiting??e.installing??navigator.serviceWorker.controller;t?.postMessage({type:"REGISTER_CLIENT_TAB",clientTabId:m.current})},r=()=>{e.waiting?.postMessage({type:"SKIP_WAITING"})};r(),t(),e.addEventListener("updatefound",()=>{let i=e.installing;i&&i.addEventListener("statechange",()=>{"installed"===i.state&&r(),"activated"===i.state&&t()})})}).catch(e=>{console.error("Failed to register browser notifications service worker:",e)})},[]),(0,t.useEffect)(()=>{if(!("serviceWorker"in navigator))return;let e=()=>{m.current&&navigator.serviceWorker.controller&&navigator.serviceWorker.controller.postMessage({type:"REGISTER_CLIENT_TAB",clientTabId:m.current})};e();let t=e=>{e.data?.type==="open-chat"&&c({userId:Number(e.data.userId),userName:"string"==typeof e.data.userName?e.data.userName:void 0,userAvatar:"string"==typeof e.data.userAvatar?e.data.userAvatar:void 0})};return navigator.serviceWorker.addEventListener("controllerchange",e),navigator.serviceWorker.addEventListener("message",t),()=>{navigator.serviceWorker.removeEventListener("controllerchange",e),navigator.serviceWorker.removeEventListener("message",t)}},[]),(0,t.useEffect)(()=>{if(!h?.id||!("Notification"in window))return;if("granted"===Notification.permission)return void s.dismiss(n);if("default"!==Notification.permission){"denied"===Notification.permission&&s.dismiss(n);return}let e=async()=>{let t=await Notification.requestPermission();s.dismiss(n),"denied"===t&&s.error("ç覽å¨éç¥å·²è¢«å°éï¼è«å°ç¶²ååçç¶²ç«æ¬éä¸éæ°éå"),window.removeEventListener("click",e),window.removeEventListener("touchend",e),window.removeEventListener("keydown",e)};return p.current||(p.current=!0,s.prompt("éåç覽å¨éç¥",{id:n,duration:1/0,description:"å
è¨±å¾æè½å¨åæåé æç¸®å°è¦çªææ¶å°è天è系統éç¥",action:{label:"å
許",onClick:()=>{e()}},cancel:{label:"ç¨å¾",onClick:()=>{s.dismiss(n)}}})),window.addEventListener("click",e,{once:!0}),window.addEventListener("touchend",e,{once:!0}),window.addEventListener("keydown",e,{once:!0}),()=>{window.removeEventListener("click",e),window.removeEventListener("touchend",e),window.removeEventListener("keydown",e)}},[h?.id]),(0,t.useEffect)(()=>
1{if(!h?.id)return;let e=e=>{let t=e.detail,r=Number(h.id),i=Number(t?.sender_id);if(!t||!t.message&&!t.content||!Number.isNaN(i)&&i===r)return;let s=t.sender?.user_name||"æ°è¨æ¯",a=t.sender?.avatarUrl||t.sender?.avatar,n=t.message||t.content||"",u=(e=>{let{senderId:t,senderName:r,senderAvatar:i}=e;if(!t)return;let s=new URL(window.location.href);return s.searchParams.set("chat","open"),s.searchParams.set("chatUserId",String(t)),r&&s.searchParams.set("chatUserName",r),i&&s.searchParams.set("chatUserAvatar",i),`${s.pathname}${s.search}${s.hash}`})({senderId:i,senderName:s,senderAvatar:a});d({id:`chat:${t.id??`${t.sender_id}:${t.created_at}`}`,title:"Channel-T",body:[s,n].filter(Boolean).join("\n"),icon:a||o,clickUrl:u,onClick:()=>{c({userId:i,userName:s,userAvatar:a})},notificationData:{type:"open-chat",clientTabId:m.current,userId:i,userName:s,userAvatar:a,url:u},serviceWorkerRegistration:f.current})},t=e=>{let t=e.detail;if(!t?.uuid)return;l.invalidateQueries({queryKey:["notifications",h.id]});let r=(e=>{switch(e.notificationType){case"products":return"published"===e.status?`/itinerary-information/${e.notificationId}`:void 0;case"project":default:return e.link??void 0;case"order":return"payment_successfully"===e.status?"/account/purchase-history?tab=paid":"/account/purchase-history?tab=unpaid";case"payment":return"success"===e.status?"/account/purchase-history?tab=paid":"/account/purchase-history?tab=unpaid";case"bookingapplication":return e.link??"/booking-applications"}})(t);d({id:`notify:${t.uuid}`,title:"Channel-T éç¥",body:t.msg,icon:o,clickUrl:r,onClick:r?()=>{window.location.href=r}:void 0,serviceWorkerRegistration:f.current})};return window.addEventListener("websocket-message",e),window.addEventListener("websocket-notification",t),()=>{window.removeEventListener("websocket-message",e),window.removeEventListener("websocket-notification",t)}},[l,h?.id]),a}])},203484,e=>{"use strict";var t=e.i(281919),r=e.i(758680),i=(e,t,r,i,s,a,n,o)=>{let u=document.documentElement,l=["light","dark"];function c(t){var r;(Array.isArray(e)?e:[e]).forEach(e=>{let r="class"===e,i=r&&a?s.map(e=>a[e]||e):s;r?(u.classList.remove(...i),u.classList.add(t)):u.setAttribute(e,t)}),r=t,o&&l.includes(r)&&(u.style.colorScheme=r)}if(i)c(i);else try{let e=localStorage.getItem(t)||r,i=n&&"system"===e?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e;c(i)}catch(e){}},s=r.createContext(void 0),a={setTheme:e=>{},themes:[]};r.memo(e=>{let{forcedTheme:t,storageKey:s,attribute:a,enableSystem:n,enableColorScheme:o,defaultTheme:u,value:l,themes:c,nonce:d,scriptProps:h}=e,p=JSON.stringify([a,s,u,t,c,l,n,o]).slice(1,-1);return r.createElement("script",{...h,suppressHydrationWarning:!0,nonce:"u"<typeof window?d:"",dangerouslySetInnerHTML:{__html:`(${i.toString()})(${p})`}})});var n=e.i(415448);e.s(["Toaster",0,e=>{var i;let{...o}=e,{theme:u="system"}=null!=(i=r.useContext(s))?i:a;return(0,t.jsx)(n.Toaster,{theme:u,className:"toaster group",toastOptions:{classNames:{toast:` 2 group toast 3 group-[.toaster]:bg-background 4 group-[.toaster]:text-foreground 5 group-[.toaster]:border-border 6 group-[.toaster]:shadow-lg 7 flex items-center justify-center text-center 8 `,description:` 9 group-[.toast]:text-muted-foreground 10 `,actionButton:` 11 group-[.toast]:bg-primary 12 group-[.toast]:text-primary-foreground 13 font-medium 14 `,cancelButton:` 15 group-[.toast]:bg-muted 16 group-[.toast]:text-muted-foreground 17 font-medium 18 `}},...o})}],203484)},403142,e=>{"use strict";var t=e.i(281919),r=e.i(758680),i=e.i(367725),s=e.i(927902);e.i(870561);var a=e.i(684740);e.i(622183);var n=e.i(860850),o=e.i(190629);let u=e=>{let{ticketMode:u=!1}=e,l=(0,i.usePathname)(),c=(0,r.useRef)(null),{setAISearchRef:d}=(0,s.useAIAssistantStore)(),{user:h}=(0,n.useUser)(),p=(0,r.useMemo)(()=>!(!u&&(0,o.isLoggedOutLandingPage)(l,!!h)||l?.startsWith("/accounts")||l?.startsWith("/news")),[h,l,u]);return(0,r.useEffect)(()=>{d(c)},[d]),(0,t.jsx)("div",{className:"z-10 mb-4 md:mb-6 xl:mb-10 mr-4 md:mr-6 xl:mr-10 shrink-0",children:p&&(0,t.jsx)(a.AISearchAssistant,{ref:c})})};var l=e.i(743664),c=e.i(986293);
18e.s(["FixedLayout",0,e=>{let{ticketMode:i=!1}=e,{showing:s}=(0,c.usePriceDeclarationStore)();return(0,t.jsx)(r.Suspense,{fallback:null,children:(0,t.jsxs)("div",{className:`${s&&"pb-[85px] md:pb-19"} fixed w-full pl-4 right-0 bottom-0 flex flex-row-reverse items-end gap-4 xl:gap-6 z-40 pointer-events-none [&>*]:pointer-events-auto`,children:[(0,t.jsx)(u,{ticketMode:i}),!i&&(0,t.jsx)(l.UploadStatus,{})]})})}],403142)},726333,e=>{"use strict";var t=e.i(281919),r=e.i(208701),i=e.i(758680);e.s(["PHProvider",0,function(e){let{children:s}=e;return(0,i.useEffect)(()=>{r.default.init("phc_q87sztzwvrRAGMUGuomtkuR6Nu9wAfNVpyatgjtXLCQR",{api_host:"https://us.i.posthog.com",autocapture:!1,capture_pageview:!0,loaded:e=>{e.register({env:"production"})}})},[]),(0,t.jsx)(t.Fragment,{children:s})}])}]);
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.