1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,889461,e=>{"use strict";let t=(0,e.i(369547).default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["CheckCircle2",0,t],889461)},277519,e=>{"use strict";let t=(0,e.i(369547).default)("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);e.s(["Tag",0,t],277519)},322138,e=>{"use strict";let t=(0,e.i(369547).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",0,t],322138)},161592,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"LoadableContext",{enumerable:!0,get:function(){return r}});let r=e.r(741705)._(e.r(191788)).default.createContext(null)},852414,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0}),Object.defineProperty(a,"default",{enumerable:!0,get:function(){return p}});let r=e.r(741705)._(e.r(191788)),l=e.r(161592),o=[],i=[],n=!1;function s(e){let t=e(),a={loading:!0,loaded:null,error:null};return a.promise=t.then(e=>(a.loading=!1,a.loaded=e,e)).catch(e=>{throw a.loading=!1,a.error=e,e}),a}class c{constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}}function d(t){return function(t,a){let s=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},a),d=null;function u(){if(!d){let e=new c(t,s);d={getCurrentValue:e.getCurrentValue.bind(e),subscribe:e.subscribe.bind(e),retry:e.retry.bind(e),promise:e.promise.bind(e)}}return d.promise()}if("u"<typeof window&&o.push(u),!n&&"u">typeof window){let t=s.webpack&&"function"==typeof e.t.resolveWeak?s.webpack():s.modules;t&&i.push(e=>{for(let a of t)if(e.includes(a))return u()})}function p(e,t){let a;u(),(a=r.default.useContext(l.LoadableContext))&&Array.isArray(s.modules)&&s.modules.forEach(e=>{a(e)});let o=r.default.useSyncExternalStore(d.subscribe,d.getCurrentValue,d.getCurrentValue);return r.default.useImperativeHandle(t,()=>({retry:d.retry}),[]),r.default.useMemo(()=>{var t;return o.loading||o.error?r.default.createElement(s.loading,{isLoading:o.loading,pastDelay:o.pastDelay,timedOut:o.timedOut,error:o.error,retry:d.retry}):o.loaded?r.default.createElement((t=o.loaded)&&t.default?t.default:t,e):null},[e,o])}return p.preload=()=>u(),p.displayName="LoadableComponent",r.default.forwardRef(p)}(s,t)}function u(e,t){let a=[];for(;e.length;){let r=e.pop();a.push(r(t))}return Promise.all(a).then(()=>{if(e.length)return u(e,t)})}d.preloadAll=()=>new Promise((e,t)=>{u(o).then(e,t)}),d.preloadReady=(e=[])=>new Promise(t=>{let a=()=>(n=!0,t());u(i,e).then(a,a)}),"u">typeof window&&(window.__NEXT_PRELOADREADY=d.preloadReady);let p=d},425167,(e,t,a)=>{"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r={default:function(){return u},noSSR:function(){return d}};for(var l in r)Object.defineProperty(a,l,{enumerable:!0,get:r[l]});let o=e.r(741705),i=e.r(391398);e.r(191788);let n=o._(e.r(852414)),s="u"<typeof window;function c(e){return{default:e?.default||e}}function d(e,t){if(delete t.webpack,delete t.modules,!s)return e(t);let a=t.loading;return()=>(0,i.jsx)(a,{error:null,isLoading:!0,pastDelay:!1,timedOut:!1})}function u(e,t){let a=n.default,r={loading:({error:e,isLoading:t,pastDelay:a})=>null};e instanceof Promise?r.loader=()=>e:"function"==typeof e?r.loader=e:"object"==typeof e&&(r={...r,...e});let l=(r={...r,...t}).loader;return(r.loadableGenerated&&(r={...r,...r.loadableGenerated},delete r.loadableGenerated),"boolean"!=typeof r.ssr||r.ssr)?a({...r,loader:()=>null!=l?l().then(c):Promise.resolve(c(()=>null))}):(delete r.webpack,delete r.modules,d(a,r))}("function"==typeof a.default||"object"==typeof a.default&&null!==a.default)&&void 0===a.default.__esModule&&(Object.defineProperty(a.default,"__esMo
1dule",{value:!0}),Object.assign(a.default,a),t.exports=a.default)},168489,(e,t,a)=>{t.exports=e.r(425167)},52130,301960,e=>{"use strict";e.i(221168);var t=e.i(646213),a=e.i(696249);e.i(190077);var r=e.i(722923);let l=async e=>{let a=r.default.apiConfig().headers;try{return(await r.default.axiosInstance.get("/enhancer/feedback-data",{headers:a,params:{tool_name:e}})).data.feedback[0]}catch(e){return(0,t.logger)("log",e),{}}},o=async e=>{try{return(await r.default.axiosInstance.post("/enhancer/user_activity",e,r.default.apiConfig())).data}catch(e){throw(0,t.logger)("log",e),e}};e.s(["getfeedbackQuestionaryBasedOnTool",0,l,"sendFeedback",0,o],301960);let i=async(e,t,a,l,o=!0)=>{let i=r.default.apiConfig().headers;try{return{...(await r.default.axiosInstance.get(`/web/api/v7/user_activity/order-status?orderId=${e}&from_cache=${o}`,{headers:i,signal:l})).data,sourceImg:t,inputPrompt:a}}catch(e){return e.message}},n=async e=>{try{return(await r.default.axiosInstance.get(`/app/api/static/fetch-tools-assets?activity=${e}`)).data.data}catch(e){return e.message}},s=async e=>{let t={replacer:[],remover:[],templates:[]},r={},o={},i={};switch(e){case a.PHOT_AI_TOOLS.BACKGROUND_REPLACER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REPLACER),r=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PHOT_PHOTOSHOOT);o[a.PHOT_AI_TOOLS.BACKGROUND_REPLACER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REPLACER),o[a.PHOT_AI_TOOLS.BACKGROUND_REMOVER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REMOVER),t={replacer:e,templates:r,remover:[]}}break;case a.PHOT_AI_TOOLS.AI_VECTOR_GENERATOR:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.IMAGE_VECTORIZER);o[a.PHOT_AI_TOOLS.AI_VECTOR_GENERATOR]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.IMAGE_VECTORIZER),t={replacer:e,templates:[],remover:[]}}break;case a.PHOT_AI_TOOLS.BACKGROUND_REMOVER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REMOVER);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REMOVER),t={replacer:e,templates:[],remover:[]}}break;case a.PHOT_AI_TOOLS.AI_BLUR_BACKGROUND:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BLUR_BACKGROUND);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BLUR_BACKGROUND),t={replacer:e,templates:[],remover:[]}}break;case a.PHOT_AI_TOOLS.PRODUCT_SHADOW:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PRODUCT_SHADOW);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PRODUCT_SHADOW),t={replacer:e,templates:[],remover:[]}}break;case a.PHOT_AI_TOOLS.PHOTO_EDITOR:t={replacer:await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PHOTO_EDITOR),templates:[],remover:[]},o[a.PHOT_AI_TOOLS.BACKGROUND_REPLACER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REPLACER),o[a.PHOT_AI_TOOLS.OBJECT_REMOVER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REMOVER),o[a.PHOT_AI_TOOLS.OBJECT_REPLACER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REPLACER);break;case a.PHOT_AI_TOOLS.OBJECT_REPLACER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REPLACER);i[a.PHOT_AI_TOOLS.OBJECT_REPLACER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REPLACER),i[a.PHOT_AI_TOOLS.OBJECT_REMOVER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REMOVER),t={replacer:e,remover:[],templates:[]}}break;case a.PHOT_AI_TOOLS.OBJECT_REMOVER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REMOVER);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.OBJECT_REMOVER),t={replacer:[],remover:e,templates:[]}}break;case a.PHOT_AI_TOOLS.AI_IMAGE_UPSCALER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.UPSCALER);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.UPSCALER),t={replacer:e,remover:[],templates:[]}}break;case a.PHOT_AI_TOOLS.AI_IMAGE_LIGHTFIXER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.LIGHTFIXER);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.LIGHTFIXER),t={replacer:e,remover:[],templates:[]}}break;case a.PHOT_AI_TOOLS.AI_PHOTO_COLORIZER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.COLORISER);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.COLORISER),t={replacer:e,remover:[],templates:[]}}break;case a.PHOT_AI_TOOLS.AI_PHOTO_ENHANCER:{let e=await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.AI_PHOTO_ENHANCER);r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.AI_PHOTO_ENHANCER),t={replacer:e,remover:[],templates:[]}}break;case a.PHOT_AI_TOOLS.PRODUCT_PHOTOGRAPHY:t={replacer:await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.AI_PRODUCT_PHOTOSHOOT),templates:await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PHOT_PHOTOSHOOT),remover:[]},o[a.PHOT_AI_TOOLS.BACKGROUND_REPLACER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.AI_PRODUCT_PHOTOSHOOT),o[a.PHOT_AI_TOOLS.BACKGROUND_REMOVER]=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.BACKGROUND_REMOVER);break;case a.PHOT_AI_TOOLS.AI_PHOTO_RESTORATION:t={replacer:await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.AI_OLD_PHOTO_RESTORATION),remover:[],templates:[]},r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.AI_OLD_PHOTO_RESTORATION);break;case a.PHOT_AI_TOOLS.AI_PHOTO_UNCROP:t={replacer:await n(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PHOTO_UNCROP),remover:[],templates:[]},r=await l(a.PHOT_AI_TRY_ONE_THESE_OPERATIONS.PHOTO_UNCROP);break;case a.PHOT_AI_TOOLS.AI_TEXTIFY:t={replacer:await n("AI_TEXTIFY"),remover:[],templates:[]},r=await l("TEXTIFY")}return{tryOneTheseFeatures:t,feedback:r,photo_editor:o,object_replacer:i}};e.s(["fetchOrderStatus",0,i,"getToolBasedTryNewFeatures",0,s,"getTryOfTheseForFree",0,n],52130)},474200,e=>{"use strict";var t=e.i(191788),a=e.i(696249),r=e.i(646213),l=e.i(698598),o=e.i(295605);let i=e=>"number"!=typeof e||e<=0?null:30===e||31===e?a.USER_PLAN_INTERVAL.MONTH:365===e||366===e?a.USER_PLAN_INTERVAL.YEAR:null,n=e=>e.displayName||e.planName||e.mode;e.s(["default",0,()=>{let{authState:e,userWorkspaceMode:i,currentTeamSubscriptionDetail
1s:n}=(0,t.useContext)(o.AuthContext),{user:s}=e,c=i||a.USER_TYPE.FREE,d=c===a.USER_TYPE.BASIC,u=c===a.USER_TYPE.CREATOR,p=c===a.USER_TYPE.UNLIMITED,m=c===a.USER_TYPE.STARTER,_=d||u||p||m,{priceData:O}=(0,t.useContext)(l.default),[g,T]=(0,t.useState)({cardArray:{month:[],year:[]},defaultCardSelectedCard:null,userType:null,userCurrentPlan:null,isDetectingUserCurrentPlan:!1,userCountry:{fromIndia:!1,isDetecting:!1}});return(0,t.useEffect)(()=>{let e,t,l,o,i;T(e=>({...e,isDetectingUserCurrentPlan:!0,userCountry:{...e.userCountry,isDetecting:!0}})),e=s&&s.lastPaymentCurrency?s.lastPaymentCurrency.toUpperCase()===a.CURRENCY.INR:(0,r.getCookie)(a.COOKIE_KEYS.COUNTRY)===a.COUNTRY_CODE.INDIA,l=Array.isArray(t=O.prices)?t.sort((e,t)=>e.price<t.price?-1:+(e.price>t.price)):[],o=(_?n?.interval:null)?{id:n?.planId,currencyCode:n?.currencyCode,currency:n?.currency,price:n?.amount,interval:n?.interval,mode:c}:null,i={[a.USER_PLAN_INTERVAL.MONTH]:[...l].filter(e=>e?.interval===a.USER_PLAN_INTERVAL.MONTH),[a.USER_PLAN_INTERVAL.YEAR]:[...l].filter(e=>e?.interval===a.USER_PLAN_INTERVAL.YEAR)},T(()=>({cardArray:i,userType:c,userCurrentPlan:o?{...o}:null,isDetectingUserCurrentPlan:!1,userCountry:{fromIndia:e,isDetecting:!1}}))},[s,O.prices,n,i]),{pricingDataV3:g}},"getInvalidTrialCouponMessage",0,e=>{let t=Array.from(new Set((e||[]).map(n))).filter(Boolean);return 0===t.length?"This coupon is valid for eligible trial plans only.":`This coupon is valid for ${t.length<=1?t[0]||"eligible":2===t.length?t.join(" or "):`${t.slice(0,-1).join(", ")}, or ${t[t.length-1]}`} trial ${1===t.length?"plan":"plans"} only.`},"getStandardTrialInterval",0,i,"getTrialCouponCreditsText",0,e=>{let t=e?.find(e=>"number"==typeof e.trial?.creditsPerSeat&&e.trial.creditsPerSeat>0),r=t?.trial;if(!r?.creditsPerSeat)return"";let l=`${r.creditsPerSeat.toLocaleString("en-IN")} ${1===r.creditsPerSeat?"credit":"credits"} per seat`,o=r.durationDays;if("number"==typeof o&&o>0){let e=i(o);return e?`You get ${l} for your ${e===a.USER_PLAN_INTERVAL.YEAR?"yearly":"monthly"} trial.`:`You get ${l} for your ${o}-day trial.`}return`You get ${l} for your trial.`},"isCustomTrialDuration",0,e=>"number"==typeof e&&e>0&&null===i(e),"isTrialCouponValidForPlanMode",0,(e,t)=>!t||(e||[]).some(e=>e?.mode===t)])},916704,e=>{"use strict";var t=e.i(191788),a=e.i(646213);let r=(0,t.createContext)({backgroundReplacerInputImageFile:[],backgroundRemovalTryOneOfThese:{replacer:[],templates:[],colors:[]},fabricCanvasEditor:{canvas:null,workArea:null,backgroundImage:"",activeObject:null,zoomRatio:null,objects:null,imageBbox:[]},setBackgroundRemovalTryOneOfThese:e=>(0,a.logger)("log",e),setBackgroundReplacerInputImageFile:e=>(0,a.logger)("log","dummy initializer",e),setFabricCanvasEditor:e=>(0,a.logger)("log","dummy initializer fabricCanvasData",e),isBgReplacerModalOpen:!1,setIsBgReplacerModalOpen:e=>(0,a.logger)("log","dummy initializer",e),showBgReplacerResults:!1,setShowBgReplacerResults:e=>(0,a.logger)("log","dummy initializer",e),showqueue:!1,setShowqueue:e=>(0,a.logger)("log","dummy initializer",e),zoomRatio:1,setZoomRatio:e=>(0,a.logger)("log","dummy initializer",e),containerRef:null,openUploadModal:!1,setOpenUploadModal:e=>(0,a.logger)("log","dummy initializer",e),openSearchTab:!1,setOpenSearchTab:e=>(0,a.logger)("log","dummy initializer",e),displaySelectedImage:!1,setDisplaySelectedImage:e=>(0,a.logger)("log","dummy initializer",e),removedBackgroundImage:[],setRemovedBackgroundImage:e=>(0,a.logger)("log",e),searchQuery:"",setSearchQuery:e=>(0,a.logger)("log",e),selectedImgNum:0,setSelectedImgNum:e=>(0,a.logger)("log",e),selectedImgArr:[],setSelectedImgArr:e=>(0,a.logger)("log",e),selectedImage:{},setSelectedImage:e=>(0,a.logger)("log","dummy initializer",e),selectedObject:{},setSelectedObject:e=>(0,a.logger)("log","dummy initializer",e),enableMultiSelect:!1,setEnableMultiSelect:e=>(0,a.logger)("log","dummy initializer",e),isDimensionsUpdated:!1,setIsDimensionsUpdated:e=>(0,a.logger)("log","dummy initializer",e),aiPromptsRecomendation:[],setAiPromptsRecomendation:e=>(0,a.logger)("log","dummy initializer",e),fetchingAiPrompt:!0,setFetchingAiPrompt:e=>(0,a.logger)("log","dummy initializer",e),promptLoadingCurrentMessage:"Understanding your product...",setPromptLoadingCurrentMessage:e=>(0,a.logger)("log","dummy initializer",e),promptFetchingProgress:0,setPromptFetchingProgress:e=>(0,a.logger)("log","dummy initializer",e),activeObjectId:void 0,setA
1ctiveObjectId:e=>(0,a.logger)("log","dummy initializer",e),bgReplacerFeedback:{},setBgReplacerFeedback:e=>(0,a.logger)("log","dummy initializer",e),deleteReplacerImage:!1,setDeleteReplacerImage:e=>(0,a.logger)("log","dummy initializer",e),aiTemplateRef:null,aiPromptRef:null,scrollContainerRef:null,colorsRef:null,isBgreplacerInputImageEnabled:!0,setIsBgreplacerInputImageEnabled:e=>(0,a.logger)("log","dummy initializer",e),isGeneratingOutput:!1,setIsGeneratingOutput:e=>(0,a.logger)("log","dummy initializer",e),mountedRef:null,frozenDimensions:null,setFrozenDimensions:e=>(0,a.logger)("log","dummy initializer",e),hasProcessedPromptRecommendations:null,selectedBgData:{prompt:"",enhancedOutput:!0,color:"",aiPrompt:!1},setSelectedBgData:e=>(0,a.logger)("log","dummy initializer",e)});e.s(["default",0,r])},979898,e=>{"use strict";var t=e.i(391398),a=e.i(191788);e.i(790747);var r=e.i(277037),l=e.i(271979),o=e.i(696249);let i={headerbanner:{bgColor:"linear-gradient(90deg, #05541F 0%, #085E1C 100%)"},header_left_img:"https://ai-image-editor-wasabi-bucket-prod-cdn.phot.ai/salesaleEvent/christmas_tree.webp",header_right_img:"https://ai-image-editor-wasabi-bucket-prod-cdn.phot.ai/salesaleEvent/snow_man.webp",headertext:{text:"ð
CHRISTMAS SALE!",color:"#fff",highlightInfo:{text:"SALE!",color:"#e82828"}},isSaleLive:!1,saleEvent:"christmas",timer:{till:{year:2024,month:12,date:25,hour:10,minute:30,seconds:0},color:"#fff",bgColor:"rgba(255,255,255,0.2)"},headercta:{text:"Get 50 % Off",bgColor:"#e82828",color:"#fff",couponValue:"PHOTXMAS"},popupUpperCard:{bgColor:"linear-gradient(180deg, #236737 0%, #203430 100%)"},popupLowerCard:{bgColor:"linear-gradient(174.23deg, #E90022 0.66%, #DE0020 33.31%, #C4001D 87.19%, #980018 157.39%, #940018 163.92%)"},popup_bg_img_link:"https://ai-image-editor-wasabi-bucket-prod-cdn.phot.ai/salesaleEvent/christmas.webp",popupcta:{text:"Choose Your Plan Now",bgColor:"#fff",color:"#db1020"},popupboldtext:{text:"Celebrate Xmas with 50% OFF on all plans",color:"#fff"},popupnormaltext:{text:"Limited Time Offer ",color:"#f9dddf"}},n=(e,t)=>{if("object"!=typeof e||"object"!=typeof t)return t;let a={...e};for(let r in t)null!==t[r]&&"object"==typeof t[r]?a[r]=n(e[r],t[r]):a[r]=t[r];return a};function s(e){try{return JSON.parse(e),!0}catch{return!1}}let c=(0,a.createContext)(void 0);e.s(["SaleStructureProvider",0,({children:e})=>{let[d,u]=(0,a.useState)(i);(0,a.useEffect)(()=>{(0,r.fetchAndActivate)(l.remoteConfig).then(()=>{let e=(0,r.getValue)(l.remoteConfig,o.FIREBASE_REMOTE_PARAMS.webappSaleStructure);try{let t=e.asString();if(s(t)){let e=JSON.parse(t),a=n(i,e);u(a)}}catch(e){console.error("Error parsing remote config parameter:",e)}}).catch(e=>console.error("Error activating remote config:",e))},[]);let p=new Date(d.timer.till.year,d.timer.till.month-1,d.timer.till.date,d.timer.till.hour,d.timer.till.minute,d.timer.till.seconds),m=new Date,_=d.isSaleLive&&p.getTime()-m.getTime()>0,O={...d,targetDate:p,isSaleLive:_};return(0,t.jsx)(c.Provider,{value:O,children:e})},"isValidJSON",0,s,"useSaleStructure",0,()=>{let e=(0,a.useContext)(c);if(!e)throw Error("useSaleStructure must be used within a SaleStructureProvider");return e}])},990207,e=>{"use strict";var t=e.i(722923);let a=async()=>{let e=t.default.apiConfig().headers;try{return(await t.default.axiosInstance.post("/app/api/v3/usage/list",{query:{transactionType:"DEBIT"},isCountOnly:!1},{headers:e})).data}catch(e){return e.message}},r=async e=>{try{let a={...t.default.apiConfig().headers,"x-user-current-workspace":e};return(await t.default.axiosInstance.post("/app/api/v7/payment/list",{},{headers:a})).data}catch(e){throw console.error("Error fetching payment list:",e),e}},l=async(e,a)=>{try{let r={...t.default.apiConfig().headers,"x-user-current-workspace":e};return(await t.default.axiosInstance.post("/app/api/v7/payment/cancel-subscription",a,{headers:r})).data}catch(e){throw console.error("Error canceling subscription:",e),e}},o=async({teamId:e,limit:a,skip:r})=>{let l={...t.default.apiConfig().headers,"x-user-current-workspace":e};try{let e=await t.default.axiosInstance.post("/app/api/v6/usage/list",{limit:a,skip:r},{headers:l});if(200===e.status)return e.data;throw Error("Failed to fetch usage list")}catch(e){throw console.error("Error fetching team usage list:",e),e}};e.s(["cancelTeamSubscription",0,l,"getTeamPaymentList",0,r,"getTeamUsageList",0,o,"getUsageHistory",0,a])},385887,567764,e=>{"use strict";e.s(["PaymentContext",()=>B,"default",()=>j,"usePayment",()=>G],385887);var t,a=e.i(391398),r=e.i(203828),l=e.i(191788),o=e.i(295605),i=e.i(698598),n=e.i(646213),s=e.i(422261),c=e.i(851619),d=e.i(696249),u=e.i(206236),p=e.i(706692),m=e.i(255425),_=e.i(74106),O=e.i(64189),g=e.i(52130),T=e.i(916704),E=e.i(74404),I=e.i(722923),S=e.i(605224),P=e.i(474200),A=e.i(677755),R=e.i(990207),f=e.i(251786),y=e.i(433779),w=e.i(898867),h=e.i(27249),C=e.i(31529);e.s(["CouponStage",()=>k,"default",()=>M],567764);var N=e.i(277519),b=e.i(889461),L=e.i(868462),H=e.i(322138),v=e.i(979898),x=e.i(386547),k=((t={}
1)[t.OfferTag=0]="OfferTag",t[t.InputField=1]="InputField",t[t.Loading=2]="Loading",t[t.CouponApplied=3]="CouponApplied",t[t.InvalidCoupon=4]="InvalidCoupon",t);let U="Invalid Coupon! Please try again",M=({pricingToolName:e,buyingPlanId:t,fromNudges:i,setIsShowLoginPopup:s,compactAppliedCoupon:c=!1})=>{let{entry:p,source:m}=(0,l.useContext)(E.default),{setToastState:_}=(0,l.useContext)(y.default),{annualProUser:O,authState:g}=(0,l.useContext)(o.AuthContext),T=(0,r.useRouter)(),{appliedCouponInfo:I,setAppliedCouponInfo:S,couponStage:A,setCouponStage:R,couponRef:f,setTeamSeats:w}=G(),{isSaleLive:h,headercta:k,saleEvent:M}=(0,v.useSaleStructure)(),{query:{code:D}}=T,[Y,B]=(0,l.useState)(!1),[,j]=(0,l.useState)({}),F=()=>j({}),V=(0,P.getTrialCouponCreditsText)(I.restrictedToPlans),z=async t=>{try{R(2),S({...I,isLoading:!0});let a=await (0,u.validateCouponPaddleService)({code:t});if(a?.status!==200)throw a;let r=await a.data,{percentOff:l,restrictedToPlans:o=[],isStripeTrial:i,promoId:s}=r?.data,O=(0,P.getTrialCouponCreditsText)(o);if(i){S({applied:!0,isLoading:!1,percentOff:0,promoId:s||t.trim(),promoCode:t.trim(),isStripeTrial:!0,restrictedToPlans:o,errorMessage:""}),(0,n.analyticsLogger)(d.PHOT_AI_ROUTES.PRICING,d.ANALYTICS_NAME_LIST.Coupon_Success,{source:m,tool:e,entry:p}),R(3),c&&_({isError:!1,isOpen:!0,message:O?`ð Wohoo! Trial Coupon has been applied. ${O}`:"ð Wohoo! Trial Coupon has been applied.",type:"success",position:{vertical:"bottom",horizontal:"center"}});return}S({applied:!0,isLoading:!1,percentOff:l,promoId:s,promoCode:t.trim(),isStripeTrial:!1,restrictedToPlans:[],errorMessage:""}),(0,n.analyticsLogger)(d.PHOT_AI_ROUTES.PRICING,d.ANALYTICS_NAME_LIST.Coupon_Success,{source:m,tool:e,entry:p}),R(3),c&&_({isError:!1,isOpen:!0,message:`Coupon has been applied, you have received ${Math.round(Number(l)||0)}% off`,type:"success",position:{vertical:"bottom",horizontal:"center"}})}catch(o){let a=o?.response?.data||o?.data,r=a?.message,l=a?.data?.errorCode==="ACTIVE_SUBSCRIPTION_EXISTS"&&"string"==typeof r&&r.trim()?r:U;S({applied:!1,isLoading:!1,percentOff:0,promoId:"",promoCode:t.trim(),isStripeTrial:!1,restrictedToPlans:[],errorMessage:l}),R(1),(0,n.analyticsLogger)(d.PHOT_AI_ROUTES.PRICING,d.ANALYTICS_NAME_LIST.Coupon_Failed,{source:m,tool:e,entry:p}),R(4)}},K=()=>{R(1),f.current="",S({applied:!1,isLoading:!1,promoId:"",promoCode:"",percentOff:0,isStripeTrial:!1,restrictedToPlans:[],errorMessage:""}),B(!1),F(),w(C.TEAM_PLAN_MIN_SEATS)};(0,l.useEffect)(()=>{let e="string"==typeof D?D:"";e.length>0&&(f.current=e,B(!0),z(e))},[D,g.user?.email]),(0,l.useEffect)(()=>{3===A&&B(!0)},[A]);let J=3===A,$=2===A,W=f.current.length<=0;if(!Y)return(0,a.jsxs)("div",{className:"tw-flex tw-mt-[10px] tw-flex-col tw-items-center tw-gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>B(!0),className:"tw-inline-flex tw-items-center tw-gap-1.5 tw-text-sm tw-font-semibold tw-text-accent hover:tw-text-accent/80 tw-transition-colors",children:[(0,a.jsx)(N.Tag,{className:"tw-w-4 tw-h-4"}),"Apply Coupon"]}),0===f.current.length&&h&&!O&&(0,a.jsxs)("p",{className:"tw-text-sm tw-text-muted-foreground tw-max-w-[300px] tw-text-center md:tw-max-w-full",children:["Our ",M," Sale is live! Use code"," ",(0,a.jsx)("span",{className:"tw-font-bold tw-text-foreground",children:k.couponValue})," to get"," ",k.text.toLocaleLowerCase()," on your plan"," ",(0,a.jsx)("span",{className:"tw-text-accent tw-cursor-pointer hover:tw-text-accent/80",onClick:()=>{f.current=k.couponValue,B(!0),z(k.couponValue)},children:"Apply"})]})]});if(J){let e=(0,a.jsxs)("div",{className:"tw-inline-flex tw-max-w-full tw-items-center tw-justify-center tw-gap-2",children:[(0,a.jsx)(b.CheckCircle2,{className:"tw-w-5 tw-h-5 tw-text-green-500 tw-shrink-0"}),(0,a.jsx)("span",{className:"tw-min-w-0 tw-break-all tw-text-center tw-text-sm tw-font-semibold tw-text-foreground md:tw-text-base",children:f.current}),(0,a.jsx)("button",{type:"button",onClick:K,disabled:""!==t,className:"tw-shrink-0 tw-text-muted-foreground hover:tw-text-foreground tw-transition-colors disabled:tw-cursor-not-allowed disabled:tw-opacity-50",children:(0,a.jsx)(L.X,{className:"tw-w-4 tw-h-4"})})]});return c?(0,a.jsx)("div",{className:"tw-mt-[10px] tw-flex tw-w-full tw-flex-col tw-items-end",children:e}):(0,a.jsxs)("div",{className:"tw-flex tw-mt-[10px] tw-w-full tw-flex-col tw-items-center tw-gap-2 tw-px-4",children:[e,(0,a.jsx)("p",{className:"tw-text-sm tw-text-muted-foreground tw-text-center",children:I.isStripeTrial?(0,a.jsxs)(a.Fragment,{children:["ð Wohoo! Trial Coupon has been applied.",V?(0,a.jsxs)("span",{children:[" ",V]}):null]}):(0,a.jsxs)(a.Fragment,{children:["ð Wohoo! Coupon has been applied, you have received"," ",(0,a.jsxs)("span",{className:"tw-font-medium tw-text-foreground",children:[Math.round(I?.percentOff),"% off"]})]})})]})}let q=4===A;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:(0,x.cn)("tw-inline-flex tw-mt-[10px] tw-items-center tw-gap-0 tw-rounded-full tw-border tw-bg-background tw-overflow-hidden tw-pl
1-3 tw-pr-1 tw-py-1 tw-max-w-[23rem] tw-w-full",q?"tw-border-[#FFACA0]":"tw-border-border"),children:[(0,a.jsx)(N.Tag,{className:"tw-w-4 tw-h-4 tw-text-accent tw-flex-shrink-0"}),(0,a.jsx)("input",{type:"text",placeholder:"Enter Coupon Code",value:f.current,onChange:e=>{f.current=e.target.value.trim(),F()},className:"tw-flex-1 tw-bg-transparent tw-border-none tw-outline-none tw-text-sm tw-font-medium tw-text-foreground placeholder:tw-text-muted-foreground tw-px-2 tw-py-1",autoFocus:!0}),(0,a.jsx)("button",{type:"button",onClick:()=>{(0,n.analyticsLogger)(d.PHOT_AI_ROUTES.PRICING,d.ANALYTICS_NAME_LIST.Coupon_Entered,{source:m,tool:e,entry:p}),z(f.current)},disabled:W||$||""!==t,className:(0,x.cn)("tw-text-sm tw-font-semibold tw-transition-colors tw-px-3 tw-py-1",f.current.length>0&&!$?"tw-text-accent":"tw-text-muted-foreground/40"),children:$?(0,a.jsx)(H.Loader2,{className:"tw-w-4 tw-h-4 tw-animate-spin tw-text-accent"}):"Apply"})]}),q&&(0,a.jsxs)("div",{onClick:()=>R(1),className:"tw-flex tw-justify-center tw-items-center tw-gap-1 tw-my-2 tw-mb-2 tw-cursor-pointer",children:[(0,a.jsx)("div",{className:"tw-text-[#DE525A] tw-text-sm",children:I.errorMessage||U}),(0,a.jsx)("button",{type:"button",className:"tw-text-muted-foreground hover:tw-text-foreground tw-transition-colors",onClick:e=>{e.stopPropagation(),K()},children:(0,a.jsx)(L.X,{className:"tw-w-4 tw-h-4"})})]})]})},D=(0,e.i(168489).default)(()=>e.A(85049).then(e=>e.CheckoutForm),{loadableGenerated:{modules:[838469]},ssr:!1}),Y={paddleInstance:null,setPaddleInstance:()=>console.log(""),toastData:null,setToastData:()=>console.log(""),retryPayment:!1,seRetryPayment:()=>console.log(""),isPastDuePaymentUpdateFailure:!1,setIsPastDuePaymentUpdateFailure:()=>console.log(""),updateAccessTokenFetching:!1,setUpdateAccessTokenFetching:()=>console.log(""),handleRemainingLimits:async()=>console.log(""),removeWatermarkFlow:(e,t,a)=>{console.log(e,t,a)},resultSectionRef:null,paymentState:{openPayment:!1,client_secret:"",transactionId:"",isStripeTrial:!1,afterPaymentCallback:()=>console.log("")},submitHandler:async(e,t,a,r)=>{console.log("Default payment handler",e,t,a,r)},submitChangePaymentMethodHandler:async e=>{console.log("Default change payment method handler",e)},closePaymentModal:()=>{console.log("Default close payment modal")},afterPaymentCloseRef:{current:null},setAfterPaymentCloseRef:()=>console.log(""),teamSeats:C.TEAM_PLAN_MIN_SEATS,setTeamSeats:()=>console.log(""),teamBillingInterval:"yearly",setTeamBillingInterval:()=>console.log(""),proceedPendingTeamInvites:async()=>console.log(""),upgradeModal:{isOpen:!1,data:h.UPGRADE_PRO_PLAN_DATA[d.PHOT_AI_TOOLS.OBJECT_REMOVER],tool:d.PHOT_AI_TOOLS.OBJECT_REMOVER},setUpgradeModal:()=>console.log(""),isPaymentDrawerOpen:!1,setIsPaymentDrawerOpen:()=>console.log(""),appliedCouponInfo:{applied:!1,isLoading:!1,promoId:"",promoCode:"",percentOff:0,isStripeTrial:!1,restrictedToPlans:[],errorMessage:""},setAppliedCouponInfo:()=>console.log(""),couponStage:k.InputField,setCouponStage:()=>console.log(""),couponRef:{current:""},internalPlanCouponData:{isInternalPlan:!1,internalPlanId:"",allowedPriceIds:[],validations:null,perSeatCredits:null},setInternalPlanCouponData:()=>console.log(""),buyingPlanId:"",setBuyingPlanId:()=>console.log(""),planMigrationSheetLaunchPlan:null,setPlanMigrationSheetLaunchPlan:()=>console.log(""),isPlanMigrationModalOpen:!1,setIsPlanMigrationModalOpen:()=>console.log(""),buyInternalPlan:async()=>console.log(""),isInternalPlanPaymentFailed:null,setIsInternalPlanPaymentFailed:()=>console.log(""),getCheckoutPreview:async()=>null,setPlanMigrationPostPaymentCleanup:()=>console.log(""),isUpgradeConfirmModalOpen:!1,setIsUpgradeConfirmModalOpen:()=>console.log(""),upgradeConfirmTargetPlan:null,setUpgradeConfirmTargetPlan:()=>console.log(""),isTrialCouponApplied:!1},B=(0,l.createContext)(Y),j=({children:e})=>{let{setTools:t}=(0,_.usePollingContext)(),[N,b]=(0,l.useState)(null),L=(0,l.useRef)(null),H=(0,l.useRef)(""),{setToastState:v}=(0,l.useContext)(y.default),{currentTeamId:x,teamsArray:U}=(0,l.useContext)(o.AuthContext),[M,Y]=(0,l.useState)(!0),[j,G]=(0,l.useState)(null),{setToastState:F}=(0,l.useContext)(y.default),[V,z]=(0,l.useState)(!1),[K,J]=(0,l.useState)(null),[$,W]=(0,l.useState)(!1),{setSelectedImage:q,setSelectedObject:X,setEnableMultiSelect:Q}=(0,l.useContext)(T.default),{setResultHistory:Z}=(0,l.useContext)(O.default),[ee,et]=(0,l.useState)({isOpen:!1,data:h.UPGRADE_PRO_PLAN_DATA[d.PHOT_AI_TOOLS.OBJ
1ECT_REMOVER],tool:d.PHOT_AI_TOOLS.OBJECT_REMOVER}),[ea,er]=(0,l.useState)(!1),[el,eo]=(0,l.useState)({applied:!1,isLoading:!1,promoId:"",promoCode:"",percentOff:0,isStripeTrial:!1,restrictedToPlans:[],errorMessage:""}),{authState:ei,setAuthState:en,setUserDashboard:es,setIsShowCreateTeamModal:ec,setTeamsArray:ed}=(0,l.useContext)(o.AuthContext),{priceData:eu,setPriceData:ep}=(0,l.useContext)(i.default),{entry:em}=(0,l.useContext)(E.default),e_=eu.limitExhausted.toolName,{user:eO,loading:eg}=ei,eT=(0,r.useRouter)(),eE=eT?.query?.sid?.toString(),eI=eT?.query?.renewCard?.toString()==="true",eS=eT?.query?.cancelSubID?.toString(),eP=eT.pathname,eA=eT.query.tool,eR=(0,p.useMediaQuery)("(max-width: 600px)"),ef=eP===d.PHOT_AI_ROUTES.AI_AVATAR||eP===d.PHOT_AI_ROUTES.AI_PHOTOSHOOT,ey=eP===d.PHOT_AI_ROUTES.USER_ACTIVITY&&eA===d.PHOT_AI_TOOLS.OBJECT_REPLACER&&eR,[ew,eh]=(0,l.useState)({openPayment:!1,client_secret:"",transactionId:"",isStripeTrial:!1,afterPaymentCallback:()=>console.log("")}),eC=!0===el.applied&&!0===el.isStripeTrial,{pricingDataV3:eN}=(0,P.default)(),[eb,eL]=(0,l.useState)(C.TEAM_PLAN_MIN_SEATS),[eH,ev]=(0,l.useState)(!1),[ex,ek]=(0,l.useState)("yearly"),[eU,eM]=(0,l.useState)(k.InputField),[eD,eY]=(0,l.useState)({isInternalPlan:!1,internalPlanId:"",allowedPriceIds:[],validations:null,perSeatCredits:null}),[eB,ej]=(0,l.useState)(""),[eG,eF]=(0,l.useState)(null),[eV,ez]=(0,l.useState)(!1),[eK,eJ]=(0,l.useState)(!1),[e$,eW]=(0,l.useState)(null),eq=(0,l.useRef)(null),eX=(0,l.useCallback)(e=>{eq.current=e},[]),eQ=async(e,t)=>{let a=(el.promoCode??"").trim()||(el.promoId??"").trim();try{let r=await (0,u.previewCheckout)({priceId:e.id,paymentAmount:e.price,priceCurrency:e.currency||"USD",plan:e.mode,interval:e.interval,seatCount:t?.seatCount,promoCode:a||void 0,teamId:x||void 0});return r?.data||null}catch(e){return(0,n.logger)("log","Error fetching checkout preview",e),null}},eZ=async()=>{let e=await (0,I.getRefreshToken)();(0,n.setAuthTokenInCookie)(e);let a=await (0,c.getUserInfo)();ed(a?.data?.teamList),en(e=>({...e,user:{...e.user,subscriptionDetails:{...a?.data?.subscriptionDetails},userType:a?.data?.user?.userType,lastPaymentCurrency:a?.data?.user?.lastPaymentCurrency,subscriptionId:a?.data?.user?.subscriptionId}})),ep(e=>({...e,fromResultLoader:!1,remainingLimits:{...e.remainingLimits,isFetching:!0}}));let{result:r,maxVal:l,remainingVal:o,creditBreakdown:i}=await (0,n.getRemainingLimits)();await (0,m.fetchPollingIntervals)(t),e0(),ep(e=>({...e,fromResultLoader:!1,remainingLimits:{arr:r,isFetching:!1,maxVal:l,remainingVal:o,creditBreakdown:i}}));let{pathname:s,query:d}=eT;delete d.sid,delete d.userDashboard,delete d.cancelSubID,delete d.renewCard,delete d.trial,eT.push({pathname:s,query:d},void 0,{locale:!1}).then(()=>{setTimeout(()=>{L?.current&&!ey&&L?.current.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})},500)})},e0=async()=>{let e=localStorage.getItem(d.LOCAL_STORAGE_KEYS.PENDING_TEAM_INVITES);if(!e)return;let t=JSON.parse(e),a=t?.emailData,r=t?.teamId;if(a&&r)try{let e=a.filter(e=>e.email.trim()).map(e=>({email:e.email,role:e.permission})),t=await (0,w.inviteTeamMembers)({users:e,packageId:d.USER_PAYLOAD.PACKAGE_ID,workspaceId:r});F({duration:6e3,isError:!1,isOpen:!0,message:t?.message||"",type:"info",position:{vertical:"bottom",horizontal:"center"}})}catch(e){e?.status===400&&F({duration:6e3,isError:!0,isOpen:!0,message:e?.response?.data?.message||"Something went wrong",type:"error",position:{vertical:"bottom",horizontal:"center"}})}finally{localStorage.removeItem(d.LOCAL_STORAGE_KEYS.PENDING_TEAM_INVITES)}},e1=async({plan:e,isStripeTrial:t=!1})=>{await eZ(),es(e=>({...e,isOpen:!0,manageTeamPlanTotalSeats:0,manageTeamPlanAvailableSeats:0,prevComp:f.AccountSettingsSidebarTabs.BILLING_TEAM})),F({isError:!1,isOpen:!0,message:t?"Trial activated":e?`Hurray! You have successfully purchased the ${e} plan!`:"Hurray! You have successfully updated payment details!",type:"success",position:{vertical:"bottom",horizontal:"center"}})},e2=async(e,t)=>{G({message:e?"The updated card couldnât be charged. Try again or use another card.":"Payment Failed !",type:"error",hideErrorBtn:!0,clickHandler:()=>G(null)}),(0,n.analyticsLogger)(d.PHOT_AI_ROUTES.PRICING,d.ANALYTICS_NAME_LIST.Purchase_Failed,{source:"Stripe",tool:e_||"pricing_plan",entry:em,isStudio:!1}),eT.push(d.PHOT_AI_ROUTES.PRICING,void 0,{locale:!1}).then(()=>{t&&J(t),z(!0),e&&W(!0)})},e4=async()=>
1{if(eO)if(eE)try{let e=eT?.query?.trial?.toString()==="true",t=await (0,u.subscriptionStatusPolling)(eI,eE,x);if(t){let{isError:a,data:r}=t;if(a)await e2(eI);else{let t;((t=localStorage.getItem(d.LOCAL_STORAGE_KEYS.FAILED_PAYMENT_HISTORY))?JSON.parse(t):null)&&localStorage.removeItem(d.LOCAL_STORAGE_KEYS.FAILED_PAYMENT_HISTORY),await e1({plan:r?.plan||void 0,isStripeTrial:e})}}}catch(e){await e2(eI)}else eS&&await e9()},e8=async e=>{if(e){let t;t=eO?.isStripeUser?await (0,u.checkCancelSubscriptionStripe)(e):await (0,u.checkCancelSubscriptionPaddle)(e),t?.data?.data?.subscriptionStatus==="canceled"&&G({message:"Your plan has been cancelled successfully!",type:"success",clickHandler:()=>{G(null)}})}},e9=async()=>{eS&&(await e8(eS),await eZ())};(0,l.useEffect)(()=>{eO&&!eg&&(eE||eS)&&!ef&&setTimeout(()=>{e4().then(()=>Y(!1))},1e4)},[eE,eO?.email,eS]);let e6=eT?.query?.removeWaterMarkFlow,e7=eT?.query?.sid,e5=async(e,t)=>{let{toolOrderName:a,toolHistoryName:r}=t;if(a&&r){let t=e.map(e=>(0,g.fetchOrderStatus)(e.orderId,e.sourceImage,e.caption,void 0,!1).then(t=>{let r=t.output_urls.map(t=>({generatedUrl:t.url,outputId:t._id,Iht:e?.Ih,Iwt:e?.Iw,like:0,comments:{like:{},dislike:{}},isFeedbackSent:!1,originalImageLink:e?.originalImageLink,orderId:e?.orderId,isHDVisible:e?.isHDVisible,ratioedWidth:e?.ratioedWidth,ratioedHeight:e?.ratioedHeight,enhancedUrl:e?.enhancedUrl}));return{orderId:e?.orderId,imgResultArr:r,resultImages:r,caption:e.caption,sourceImage:e.sourceImage||t.sourceImg,tool:a,orderPlacedBy:eO?.email,isSampleImage:e?.isSampleImage,enhancedUrl:e?.enhancedUrl,fileName:e?.fileName}}).catch(e=>(console.error("Error processing object:",e),null)));try{let e=await Promise.all(t);Z(t=>({...t,[r]:e.filter(e=>null!==e)})),(a===d.PHOT_AI_TOOLS.BACKGROUND_REPLACER||a===d.PHOT_AI_TOOLS.PRODUCT_PHOTOGRAPHY)&&(X(e[0]),q(e[0]?.imgResultArr[0]),Q(!1));let{pathname:l,query:o}=eT;delete o.removeWaterMarkFlow,eT.push({pathname:l,query:o},void 0,{scroll:!1,locale:!1})}catch(e){console.error("Error processing objects:",e)}}},e3=async e=>{try{{let e=new URL(window.location.href);e.searchParams.set("ipd","true"),window.history.replaceState({},"",e.toString())}let t={promoCode:e?.promoCode||el.promoId,planId:e.id,interval:e.interval,priceId:e.pgPriceId},a=[...eN.cardArray.monthly||[],...eN.cardArray.yearly||[]].find(e=>e.id===eD.internalPlanId||eD.allowedPriceIds?.length>0&&eD.allowedPriceIds?.includes(e.pgPriceId));null!=eb&&(t.seatCount=eb),a&&eD?.internalPlanId&&(t.interval=a.interval),eD.allowedPriceIds.length>0&&(t.priceId=eD.allowedPriceIds[0]),eD?.internalPlanId&&(t.planId=eD.internalPlanId),eD?.validations?.seatCount&&(t.seatCount=eD?.validations?.seatCount);let r=U?.filter(e=>e.teamId===x)[0],l=await (0,s.handleInternalPlanPayment)(t,r?.teamId);if(200!==l.status)throw Error(l.response.data.message);await e1({plan:e.mode}),ep(e=>({...e,fromResultLoader:!1,showLimitExceedPlan:!1,showUpgradePlan:!1,notifyAdminRequestType:"credits",waterMark:{isRemoving:!1,toolName:d.PHOT_AI_TOOLS.NONE}})),es(e=>({...e,isTeamSeatsManagementModalOpen:!1}))}catch(e){await e2(!1,e.message)}finally{eL(C.TEAM_PLAN_MIN_SEATS),ej(""),eY({isInternalPlan:!1,internalPlanId:"",allowedPriceIds:[],validations:null,perSeatCredits:null}),eo({applied:!1,isLoading:!1,promoId:"",promoCode:"",percentOff:0}),eM(k.InputField),et({isOpen:!1,data:h.UPGRADE_PRO_PLAN_DATA[d.PHOT_AI_TOOLS.OBJECT_REMOVER],tool:d.PHOT_AI_TOOLS.OBJECT_REMOVER}),H.current="";{let e=new URL(window.location.href);e.searchParams.delete("ipd"),window.history.replaceState({},"",e.toString())}}};(0,l.useEffect)(()=>{if(!e7&&e6){let e=JSON.parse(localStorage.getItem(d.LOCAL_STORAGE_KEYS.WATERMARK_REMOVE_ORDERS)||"{}"),t=e?.toolData,a=e?.waterMarkOrders;Array.isArray(a)&&a.length>0&&t?.toolOrderName!==d.PHOT_AI_TOOLS.AI_ART_GENERATOR&&e5(a,t)}},[e6,e7]);let te=(0,l.useRef)(null),tt=(0,l.useCallback)(async(e,t)=>{if(e)try{await (0,u.cancelCheckoutSession)({sessionId:e,teamId:x||(0,n.getCurrentWorkspaceId)()||""})}catch(a){let e=a?.response?.data?.message||"Unable to cancel Checkout Session. Please try again.";if("Checkout is already completed and cannot be cancelled."===e)return void t?.();if("Invalid Stripe Checkout Session"===e)return;v({isError:!0,isOpen:!0,message:e,type:"error",position:{vertical:"bottom",horizontal:"center"}})}},[x,v]),ta=()=>{let e=ew.transactionId,t=ew.afterPaymentCallback;eh({openPayment:!1,client_secret:"",transactionId:"",isStripeTrial:!1,afterPaymentCallback:()=>console.log("")}),ej(""),te.current&&(te.current(),te.current=null),es(e=>({...e,manageTeamPlanTotalSeats:0,manageTeamPlanAvailableSeats:0})),v({isError:!1,isOpen:!0,message:"Payment popup closed. Contact [email protected] if the amount was deducted.",type:"info",position:{vertical:"bottom",horizontal:"center"}}),tt(e,t)},tr=()=>{es(e=>({...e,isTeamSeatsManagementModalOpen:!1,isTeamInviteModalOpen:!1,isOpen:!1})),ec(!1),en(e=>({...e,user:{...e.user,profiling:{is_answered:!0}
1}}))},tl=async(e,{promoId:t="",redirectionUrl:a,toolName:r="",forAdPage:l=!1,entry:o="",afterPaymentCallbackCleanup:i=()=>(0,n.logger)("log"),setToastState:c,openSleekPlanFeedback:u,setBuyingPlanId:p,setPurchaseEventCount:m},_=null,O)=>{try{(0,A.setCookie)(null,d.COOKIE_KEYS.CLOSED_USER_SURVEY,"1",{maxAge:604800});let g=await (0,R.getUsageHistory)(),T=g?.data?.data[0]?.tool_label;if(T&&""!==T&&(0,A.setCookie)(null,d.COOKIE_KEYS.LAST_TOOl_USED,T),e){let{id:d,mode:g,interval:T,price:E}=e;p&&p(d),m&&m(0),window.__bypassPaymentNavigation=!0;let I=await (0,s.handleStripePayment)({plan:d,amount:E,mode:"subscription",planType:g,planInterval:`${T}`.toUpperCase(),fromIndia:eN?.userCountry?.fromIndia,setToastData:G,promoId:t,setBuyingPlanId:p,entry:o,pricingToolName:r,forAdPage:l,seatCount:_,teamId:O||(0,n.getCurrentWorkspaceId)()||""});if(I?.client_secret&&I?.transactionId)eh({openPayment:!0,client_secret:I?.client_secret,transactionId:I?.transactionId,isStripeTrial:!!I?.isStripeTrial,afterPaymentCallback:()=>{let e=I?.isStripeTrial?"&trial=true":"";eT.push(`${a}sid=${I?.transactionId}${e}`,void 0,{locale:!1}).then(()=>{eh({openPayment:!1,client_secret:"",transactionId:"",isStripeTrial:!!I?.isStripeTrial,afterPaymentCallback:()=>console.log("")}),window.__bypassPaymentNavigation=!1,er(!1),et(e=>({...e,isOpen:!1})),ep(e=>({...e,fromResultLoader:!1,showLimitExceedPlan:!1,showUpgradePlan:!1,notifyAdminRequestType:"credits"})),tr(),eM(k.InputField),H.current="",eo({applied:!1,isLoading:!1,promoId:"",promoCode:"",percentOff:0,isStripeTrial:!1,restrictedToPlans:[],errorMessage:""}),eL(C.TEAM_PLAN_MIN_SEATS),i(),eq.current?.(),eq.current=null})}});else throw c({isError:!0,isOpen:!0,message:"Something went wrong!",type:"error",position:{vertical:"bottom",horizontal:"center"}}),u(),Error("Something went wrong!")}}catch(e){throw p&&p(""),window.__bypassPaymentNavigation=!1,Error("Something went wrong!")}},to=U?.find(e=>e.teamId===x)?.isGatewayDeprecated,ti=U?.find(e=>e.teamId===x)?.planId,tn=async({redirectionUrl:e,toolName:t="",forAdPage:a=!1,entry:r="",billingStatusCtaType:l=d.BILLING_STATUS_CTA_TYPE.NONE,afterPaymentCallbackCleanup:o=()=>(0,n.logger)("log"),setToastState:i,openSleekPlanFeedback:c,setPurchaseEventCount:u,subscriptionId:p,teamId:m})=>{try{if(to){var _;let l=[...(_=eN?.cardArray).monthly||[],..._.yearly||[]].find(e=>e.id===ti)||null;await tl(l,{promoId:el.promoId,redirectionUrl:e,toolName:t,forAdPage:a,entry:r,afterPaymentCallbackCleanup:o,setToastState:i,openSleekPlanFeedback:c,setBuyingPlanId:ej,setPurchaseEventCount:u},null,x||(0,n.getCurrentWorkspaceId)());return}(0,A.setCookie)(null,d.COOKIE_KEYS.CLOSED_USER_SURVEY,"1",{maxAge:604800}),es(e=>({...e,billingStatusCtaType:l}));let O=await (0,R.getUsageHistory)(),g=O?.data?.data[0]?.tool_label;g&&""!==g&&(0,A.setCookie)(null,d.COOKIE_KEYS.LAST_TOOl_USED,g),u&&u(0);let T=await (0,s.handleChangePaymentMethod)({setToastData:G,entry:r,pricingToolName:t,forAdPage:a,teamId:m});if(ev(!0),T?.client_secret&&T?.transactionId)es(e=>({...e,billingStatusCtaType:d.BILLING_STATUS_CTA_TYPE.NONE})),eh({openPayment:!0,client_secret:T?.client_secret,transactionId:T?.transactionId,isStripeTrial:!1,afterPaymentCallback:()=>{eT.push(`${e}sid=${p}&renewCard=true`,void 0,{locale:!1}).then(()=>{ev(!1),eh({openPayment:!1,client_secret:"",transactionId:"",isStripeTrial:!1,afterPaymentCallback:()=>console.log("")}),er(!1),et(e=>({...e,isOpen:!1})),tr(),eM(k.InputField),H.current="",eo({applied:!1,isLoading:!1,promoId:"",promoCode:"",percentOff:0,isStripeTrial:!1,restrictedToPlans:[],errorMessage:""}),o()})}});else throw es(e=>({...e,billingStatusCtaType:d.BILLING_STATUS_CTA_TYPE.NONE})),i({isError:!0,isOpen:!0,message:"Something went wrong!",type:"error",position:{vertical:"bottom",horizontal:"center"}}),c(),Error("Something went wrong!")}catch(e){throw es(e=>({...e,billingStatusCtaType:d.BILLING_STATUS_CTA_TYPE.NONE})),Error("Something went wrong!, error -> "+e)}};return(0,a.jsxs)(B.Provider,{value:{paddleInstance:N,setPaddleInstance:b,toastData:j,setToastData:G,updateAccessTokenFetching:M,setUpdateAccessTokenFetching:Y,handleRemainingLimits:eZ,removeWatermarkFlow:(e,t,a)=>{if(Array.isArray(e)&&e.length>0){let r=e.map(e=>{let t="";return Array.isArray(e?.imgResultArr)&&e?.imgResultArr[0]&&e?.imgResultArr[0]?.originalImageLink&&(t=e?.imgResultArr[0]?.originalImageLink||""),{orderId:e?.orderId||"",caption:e?.caption||"",sourceImage:e?.sourceImage||"",isSampleImage:e?.isSampleImage,enhancedUrl:e?.enhancedUrl,fileName:e?.fileName,originalImageLink:t,isHDVisible:e?.isHDVisible,ratioedWidth:e?.ratioedWidth,ratioedHeight:e?.ratioedHeight}});localStorage&&localStorage.setItem(d.LOCAL_STORAGE_KEYS.WATERMARK_REMOVE_ORDERS,JSON.stringify({waterMarkOrders:r,toolData:{toolOrderName:t,toolHistoryName:a}})),ep(e=>({...e,waterMark:{isRemoving:!0,toolName:t}})),et({isOpen:!0,data:h.UPGRADE_PRO_PLAN_DATA.watermark,tool:"watermark"})}},resultSectionRef:L,retryPayment:V,seRetryPayment:z,paymentState:ew,submitHandler:tl,submitChangePaymentMethodHandler:tn,closePaymentModal:ta,afterPaymentCloseRef:te,setAfterPaymentCloseRef:e=>{te.current=e},teamSeats:eb,setTeamSeats:eL,teamBillingInterval:ex,setTeamBillingInterval:ek,proceedPendingTeamInvites:e0,upgradeModal:ee,setUpgradeModal:et,isPaymentDrawerOpen:ea,setIsPaymentDrawerOpen:er,appliedCouponInfo:el,setAppliedCouponInfo:eo,couponRef:H,couponStage:eU,setCouponStage:eM,internalPlanCouponData:eD,setInternalPlanCouponData:eY,buyingPlanId:eB,setBuyingPlanId:ej,planMigrationSheetLaunchPlan:eG,setPlanMigrationSheetLaunchPlan:eF,isPlanMigrationModalOpen:eV,setIsPlanMigrationModalOpen:ez,buyInternalPlan:e3,isPastDuePaymentUpdateFailure:$,setIsPastDuePaymentUpdateFailure:W,isInternalPlanPaymentFailed:K,setIsInternalPlanPaymentFailed:J,getCheckoutPreview:eQ,setPlanMigrationPostPaymentCleanup:eX,isUpgradeConfirmModalOpen:eK,setIsUpgradeConfirmModalOpen:eJ,upgradeConfirmTargetPlan:e$,setUpgradeConfirmTargetPlan:eW,isTrialCouponApplied:eC},children:[e,(0,a.jsx)(S.Modal,{open:ew.openPayment,className:"tw-m-4 md:tw-mx-11 md:tw-my-4 tw-flex tw-justify-center",sx:{zIndex:1e5},children:(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(D,{options:{clientSecret:ew.client_secret,onComplete:ew.afterPaymentCallback},isChangePaymentMethodModal:eH,closePaymentModal:ta})})})]})},G=()=>(0,l.useContext)(B)}]);
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.