1/*! For license information please see 486.js.LICENSE.txt */ 2"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[486],{2486:function(e,t,n){n.r(t),n.d(t,{default:function(){return De}});var r=n(4566),a=n(4557),c=n(1176),i=864e5,o=400;function s(e){if(e instanceof Date)return new Date(e.getTime());if(!e||"string"!=typeof e)return null;var t=e.slice(0,10).split("-");if(3!==t.length)return null;var n=new Date(Number(t[0]),Number(t[1])-1,Number(t[2]));return isNaN(n.getTime())?null:n}function l(e){if(!(e instanceof Date)||isNaN(e.getTime()))return null;var t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(t,"-").concat(n,"-").concat(r)}function u(e,t){return new Date(e.getTime()+t*i)}function d(e,t,n){var r={};(e||[]).forEach((function(e){e&&e.key&&(r[e.key]=e)}));var a=n||{},c=s(t),i={},o=[],l={};var d=(e||[]).map((function(e){return e.key})).filter(Boolean);return d.forEach((function e(t){if(i[t])return i[t];var n=r[t];if(!n)return o.push('Unknown anchor "'.concat(t,'"')),null;var d=a[t]?s(a[t]):null;if(d)return i[t]=d,d;if(!n.relative_to)return i[t]=c,c;if(l[t])return o.push('Circular anchor "'.concat(t,'"')),null;l[t]=!0;var h=e(n.relative_to);if(l[t]=!1,!h)return null;var p=Number(n.offset)||0,f="hours"===n.unit?function(e,t){return new Date(e.getTime()+60*t*60*1e3)}(h,p):u(h,p);return i[t]=f,f})),{map:i,order:d,errors:o}}function h(e,t,n){var r=e||{},a=Array.isArray(r.anchors)?r.anchors:[],c=Array.isArray(r.steps)?r.steps:[],i=d(a,t,n),s=i.map,h=i.errors,p=a.map((function(e){return{key:e.key,label:e.label,editable:!1!==e.editable,unit:e.unit||"days",relative_to:e.relative_to||null,date:s[e.key]||null,dateKey:s[e.key]?l(s[e.key]):null}})).filter((function(e){return e.date})),f=[];p.forEach((function(e){f.push({dateKey:e.dateKey,date:e.date,label:e.label,type:"milestone",detail:"",anchorKey:e.key,isAnchorMarker:!0})})),c.forEach((function(e){var t=s[e.anchor];if(t){var n=u(t,Number(e.start_offset)||0);if("daily"===e.recurrence){var r=n;e.end_anchor&&s[e.end_anchor]&&(r=u(s[e.end_anchor],Number(e.end_offset)||0)),r<n&&(r=n);for(var a=new Date(n.getTime()),c=0;a<=r&&c<o;)f.push({dateKey:l(a),date:new Date(a.getTime()),label:e.label,type:e.type||"medication",detail:e.detail||"",anchorKey:e.anchor}),a=u(a,1),c++}else f.push({dateKey:l(n),date:n,label:e.label,type:e.type||"action",detail:e.detail||"",anchorKey:e.anchor})}}));var m={};f.forEach((function(e){e.dateKey&&(m[e.dateKey]||(m[e.dateKey]={dateKey:e.dateKey,date:e.date,items:[]}),m[e.dateKey].items.push(e))}));var y=Object.values(m).sort((function(e,t){return e.date-t.date})).map((function(e){var t={milestone:0,medication:1,scan:2,action:3,note:4};return e.items.sort((function(e,n){var r,a;return(null!==(r=t[e.type])&&void 0!==r?r:9)-(null!==(a=t[n.type])&&void 0!==a?a:9)})),e}));return{anchors:p,events:f,days:y,errors:h}}function p(e){return e instanceof Date?e.toLocaleDateString(void 0,{weekday:"short",day:"numeric",month:"short",year:"numeric"}):""}function f(e,t){var n=s(t);return n&&e instanceof Date?Math.round((e-n)/i)+1:null}function m(e){return String(e).padStart(2,"0")}function y(e){return"".concat(e.getFullYear()).concat(m(e.getMonth()+1)).concat(m(e.getDate()))}function v(e){return String(e||"").replace(/\\/g,"\\\\").replace(/;/g,"\\;").replace(/,/g,"\\,").replace(/\r?\n/g,"\\n")}function g(e,t,n){var r=function(e,t){var n=["BEGIN:VCALENDAR","VERSION:2.0","PRODID:-//Dr Malpani IVF Clinic//Treatment Calendar//EN","CALSCALE:GREGORIAN","X-WR-CALNAME:".concat(v(t||"IVF Treatment Calendar"))];return e.forEach((function(e,t){if(e.date){var r=e.date,a=u(r,1),c="milestone"===e.type?"â ":"";n.push("BEGIN:VEVENT"),n.push("UID:tpc-".concat(y(r),"-").concat(t,"@drmalpani.com")),n.push("DTSTAMP:20260101T000000Z"),n.push("DTSTART;VALUE=DATE:".concat(y(r))),n.push("DTEND;VALUE=DATE:".concat(y(a))),n.push("SUMMARY:".concat(v(c+e.label))),e.detail&&n.push("DESCRIPTION:".concat(v(e.detail))),n.push("END:VEVENT")}})),n.push("END:VCALENDAR"),n.join("\r\n")}(e,t),a=new Blob([r],{type:"text/calendar;charset=utf-8"}),c=URL.createObjectURL(a),i=document.createElement("a");i.href=c,i.download=n||"ivf-treatment-calendar.ics",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout((function(){return URL.revokeObjectURL(c)}),1e3)}function x(e){if(!e||!e.date)return"#";
vendor: 5,303 bytes, line 2
2var t=y(e.date),n=y(u(e.date,1)),r=new URLSearchParams({action:"TEMPLATE",text:("milestone"===e.type?"â
":"")+(e.label||""),dates:"".concat(t,"/").concat(n),details:e.detail||""});return"https://calendar.google.com/calendar/render?".concat(r.toString())}var b=n(6800);function j(e){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j(e)}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){_(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function _(e,t,n){var r;return r=function(e,t){if("object"!=j(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=j(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==j(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(){k=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},i=c.iterator||"@@iterator",o=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var c=t&&t.prototype instanceof v?t:v,i=Object.create(c.prototype),o=new A(r||[]);return a(i,"_invoke",{value:E(e,n,o)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function v(){}function g(){}function x(){}var b={};l(b,i,(function(){return this}));var w=Object.getPrototypeOf,N=w&&w(w(P([])));N&&N!==n&&r.call(N,i)&&(b=N);var _=x.prototype=v.prototype=Object.create(b);function S(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,t){function n(a,c,i,o){var s=d(e[a],e,c);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==j(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(u).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,o)}))}o(s.arg)}var c;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return c=c?c.then(a,a):a()}})}function E(t,n,r){var a=h;return function(c,i){if(a===f)throw new Error("Generator is already running");if(a===m){if("throw"===c)throw i;return{value:e,done:!0}}for(r.method=c,r.arg=i;;){var o=r.delegate;if(o){var s=L(o,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=f;var l=d(t,n,r);if("normal"===l.type){if(a=r.done?m:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(a=m,r.method="throw",r.arg=l.arg)}}}function L(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,L(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var c=d(a,t.iterator,n.arg);if("throw"===c.type)return n.method="throw",n.arg=c.arg,n.delegate=null,y;var i=c.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,c=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return c.next=c}}throw new TypeError(j(t)+" is not iterable")}return g.prototype=x,a(_,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:g,configurable:!0}),g.displayName=l(x,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,l(e,s,"GeneratorFunction")),e.prototype=Object.create(_),e},t.awrap=function(e){return{__await:e}}
2,S(O.prototype),l(O.prototype,o,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,a,c){void 0===c&&(c=Promise);var i=new O(u(e,n,r,a),c);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(_),l(_,s,"Generator"),l(_,i,(function(){return this})),l(_,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=P,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var c=this.tryEntries.length-1;c>=0;--c){var i=this.tryEntries[c],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var c=a;break}}c&&("break"===e||"continue"===e)&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var i=c?c.completion:{};return i.type=e,i.arg=t,c?(this.method="next",this.next=c.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),D(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;D(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:P(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function S(e,t,n,r,a,c,i){try{var o=e[c](i),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,a)}function O(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var c=e.apply(t,n);function i(e){S(c,r,a,i,o,"next",e)}function o(e){S(c,r,a,i,o,"throw",e)}i(void 0)}))}}var E="/treatment-calendar",L=(0,b.Z)({tool:"treatment-calendar",metaName:"treatment-calendar-base",storageKey:"tc",routes:{publicTemplates:["".concat(E,"/public-templates"),"/api/v1/public/treatment-protocols"],templates:["".concat(E,"/templates"),"/api/v1/treatment-protocols"],plans:["".concat(E,"/plans"),"/api/v1/treatment-plans"],plan:["".concat(E,"/plans/:id"),"/api/v1/treatment-plans/:id"],planEmail:["".concat(E,"/plans/:id/email"),"/api/v1/treatment-plans/:id/email"],patients:["".concat(E,"/patients"),"/api/v1/treatment-plans"]}}),C=L.isRemote,D=function(){var e;return(null===(e=document.querySelector('meta[name="treatment-calendar-tenant"]'))||void 0===e?void 0:e.content)||""},A=function(e){return C()?{id:e.uuid,name:e.name,slug:e.slug,protocol_type:e.protocol_type,description:e.description,data:e.definition}:e},P=function(e){return C()?{id:e.uuid,title:e.title,protocol_type:e.protocol_type,cycle_start_date:e.cycle_start_date,data:e.definition,overrides:e.overrides||{},doctor_reviewed:Boolean(e.reviewed),doctor_notes:e.clinician_notes||null,entry_notes:e.entry_notes||{},reviewed_at:null,is_admin_view:!1,can_edit:!0,is_admin:!1,patient_name:null,patient_email:null,ics_url:e.ics_url||null,schedule:e.schedule||null,updated_at:e.updated_at||null}:e};function T(){return(T=O(k().mark((function e(){var t,n,r,a,c;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.requestPublic("get","publicTemplates",{query:{tenant:D()}});case 2:if(t=e.sent,n=t.data,r=(C()?n.data:n.templates||[]).map(A),!C()||0!==r.length){e.next=16;break}return e.prev=6,e.next=9,window.axios.get("/treatment-calendar/public-templates");case 9:a=e.sent,c=a.data,r=c.templates||[],e.next=16;break;case 14:e.prev=14,e.t0=e.catch(6);case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}}),e,null,[[6,14]])}
2)))).apply(this,arguments)}function I(){return(I=O(k().mark((function e(){var t,n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.request("get","templates");case 2:return t=e.sent,n=t.data,e.abrupt("return",(C()?n.data:n.templates||[]).map(A));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function M(){return(M=O(k().mark((function e(){var t,n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.request("get","plans");case 2:return t=e.sent,n=t.data,e.abrupt("return",(C()?n.data:n.plans||[]).map(P));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(e){return G.apply(this,arguments)}function G(){return(G=O(k().mark((function e(t){var n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.request("get","plan",{params:{id:t}});case 2:return n=e.sent,r=n.data,e.abrupt("return",P(C()?r.data:r.plan));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function K(e){return R.apply(this,arguments)}function R(){return(R=O(k().mark((function e(t){var n,r,a,c,i,o;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.templateId,r=t.cycleStartDate,a=t.userId,c=C()?{protocol_uuid:n,cycle_start_date:r}:N({template_id:n,cycle_start_date:r},a?{user_id:a}:{}),e.next=4,L.request("post","plans",{data:c});case 4:return i=e.sent,o=i.data,e.abrupt("return",P(C()?o.data:o.plan));case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(e,t){return U.apply(this,arguments)}function U(){return(U=O(k().mark((function e(t,n){var r,a;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.request("patch","plan",{params:{id:t},data:n});case 2:return r=e.sent,a=r.data,e.abrupt("return",P(C()?a.data:a.plan));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(e){return B.apply(this,arguments)}function B(){return(B=O(k().mark((function e(t){var n,r,a,c;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!C()){e.next=6;break}return e.next=3,window.axios.post("".concat(E,"/plans/").concat(encodeURIComponent(t),"/email"));case 3:return n=e.sent,r=n.data,e.abrupt("return",r);case 6:return e.next=8,L.request("post","planEmail",{params:{id:t}});case 8:return a=e.sent,c=a.data,e.abrupt("return",c);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=O(k().mark((function e(t){var n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,window.axios.get("".concat(E,"/patients"),{params:{q:t}});case 2:return n=e.sent,r=n.data,e.abrupt("return",r.patients||[]);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var q=n(7723),z=n(1296),H=n(1275);function Z(e){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(e)}function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach((function(t){J(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function J(e,t,n){var r;return r=function(e,t){if("object"!=Z(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=Z(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==Z(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Q(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,c,i,o=[],s=!0,l=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=c.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){l=!0,a=e}
2finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ee(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var te="2025-10-06";var ne=function(){return(0,H.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:[(0,H.jsx)("rect",{x:"3",y:"4",width:"18",height:"17",rx:"2"}),(0,H.jsx)("path",{d:"M3 9h18M8 2v4M16 2v4"})]})},re=function(e){var t=e.s,n=void 0===t?15:t;return(0,H.jsx)("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,H.jsx)("path",{d:"M5 12h14M13 6l6 6-6 6"})})},ae=function(){return(0,H.jsx)("svg",{viewBox:"0 0 24 24",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:(0,H.jsx)("path",{d:"M5 12l5 5L20 6"})})},ce=function(){return(0,H.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:(0,H.jsx)("path",{d:"M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"})})},ie=[["Day 1","Mon 6 Oct","mile","Key date","Your period starts","Every date below counts from here."],["Day 3","Wed 8 Oct","scan","Scan · at the clinic","Baseline scan","Checks the egg count and the lining of the womb before injections begin."],["Day 4","Thu 9 Oct","med","Medication · at home","Start the stimulation injection","Once a day, to grow several eggs at once instead of the usual one."],["Day 10","Wed 15 Oct","scan","Scan · at the clinic","Growth scan","Scans then repeat every other day until the eggs are ready."],["Day 14","Sun 19 Oct","mile","Key date","Trigger injection","The final shot, timed to the hour. Your eggs are collected 36 hours later."],["Day 16","Tue 21 Oct","mile","Key date","Egg collection at the clinic","The husband gives his sperm sample the same day, or frozen sperm is used."],["Day 21","Sun 26 Oct","mile","Key date","Embryos frozen","Frozen at the blastocyst stage and kept for a frozen transfer later."]],oe={6:["mile","Day 1",!0],8:["scan","Scan"],9:["med","Inject"],15:["scan","Scan"],19:["mile","Trigger"],21:["mile","Eggs"],26:["mile","Freeze"]};function se(e){var t=e.navigate,n=Q((0,r.useState)([]),2),a=n[0],c=n[1],i=Q((0,r.useState)(!0),2),o=i[0],s=i[1],l=Q((0,r.useState)(!1),2),u=l[0],d=l[1],p=Q((0,r.useState)(null),2),m=p[0],y=p[1],v=Q((0,r.useState)(te),2),g=v[0],x=v[1],b=(0,r.useRef)(null);(0,r.useEffect)((function(){window.scrollTo(0,0),document.title="IVF Treatment Calendar: Your Cycle Day by Day | Dr. Malpani IVF Clinic",(0,z.L9)(z.OI.CALENDAR_LANDING_PAGE_VIEW,{})}),[]),(0,r.useEffect)((function(){var e=!0;return function(){return T.apply(this,arguments)}().then((function(t){e&&(c(t),t.length&&y(t[0]))})).catch((function(){e&&d(!0)})).finally((function(){e&&s(!1)})),function(){e=!1}}),[]);var j=(0,r.useMemo)((function(){if(!m||!g)return null;try{return h(m.data,g,{})}catch(e){return null}}),[m,g]),w=(0,r.useMemo)((function(){return j?j.days.flatMap((function(e){return e.items.filter((function(e){return e.isAnchorMarker})).map((function(t){return X(X({},t),{},{day:e})}))})).slice(0,3):[]}),[j]);(0,r.useEffect)((function(){j&&m&&(0,z.L9)(z.OI.CALENDAR_LANDING_PREVIEWED,{protocol_slug:m.slug})}),[j,m]);var N=function(e){return function(){return(0,z.L9)(z.OI.CALENDAR_LANDING_SIGNIN_CLICKED,{source:e})}};return(0,H.jsxs)("main",{id:"tl-main",className:"tlc-lp",children:[(0,H.jsx)("section",{className:"tlc-sec tlc-hero-sec",children:(0,H.jsxs)("div",{className:"tlc-wrap tlc-hero",children:[(0,H.jsxs)("div",{className:"tlc-hero__copy",children:[(0,H.jsx)("p",{className:"tlc-eyebrow",children:"IVF Treatment Calendar"}),(0,H.jsxs)("h1",{className:"tlc-disp",children:["Your IVF cycle, every injection and scan, ",(0,H.jsx)("em",{children:"dated"}),"."]}),(0,H.jsx)("p",{className:"tlc-sub",children:"Built from the protocols Dr. Aniruddha and Dr. Anjali Malpani prescribe, counted from your Day 1, and moved for you when a scan changes a date."})]}),(0,H.jsxs)("div",{className:"tlc-card tlc-tool",children:[o&&(0,H.jsx)("p",{className:"tlc-muted",children:"Loading the protocolsâ¦"}),!o&&(u||0===a.length)&&(0,H.jsx)("p",{className:"tlc-muted",children:"The protocols could not be loaded just now. Reload the page, or sign in and build your calendar from your own prescribed protocol."}),!o&&!u&&a.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("span",{className:"tlc-field-lbl",id:"tlc-protocol-label",children:"Which protocol did Dr. Malpani prescribe?"}),(0,H.jsx)("div",{className:"tlc-radios",role:"radiogroup","aria-labelledby":"tlc-protocol-label",children:a.map((function(e){var t=m&&m.id===e.id;return(0,H.jsxs)("div",{role:"radio",tabIndex:0,"aria-checked":t,className:"tlc-radio".concat(t?" sel":""),onClick:function(){return y(e)},onKeyDown:function(t){"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),y(e))},children:[(0,H.jsx)("span",{className:"tlc-dot".concat(t?" sel":"")}),(0,H.jsxs)("span",{className:"tlc-radio__info",children:[(0,H.jsx)("span",{className:"tlc-radio__nm",children:e.name}),(0,H.jsx)("span",{className:"tlc-radio__ty",children:e.protocol_type})]})]},e.id)}))}),(0,H.jsx)("label",{className:"tlc-field-lbl",htmlFor:"tlc-lp-date",children:"First day of your last period"}),(0,H.jsxs)("div",{className:"tlc-dateinput",onClick:function(){var e;try{var t,n;null===(t=b.current)||void 0===t||null===(n=t.showPicker)||void 0===n||n.call(t)}catch(e){}null===(e=b.current)||void 0===e||e.focus()},children:[(0,H.jsx)("span",{children:g?new Date(g.replace(/-/g,"/")).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"long",year:"numeric"}):"Choose a date"}),(0,H.jsx)("span",{className:"tlc-dateinput__icon",children:(0,H.jsx)(ne,{})}),(0,H.jsx)("input",{ref:b,type:"date",id:"tlc-lp-date",className:"tlc-date-native",value:g,onChange:function(e){return x(e.target.value)}})]}),j&&w.length>0&&(0,H.jsxs)("div",{className:"tlc-dates",children:[(0,H.jsx)("p",{className:"tlc-dates__cap",children:"Your dates"}),(0,H.jsx)("div",{className:"tlc-dates__grid",children:w.map((function(e,t){return(0,H.jsxs)("div",{className:"tlc-dates__item",children:[(0,H.jsx)("span",{className:"tlc-cat mile",children:"Key date"}),(0,H.jsxs)("div",{className:"tlc-dates__day",children:["Day ",f(e.day.date,g)]}),(0,H.jsx)("div",{className:"tlc-dates__lbl",children:e.label})]},t)}))})]}),(0,H.jsx)("a",{className:"tlc-btn tlc-btn--primary tlc-btn--full",href:"/signin",onClick:N("hero"),children:"Save these dates"})]})]})]})}),(0,H.jsx)("section",{className:"tlc-sec tlc-parch tlc-cycle-sec",children:(0,H.jsxs)("div",{className:"tlc-wrap",children:[(0,H.jsx)("h2",{className:"tlc-head",children:"A real cycle, from Day 1 to the freeze"}),(0,H.jsx)("p",{className:"tlc-sub tlc-sub--center",children:"This is the Long Agonist protocol, counted from a period that started on Monday 6 October. The dates depend on the day you enter and on how the body responds."}),(0,H.jsxs)("div",{className:"tlc-cycle",children:[(0,H.jsx)("div",{className:"tlc-card tlc-list",children:ie.map((function(e,t){var n=Q(e,6),r=n[0],a=n[1],c=n[2],i=n[3],o=n[4],s=n[5];return(0,H.jsxs)("div",{className:"tlc-mrow",children:[(0,H.jsxs)("div",{className:"tlc-daychip",children:[(0,H.jsx)("div",{className:"tlc-daychip__d",children:r}),(0,H.jsx)("div",{className:"tlc-daychip__dt",children:a})]}),(0,H.jsxs)("div",{className:"tlc-mbody",children:[(0,H.jsx)("span",{className:"tlc-cat ".concat(c),children:i}),(0,H.jsx)("div",{className:"tlc-mbody__lbl",children:o}),(0,H.jsx)("div",{className:"tlc-mbody__exp",children:s})]})]},t)}))}),(0,H.jsxs)("div",{className:"tlc-card tlc-cal",children:[(0,H.jsx)("p",{className:"tlc-cal__hd",children:"October 2025 · the same cycle on a month view"}),(0,H.jsxs)("div",{className:"tlc-cgrid",children:[["Su","Mo","Tu","We","Th","Fr","Sa"].map((function(e){return(0,H.jsx)("div",{className:"tlc-dow",children:e},e)})),[0,1,2].map((function(e){return(0,H.jsx)("div",{className:"tlc-cell empty"},"e".concat(e))})),Array.from({length:31},(function(e,t){return t+1})).map((function(e){var t=oe[e];return(0,H.jsxs)("div",{className:"tlc-cell".concat(t?" evt":"").concat(t&&t[2]?" d1":""),children:[e,t&&(0,H.jsx)("span",{className:"tlc-cd ".concat(t[0]),children:t[1]})]},e)}))]}),(0,H.jsxs)("div",{className:"tlc-legend",children:[(0,H.jsx)("span",{children:(0,H.jsx)("span",{className:"tlc-cat mile",children:"Key date"})}),(0,H.jsxs)("span",{children:[(0,H.jsx)("span",{className:"tlc-cat scan",children:"Scan"})," at the clinic"]}),(0,H.jsxs)("span",{children:[(0,H.jsx)("span",{className:"tlc-cat med",children:"Medication"})," at home"]})]}),(0,H.jsx)("p",{className:"tlc-cal__note",children:"The daily injections sit between the marked days above. When a scan gives you a real date, you enter it and every date after it shifts to match."})]})]})]})}),(0,H.jsx)("section",{className:"tlc-sec tlc-band-sec",children:(0,H.jsx)("div",{className:"tlc-wrap",children:(0,H.jsxs)("div",{className:"tlc-keep",children:[(0,H.jsxs)("div",{className:"tlc-keep__copy",children:[(0,H.jsxs)("h2",{className:"tlc-head tlc-head--onink",children:["Keep it, tick it off, ",(0,H.jsx)("em",{children:"take it with you"})]}),(0,H.jsx)("p",{className:"tlc-keep__lead",children:"Signing in turns the preview into your own calendar for the cycle."}),(0,H.jsx)("a",{className:"tlc-btn tlc-btn--onlight",href:"/signin",onClick:N("keep_band"),children:"Sign in and build my calendar"}),(0,H.jsx)("p",{className:"tlc-keep__foot",children:"The same login you use for consultations and second opinions."})]}),(0,H.jsxs)("ul",{className:"tlc-keep__list",children:[(0,H.jsxs)("li",{children:[(0,H.jsx)("span",{className:"tlc-keep__ck",children:(0,H.jsx)(ae,{})}),"Saved to your patient account, so it is there every day of the cycle"]}),(0,H.jsxs)("li",{children:[(0,H.jsx)("span",{className:"tlc-keep__ck",children:(0,H.jsx)(ae,{})}),"Tick each step off as you go, and move a date when a scan changes it"]}),(0,H.jsxs)("li",{children:[(0,H.jsx)("span",{className:"tlc-keep__ck",children:(0,H.jsx)(ae,{})}),"Add the whole cycle to the calendar app on your phone"]}),(0,H.jsxs)("li",{children:[(0,H.jsx)("span",{className:"tlc-keep__ck",children:(0,H.jsx)(ae,{})}),"Dr. Aniruddha or Dr. Anjali Malpani can open it, check the dates, and leave a note on any step"]})]})]})})}),(0,H.jsx)("section",{className:"tlc-sec tlc-parch","aria-labelledby":"tlc-routing",children:(0,H.jsxs)("div",{className:"tlc-wrap",children:[(0,H.jsx)("h2",{id:"tlc-routing",className:"tlc-head",children:"Doctor hasn't assigned you a protocol yet?"}),(0,H.jsx)("p",{className:"tlc-sub tlc-sub--center",children:"Here is where to go instead."}),(0,H.jsxs)("div",{className:"tlc-routes",children:[(0,H.jsxs)("div",{className:"tlc-route",children:[(0,H.jsx)("h3",{children:"You are trying to conceive and have not started treatment"}),(0,H.jsx)("p",{children:"You do not need a treatment calendar yet. You need to know when you ovulate."}),(0,H.jsxs)("button",{type:"button",className:"tlc-route__a",onClick:function(){(0,z.L9)(z.OI.CALENDAR_LANDING_ROUTED_AWAY,{to:"ovulation"}),t("/fertility-tools/ovulation-calculator-plan-your-fertile-days")},children:["Work out your fertile days ",(0,H.jsx)(re,{})]})]}),(0,H.jsxs)("div",{className:"tlc-route",children:[(0,H.jsx)("h3",{children:"You are treated at another clinic"}),(0,H.jsx)("p",{children:"These are the protocols this clinic prescribes. Yours may count its days differently, so the dates here would be a guess."}),(0,H.jsxs)("button",{type:"button",className:"tlc-route__a",onClick:function(e){(0,z.L9)(z.OI.CALENDAR_LANDING_CHAT_CLICKED,{source:"dequal_other_clinic"}),function(e){e&&e.preventDefault(),"function"==typeof window._openChat&&window._openChat()}(e)},children:["Ask about your own protocol ",(0,H.jsx)(re,{})]})]}),(0,H.jsxs)("div",{className:"tlc-route",children:[(0,H.jsx)("h3",{children:"A cycle has failed and you want to understand why"}),(0,H.jsx)("p",{children:"A calendar will not answer that. Working through what happened will get you further."}),(0,H.jsxs)("button",{type:"button",className:"tlc-route__a",onClick:function(){(0,z.L9)(z.OI.CALENDAR_LANDING_ROUTED_AWAY,{to:"failed_ivf"}),t("/failed-ivf-assessment")},children:["Go through what happened ",(0,H.jsx)(re,{})]})]})]})]})}),(0,H.jsx)("section",{className:"tlc-sec",children:(0,H.jsx)("div",{className:"tlc-wrap",children:(0,H.jsxs)("div",{className:"tlc-cred",children:[(0,H.jsx)("div",{className:"tlc-cred__portrait",children:q.uN.map((function(e){return(0,H.jsx)("img",{src:e.photo,alt:e.alt,width:"240",height:"300",loading:"lazy"},e.key)}))}),(0,H.jsxs)("div",{className:"tlc-cred__body",children:[(0,H.jsx)("p",{className:"tlc-cred__since",children:"In IVF since 1991"}),q.uN.map((function(e){return(0,H.jsx)("p",{className:"tlc-cred__nm",children:e.name},e.key)})),(0,H.jsx)("p",{className:"tlc-cred__fact",children:q.x2.chair}),(0,H.jsx)("p",{className:"tlc-cred__fact",children:q.x2.registry}),(0,H.jsx)("p",{className:"tlc-cred__fact",children:q.x2.book}),(0,H.jsxs)("a",{className:"tlc-cred__link",href:q.x2.profileUrl,children:["Read the full profile ",(0,H.jsx)(re,{})]})]})]})})}),(0,H.jsx)("section",{className:"tlc-sec tlc-ink-sec",children:(0,H.jsxs)("div",{className:"tlc-wrap tlc-closing",children:[(0,H.jsxs)("h2",{className:"tlc-head tlc-head--onink",children:["See your dates, ",(0,H.jsx)("em",{children:"then save them"})]}),(0,H.jsx)("p",{className:"tlc-sub tlc-sub--onink",children:"Pick your protocol above to see the whole cycle now, and sign in when you want to keep it."}),(0,H.jsx)("a",{className:"tlc-btn tlc-btn--onlight",href:"/signin",onClick:N("closing"),children:"Sign in and build my calendar"})]})}),(0,H.jsx)("section",{className:"tlc-sec tlc-disc-sec",children:(0,H.jsx)("div",{className:"tlc-wrap",children:(0,H.jsxs)("div",{className:"tlc-disc",children:[(0,H.jsx)("span",{className:"tlc-disc__icon",children:(0,H.jsx)(ce,{})}),(0,H.jsxs)("p",{className:"tlc-disc__body",children:[(0,H.jsx)("strong",{children:"Please note:"})," this is an indicative schedule to help you plan and prepare. Your actual dates depend on how your body responds and on your scan results. Your doctor's instructions always take precedence over this calendar."]}),(0,H.jsx)("a",{className:"tlc-btn tlc-btn--outline",href:"/book-online-consultation-with-dr-malpani-ivf-specialist/",children:"Consult with Dr. Malpani"})]})})})]})}function le(e){return le="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},le(e)}var ue=["_done"],de=["_done"];function he(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};
vendor: 4,874 bytes, line 2
2t%2?he(Object(n),!0).forEach((function(t){fe(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):he(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function fe(e,t,n){var r;return r=function(e,t){if("object"!=le(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=le(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==le(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function me(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ye(){ye=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},c="function"==typeof Symbol?Symbol:{},i=c.iterator||"@@iterator",o=c.asyncIterator||"@@asyncIterator",s=c.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function u(e,t,n,r){var c=t&&t.prototype instanceof v?t:v,i=Object.create(c.prototype),o=new C(r||[]);return a(i,"_invoke",{value:S(e,n,o)}),i}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",p="suspendedYield",f="executing",m="completed",y={};function v(){}function g(){}function x(){}var b={};l(b,i,(function(){return this}));var j=Object.getPrototypeOf,w=j&&j(j(D([])));w&&w!==n&&r.call(w,i)&&(b=w);var N=x.prototype=v.prototype=Object.create(b);function _(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function n(a,c,i,o){var s=d(e[a],e,c);if("throw"!==s.type){var l=s.arg,u=l.value;return u&&"object"==le(u)&&r.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(u).then((function(e){l.value=e,i(l)}),(function(e){return n("throw",e,i,o)}))}o(s.arg)}var c;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return c=c?c.then(a,a):a()}})}function S(t,n,r){var a=h;return function(c,i){if(a===f)throw new Error("Generator is already running");if(a===m){if("throw"===c)throw i;return{value:e,done:!0}}for(r.method=c,r.arg=i;;){var o=r.delegate;if(o){var s=O(o,r);if(s){if(s===y)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===h)throw a=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=f;var l=d(t,n,r);if("normal"===l.type){if(a=r.done?m:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(a=m,r.method="throw",r.arg=l.arg)}}}function O(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,O(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var c=d(a,t.iterator,n.arg);if("throw"===c.type)return n.method="throw",n.arg=c.arg,n.delegate=null,y;var i=c.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function C(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function D(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,c=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return c.next=c}}throw new TypeError(le(t)+" is not iterable")}return g.prototype=x,a(N,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:g,configurable:!0}),g.displayName=l(x,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,x):(e.__proto__=x,l(e,s,"GeneratorFunction")),e.prototype=Object.create(N),e},t.awrap=function(e){return{__await:e}}
2,_(k.prototype),l(k.prototype,o,(function(){return this})),t.AsyncIterator=k,t.async=function(e,n,r,a,c){void 0===c&&(c=Promise);var i=new k(u(e,n,r,a),c);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},_(N),l(N,s,"Generator"),l(N,i,(function(){return this})),l(N,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=D,C.prototype={constructor:C,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var c=this.tryEntries.length-1;c>=0;--c){var i=this.tryEntries[c],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var c=a;break}}c&&("break"===e||"continue"===e)&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var i=c?c.completion:{};return i.type=e,i.arg=t,c?(this.method="next",this.next=c.finallyLoc,y):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),L(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;L(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:D(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function ve(e,t,n,r,a,c,i){try{var o=e[c](i),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,a)}function ge(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var c=e.apply(t,n);function i(e){ve(c,r,a,i,o,"next",e)}function o(e){ve(c,r,a,i,o,"throw",e)}i(void 0)}))}}function xe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,c,i,o=[],s=!0,l=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=c.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){l=!0,a=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return be(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return be(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function be(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function je(e){return e.isAnchorMarker?"anchor:".concat(e.anchorKey):"step:".concat(e.dateKey,":").concat(e.anchorKey,":").concat(e.label)}var we=function(){return(0,H.jsxs)("div",{className:"tpc-disclaimer",children:[(0,H.jsx)("strong",{children:"Please note:"})," this is an indicative schedule to help you plan and prepare. Your actual dates depend on how your body responds and on your scan results. Your doctor's instructions always take precedence over this calendar."]})},Ne=function(e){var t=e.label;return(0,H.jsx)("div",{className:"tpc-spinner",children:t||"Loadingâ¦"})}
2,_e={medication:"Medication",scan:"Scan",milestone:"Key date",action:"Action",note:"Note"},ke={medication:"You take this at home",scan:"Come to the clinic"};function Se(e){var t=e.value,n=e.onChange,a=e.id,c=e.autoFocus,i=e.style,o=e.className,s=(0,r.useRef)(null);return(0,H.jsx)("input",{ref:s,type:"date",id:a,value:t,onChange:n,onClick:function(){try{var e,t;null===(e=s.current)||void 0===e||null===(t=e.showPicker)||void 0===t||t.call(e)}catch(e){}},autoFocus:c,style:i,className:o,readOnly:!1})}function Oe(e){var t,n,a=e.schedule,c=e.done,i=e.canEdit,o=e.onToggleDone,s=e.onSetAnchorOverride,u=e.cycleStart,d=null===(t=a.days[0])||void 0===t?void 0:t.date,h=xe((0,r.useState)(d?d.getFullYear():(new Date).getFullYear()),2),m=h[0],y=h[1],v=xe((0,r.useState)(d?d.getMonth():(new Date).getMonth()),2),g=v[0],x=v[1],b=xe((0,r.useState)(null),2),j=b[0],w=b[1],N=xe((0,r.useState)(null),2),_=N[0],k=N[1],S=xe((0,r.useState)(""),2),O=S[0],E=S[1],L=(0,r.useMemo)((function(){var e={};return a.days.forEach((function(t){e[t.dateKey]=t})),e}),[a]),C=(0,r.useMemo)((function(){for(var e=new Date(m,g,1),t=new Date(m,g+1,0),n=[],r=0;r<e.getDay();r++)n.push(null);for(var a=1;a<=t.getDate();a++)n.push(new Date(m,g,a));return n}),[m,g]),D=new Date(m,g,1).toLocaleDateString(void 0,{month:"long",year:"numeric"}),A=j?L[j]:null,P=function(){_&&O&&s(_,O),k(null),E("")};return(0,H.jsxs)("div",{className:"tpc-cal-wrap",children:[(0,H.jsxs)("div",{className:"tpc-cal-nav",children:[(0,H.jsx)("button",{className:"tpc-cal-nav-btn",onClick:function(){0===g?(y((function(e){return e-1})),x(11)):x((function(e){return e-1}))},children:"â¹"}),(0,H.jsx)("span",{className:"tpc-cal-month",children:D}),(0,H.jsx)("button",{className:"tpc-cal-nav-btn",onClick:function(){11===g?(y((function(e){return e+1})),x(0)):x((function(e){return e+1}))},children:"âº"})]}),(0,H.jsx)("div",{className:"tpc-cal-dow",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map((function(e){return(0,H.jsx)("div",{children:e},e)}))}),(0,H.jsx)("div",{className:"tpc-cal-grid",children:C.map((function(e,t){if(!e)return(0,H.jsx)("div",{className:"tpc-cal-cell empty"},"e".concat(t));var n=l(e),r=L[n],a=null==r?void 0:r.items.some((function(e){return"milestone"===e.type})),i=f(e,u),o=n===j;return(0,H.jsxs)("div",{className:"tpc-cal-cell".concat(r?" has-events":"").concat(a?" milestone":"").concat(o?" active":""),onClick:function(){return r?w(o?null:n):null},children:[(0,H.jsx)("span",{className:"tpc-cal-dn",children:e.getDate()}),null!=i&&i>=1&&(0,H.jsxs)("span",{className:"tpc-cal-cd",children:["D",i]}),null==r?void 0:r.items.slice(0,2).map((function(e,t){return(0,H.jsx)("div",{className:"tpc-cal-chip ".concat(e.type).concat(c[je(e)]?" done":""),children:e.label.length>11?e.label.slice(0,10)+"â¦":e.label},t)})),r&&r.items.length>2&&(0,H.jsxs)("div",{className:"tpc-cal-more",children:["+",r.items.length-2]})]},n)}))}),A&&(0,H.jsxs)("div",{className:"tpc-cal-detail",children:[(0,H.jsxs)("div",{className:"tpc-cal-detail-hd",children:[A.date.toLocaleDateString(void 0,{weekday:"long",day:"numeric",month:"long",year:"numeric"}),(n=f(A.date,u),n>=1?" · Cycle Day ".concat(n):"")]}),A.items.map((function(e,t){var n,r=je(e),a=!!c[r],s=i&&e.isAnchorMarker&&_===e.anchorKey;return(0,H.jsxs)("div",{className:"tpc-item".concat(a?" done":""),children:[(0,H.jsx)("span",{className:"tpc-chip ".concat(e.type),children:null!==(n=_e[e.type])&&void 0!==n?n:e.type}),(0,H.jsxs)("div",{className:"body",style:{flex:1},children:[(0,H.jsx)("div",{className:"lbl",children:e.label}),ke[e.type]&&(0,H.jsx)("div",{className:"tpc-who",children:ke[e.type]}),e.detail&&(0,H.jsx)("div",{className:"det",children:e.detail}),e.isAnchorMarker&&i&&(s?(0,H.jsxs)("div",{className:"tpc-inline-edit",children:[(0,H.jsx)(Se,{value:O,autoFocus:!0,onChange:function(e){return E(e.target.value)}}),(0,H.jsx)("button",{className:"tpc-inline-confirm",onClick:P,children:"Set date"}),(0,H.jsx)("button",{className:"tpc-inline-cancel",onClick:function(){return k(null)},children:"Cancel"})]}):(0,H.jsxs)("button",{className:"tpc-edit-date-btn",onClick:function(){k(e.anchorKey),E(e.dateKey||"")},children:[p(e.date)," · Edit date"]}))]}),i&&(0,H.jsx)("button",{className:"tpc-done-btn".concat(a?" done":""),onClick:function(){return o(e)},children:a?"â Done":"Mark done"})]},t)}))]})]})}function Ee(e){var t=e.authUser,n=e.plans,r=e.plansLoading,a=e.navigate;return t?(0,H.jsxs)("div",{className:"tpc-container",children:[(0,H.jsxs)("div",{className:"tpc-hero",style:{paddingBottom:18},children:[(0,H.jsx)("h1",{children:"Your treatment calendars"}),(0,H.jsx)("p",{children:"Create a new calendar from your prescribed protocol, or open an existing one."}),(0,H.jsx)("button",{className:"tpc-cta",onClick:function(){return a("/ivf-treatment-calendar/new")},children:"+ Create a new calendar"})]}),(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("h2",{children:"Saved calendars"}),r?(0,H.jsx)(Ne,{label:"Loading your calendarsâ¦"}):0===n.length?(0,H.jsx)("p",{className:"tpc-muted",children:"You don't have a calendar yet. Create one to get started."}):n.map((function(e){return(0,H.jsxs)("div",{className:"tpc-planrow",children:[(0,H.jsxs)("div",{children:[(0,H.jsx)("div",{style:{fontWeight:600},children:e.title}),(0,H.jsxs)("div",{className:"meta",children:["Cycle start ",e.cycle_start_date||"â",e.doctor_reviewed?" · â Reviewed by doctor":""]})]}),(0,H.jsx)("button",{className:"tpc-btn primary",onClick:function(){return a("/ivf-treatment-calendar/plan/".concat(e.id))},children:"Open"})]},e.id)}))]}),(0,H.jsx)(we,{})]}):(0,H.jsx)(se,{navigate:a})}function Le(e){var t=e.authUser,n=e.templates,a=e.templatesLoading,c=e.navigate,i=xe((0,r.useState)(1),2),o=i[0],s=i[1],l=xe((0,r.useState)(null),2),u=l[0],d=l[1],h=xe((0,r.useState)(""),2),p=h[0],f=h[1],m=xe((0,r.useState)(!1),2),y=m[0],v=m[1],g=xe((0,r.useState)(""),2),x=g[0],b=g[1],j=!(!t||!t.isAdmin),w=xe((0,r.useState)(""),2),N=w[0],_=w[1],k=xe((0,r.useState)([]),2),S=k[0],O=k[1],E=xe((0,r.useState)(null),2),L=E[0],C=E[1],D=xe((0,r.useState)(!1),2),A=D[0],P=D[1],T=xe((0,r.useState)(!1),2),I=T[0],M=T[1];if((0,r.useEffect)((function(){if(j&&!L&&!I){var e=N.trim();if(!(e.length<2)){var t=!0;P(!0);var n=setTimeout((function(){(function(e){return V.apply(this,arguments)})(e).then((function(e){t&&O(e)})).catch((function(){t&&O([])})).finally((function(){t&&P(!1)}))}),300);return function(){t=!1,clearTimeout(n)}}O([])}}),[N,j,L,I]),!t)return(0,H.jsx)("div",{className:"tpc-container",children:(0,H.jsxs)("div",{className:"tpc-hero",children:[(0,H.jsx)("h1",{children:"Please sign in"}),(0,H.jsx)("p",{children:"You need to be signed in to create your treatment calendar."}),(0,H.jsx)("a",{className:"tpc-cta",href:"/signin",children:"Sign in"})]})});var F=function(){var e=ge(ye().mark((function e(){var t,n;return ye().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u&&p){e.next=2;break}return e.abrupt("return");case 2:return v(!0),b(""),e.prev=4,e.next=7,K({templateId:u.id,cycleStartDate:p,userId:j&&L?L.id:null});case 7:(t=e.sent)&&t.id?c("/ivf-treatment-calendar/plan/".concat(t.id)):b("Could not create the calendar. Please try again."),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(4),b((null===e.t0||void 0===e.t0||null===(n=e.t0.response)||void 0===n||null===(n=n.data)||void 0===n?void 0:n.message)||"Could not create the calendar. Please try again.");case 14:return e.prev=14,v(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[4,11,14,17]])})));return function(){return e.apply(this,arguments)}}();return(0,H.jsxs)("div",{className:"tpc-container",children:[(0,H.jsx)("a",{className:"tpc-back",onClick:function(){return c("/ivf-treatment-calendar/my-calendars")},style:{cursor:"pointer"},children:"â Back"}),(0,H.jsxs)("div",{className:"tpc-wizard",children:[(0,H.jsxs)("div",{className:"tpc-wizard-step".concat(o>=1?" active":"").concat(o>1?" done":""),children:[(0,H.jsx)("span",{className:"num",children:o>1?"â":"1"}),(0,H.jsx)("span",{className:"lbl",children:"Choose protocol"})]}),(0,H.jsx)("div",{className:"tpc-wizard-line"}),(0,H.jsxs)("div",{className:"tpc-wizard-step".concat(o>=2?" active":""),children:[(0,H.jsx)("span",{className:"num",children:"2"}),(0,H.jsx)("span",{className:"lbl",children:"Cycle start date"})]})]}),j&&1===o&&(0,H.jsxs)("div",{className:"tpc-card tpc-doctorpanel",children:[(0,H.jsx)("h2",{children:"Who is this calendar for?"}),L?(0,H.jsxs)("div",{className:"tpc-planrow",children:[(0,H.jsxs)("div",{children:[(0,H.jsx)("div",{style:{fontWeight:600},children:L.name}),(0,H.jsx)("div",{className:"meta",children:L.email})]}),(0,H.jsx)("button",{className:"tpc-btn",onClick:function(){C(null),_("")},children:"Change"})]}):I?(0,H.jsxs)("div",{className:"tpc-planrow",children:[(0,H.jsxs)("div",{children:[(0,H.jsx)("div",{style:{fontWeight:600},children:"No patient â anonymous"}),(0,H.jsxs)("div",{className:"meta",children:["Filed under your account",t.email?" (".concat(t.email,")"):""]})]}),(0,H.jsx)("button",{className:"tpc-btn",onClick:function(){return M(!1)},children:"Change"})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)("div",{className:"tpc-field",children:[(0,H.jsx)("label",{htmlFor:"tpc-patient-q",children:"Search by name or email"}),(0,H.jsx)("input",{id:"tpc-patient-q",type:"search",value:N,onChange:function(e){return _(e.target.value)},placeholder:"Start typing a patient's name"})]}),(0,H.jsxs)("div",{"aria-live":"polite",children:[A&&(0,H.jsx)("p",{className:"tpc-muted",children:"Searchingâ¦"}),!A&&N.trim().length>=2&&0===S.length&&(0,H.jsx)("p",{className:"tpc-muted",children:"No patient matches that. Check the spelling of the name or email."}),S.map((function(e){return(0,H.jsxs)("div",{className:"tpc-planrow",children:[(0,H.jsxs)("div",{children:[(0,H.jsx)("div",{style:{fontWeight:600},children:e.name}),(0,H.jsx)("div",{className:"meta",children:e.email})]}),(0,H.jsx)("button",{className:"tpc-btn primary",onClick:function(){return C(e)},children:"Choose"})]},e.id)}))]}),(0,H.jsxs)("div",{className:"tpc-anon-or",children:[(0,H.jsx)("span",{className:"tpc-muted",children:"or"}),(0,H.jsx)("button",{type:"button",className:"tpc-btn",onClick:function(){M(!0),_(""),O([])},children:"Create without a patient"})]}),(0,H.jsx)("p",{className:"tpc-muted",children:"An anonymous calendar is filed under your own account; you can share or reassign it later."})]})]}),1===o&&(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("h2",{children:"Which protocol has your doctor prescribed?"}),(0,H.jsx)("p",{className:"tpc-muted",children:"Not sure? Check your consultation letter or ask the clinic."}),a?(0,H.jsx)(Ne,{label:"Loading protocolsâ¦"}):0===n.length?(0,H.jsx)("p",{className:"tpc-muted",children:"No protocols are available yet. Please contact the clinic, or try again shortly."}):(0,H.jsx)("div",{className:"tpc-radio-list",children:n.map((function(e){return(0,H.jsxs)("label",{className:"tpc-radio-item".concat(u&&u.id===e.id?" sel":""),onClick:function(){return d(e)},children:[(0,H.jsx)("span",{className:"tpc-radio-dot".concat(u&&u.id===e.id?" sel":"")}),(0,H.jsxs)("div",{className:"info",children:[(0,H.jsx)("span",{className:"name",children:e.name}),e.description&&(0,H.jsx)("span",{className:"desc",children:e.description})]}),e.protocol_type&&(0,H.jsx)("span",{className:"tpc-tag",children:e.protocol_type})]},e.id)}))}),(0,H.jsx)("div",{style:{marginTop:20},children:(0,H.jsx)("button",{className:"tpc-cta",disabled:!u,onClick:function(){return s(2)},children:"Next â"})})]}),2===o&&(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("button",{className:"tpc-back",style:{cursor:"pointer",marginBottom:12,display:"inline-block"},onClick:function(){return s(1)},children:"â Change protocol"}),(0,H.jsxs)("div",{className:"tpc-selected-protocol",children:["Protocol: ",(0,H.jsx)("strong",{children:null==u?void 0:u.name}),(null==u?void 0:u.protocol_type)&&(0,H.jsx)("span",{className:"tpc-tag",style:{marginLeft:8},children:u.protocol_type})]}),(0,H.jsx)("h2",{style:{marginTop:16},children:"When did your period start?"}),(0,H.jsx)("p",{className:"tpc-muted",children:"Day 1 is the first day of full, bright-red bleeding. If it hasn't started yet, enter your expected start date. You can always update it later."}),(0,H.jsxs)("div",{className:"tpc-field",style:{marginTop:12},children:[(0,H.jsx)("label",{htmlFor:"tpc-start",children:"Period start date (Day 1)"}),(0,H.jsx)(Se,{id:"tpc-start",value:p,onChange:function(e){return f(e.target.value)},autoFocus:!0})]}),x&&(0,H.jsx)("div",{className:"tpc-banner",children:x}),(0,H.jsx)("button",{className:"tpc-cta",onClick:F,disabled:!p||y,children:y?"Creatingâ¦":"Generate my calendar â"})]}),(0,H.jsx)(we,{})]})}function Ce(e){var t=e.authUser,n=e.planId,a=e.navigate,c=xe((0,r.useState)(null),2),i=c[0],o=c[1],s=xe((0,r.useState)(!0),2),l=s[0],u=s[1],d=xe((0,r.useState)(""),2),m=d[0],y=d[1],v=xe((0,r.useState)(""),2),b=v[0],j=v[1],w=xe((0,r.useState)({}),2),N=w[0],_=w[1],k=xe((0,r.useState)({}),2),S=k[0],O=k[1],E=xe((0,r.useState)(""),2),L=E[0],C=E[1],D=xe((0,r.useState)(!1),2),A=D[0],P=D[1],T=xe((0,r.useState)({}),2),I=T[0],M=T[1],G=xe((0,r.useState)(null),2),K=G[0],R=G[1],U=xe((0,r.useState)(""),2),B=U[0],V=U[1],q=xe((0,r.useState)(!1),2),z=q[0],Z=q[1],$=xe((0,r.useState)(!1),2),X=$[0],J=$[1],Q=xe((0,r.useState)("list"),2),ee=Q[0],te=Q[1],ne=xe((0,r.useState)(null),2),re=ne[0],ae=ne[1],ce=xe((0,r.useState)(""),2),ie=ce[0],oe=ce[1],se=xe((0,r.useState)({}),2),le=se[0],he=se[1],ve=xe((0,r.useState)(!1),2),be=ve[0],Ee=ve[1],Le=xe((0,r.useState)(""),2),Ce=Le[0],De=Le[1],Ae=(0,r.useCallback)(ge(ye().mark((function e(){var t,r,a,c,i,s,l,d;return ye().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u(!0),y(""),e.prev=2,e.next=5,F(n);case 5:(t=e.sent)?(o(t),j(t.cycle_start_date||""),r=t.overrides&&!Array.isArray(t.overrides)?t.overrides:{},a=r._done,c=void 0===a?{}:a,i=me(r,ue),_(i),O(c),C(t.doctor_notes||""),P(!!t.doctor_reviewed),s=t.entry_notes&&!Array.isArray(t.entry_notes)?t.entry_notes:{},M(s)):y("Plan not found."),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),401===(null===e.t0||void 0===e.t0||null===(l=e.t0.response)||void 0===l?void 0:l.status)?y("unauth"):404===(null===e.t0||void 0===e.t0||null===(d=e.t0.response)||void 0===d?void 0:d.status)?y("Plan not found, or you do not have access to it."):y("Something went wrong loading this calendar.");case 12:return e.prev=12,u(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[2,9,12,15]])}))),[n]);(0,r.useEffect)((function(){Ae()}),[Ae]);var Pe=(0,r.useMemo)((function(){return i?h(i.data,b,N):null}),[i,b,N]),Te=i&&i.can_edit,Ie=(0,r.useCallback)((function(e,t){_((function(n){var r=pe({},n);return t?r[e]=t:delete r[e],r})),Z(!0)}),[]),Me=(0,r.useCallback)((function(e){var t=je(e);O((function(e){var n=pe({},e);return n[t]?delete n[t]:n[t]=!0,n})),Z(!0)}),[]),Fe=function(){re&&Ie(re,ie),ae(null),oe("")},Ge=function(){ae(null),oe("")},Ke=function(){var e=ge(ye().mark((function e(){var t,r,a,c,s,l,u;return ye().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return J(!0),e.prev=1,t=Object.keys(S).length>0?pe(pe({},N),{},{_done:S}):pe({},N),r={cycle_start_date:b,overrides:t},i.is_admin&&(r.doctor_notes=L,r.doctor_reviewed=A,r.entry_notes=I),e.next=7,Y(n,r);case 7:(a=e.sent)&&(o(a),c=a.overrides&&!Array.isArray(a.overrides)?a.overrides:{},s=c._done,l=void 0===s?{}:s,u=me(c,de),_(u),O(l),Z(!1)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),y("Could not save your changes. Please try again.");case 14:return e.prev=14,J(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})));return function(){return e.apply(this,arguments)}}(),Re=function(){var e=ge(ye().mark((function e(){var t,r;return ye().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ee(!0),De(""),e.prev=2,e.next=5,W(n);case 5:t=e.sent,De((null==t?void 0:t.message)||(null!=t&&t.success?"Email sent â":"Failed to send.")),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),De((null===e.t0||void 0===e.t0||null===(r=e.t0.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.message)||"Failed to send email.");case 12:return e.prev=12,Ee(!1),e.finish(12);case 15:case"end":return e.stop()}}),e,null,[[2,9,12,15]])})));return function(){return e.apply(this,arguments)}}(),Ye=(0,r.useRef)(null);Ye.current=Ke;var Ue,We,Be,Ve=
2(0,r.useRef)(null);return(0,r.useEffect)((function(){if(Te)return clearTimeout(Ve.current),Ve.current=setTimeout((function(){var e;return null===(e=Ye.current)||void 0===e?void 0:e.call(Ye)}),1500),function(){return clearTimeout(Ve.current)}}),[S,Te]),l?(0,H.jsx)("div",{className:"tpc-container",children:(0,H.jsx)(Ne,{label:"Loading your calendarâ¦"})}):"unauth"===m||!t&&!i?(0,H.jsx)("div",{className:"tpc-container",children:(0,H.jsxs)("div",{className:"tpc-hero",children:[(0,H.jsx)("h1",{children:"Please sign in"}),(0,H.jsx)("p",{children:"Sign in to view this treatment calendar."}),(0,H.jsx)("a",{className:"tpc-cta",href:"/signin",children:"Sign in"})]})}):m&&"unauth"!==m?(0,H.jsxs)("div",{className:"tpc-container",children:[(0,H.jsx)("a",{className:"tpc-back",onClick:function(){return a("/ivf-treatment-calendar/my-calendars")},style:{cursor:"pointer"},children:"â Back"}),(0,H.jsx)("div",{className:"tpc-card",children:(0,H.jsx)("p",{children:m})})]}):i&&Pe?(0,H.jsxs)("div",{className:"tpc-container",children:[(0,H.jsx)("a",{className:"tpc-back",onClick:function(){return a("/ivf-treatment-calendar/my-calendars")},style:{cursor:"pointer"},children:"â All calendars"}),i.is_admin_view&&(0,H.jsxs)("div",{className:"tpc-banner admin",children:["You are reviewing ",(0,H.jsx)("strong",{children:i.patient_name||"a patient"}),"'s calendar as clinic staff. Changes you save are shared with the patient."]}),(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("div",{className:"tpc-protocol-type",children:i.protocol_type}),(0,H.jsx)("h2",{style:{marginTop:4},children:i.title}),i.doctor_reviewed&&(0,H.jsx)("span",{className:"tpc-muted",children:"â Reviewed by your doctor"})]}),(0,H.jsx)(we,{}),(0,H.jsxs)("div",{className:"tpc-toolbar",children:[Te&&(0,H.jsxs)("div",{className:"tpc-toolbar-save",children:[(0,H.jsx)("button",{className:"tpc-btn primary",onClick:Ke,disabled:X||!z,children:X?"Savingâ¦":"Save changes"}),z&&(0,H.jsx)("span",{className:"tpc-unsaved",children:"Unsaved changes"})]}),(0,H.jsxs)("div",{className:"tpc-view-toggle",children:[(0,H.jsx)("button",{className:"tpc-toggle-btn".concat("list"===ee?" active":""),onClick:function(){return te("list")},children:"List"}),(0,H.jsx)("button",{className:"tpc-toggle-btn".concat("calendar"===ee?" active":""),onClick:function(){return te("calendar")},children:"Calendar"})]}),(0,H.jsxs)("div",{className:"tpc-toolbar-exports",children:[i.ics_url&&(0,H.jsx)("a",{className:"tpc-btn",href:i.ics_url.replace(/^https?:\/\//,"webcal://"),children:"Apple Calendar"}),i.ics_url&&(0,H.jsx)("a",{className:"tpc-btn",href:"https://calendar.google.com/calendar/r/settings/addbyurl?url=".concat(encodeURIComponent(i.ics_url)),target:"_blank",rel:"noopener noreferrer",children:"Google Calendar"}),(0,H.jsx)("button",{className:"tpc-btn",onClick:function(){Pe&&g(Pe.events,i.title,"ivf-treatment-calendar.ics")},children:"Outlook / other"}),(0,H.jsx)("button",{className:"tpc-btn",onClick:function(){return window.print()},children:"Print"})]})]}),Te&&(0,H.jsxs)("div",{className:"tpc-cycle-bar",children:[(0,H.jsx)("label",{htmlFor:"tpc-cs-input",children:"Cycle start (Day 1)"}),(0,H.jsx)(Se,{id:"tpc-cs-input",value:b,onChange:function(e){return t=e.target.value,j(t),void Z(!0);var t}}),(0,H.jsx)("span",{className:"tpc-muted",children:"Changing this shifts your entire schedule"})]}),"calendar"===ee&&(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("h2",{style:{fontSize:"1.15rem",marginBottom:14},children:"Calendar view"}),(0,H.jsx)(Oe,{schedule:Pe,done:S,canEdit:Te,onToggleDone:Me,onSetAnchorOverride:Ie,cycleStart:b})]}),"list"===ee&&(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("h2",{style:{fontSize:"1.15rem"},children:"Day-by-day schedule"}),(Ue=Pe.days.reduce((function(e,t){return e+t.items.length}),0),We=Object.keys(S).length,Be=Ue>0?Math.round(We/Ue*100):0,(0,H.jsxs)("div",{className:"tpc-progress",children:[(0,H.jsx)("div",{className:"tpc-progress-bar",role:"progressbar","aria-valuenow":We,"aria-valuemax":Ue,children:(0,H.jsx)("div",{className:"tpc-progress-fill",style:{width:"".concat(Be,"%")}})}),(0,H.jsxs)("span",{className:"tpc-progress-label",children:[We," of ",Ue," steps done"]})]})),Pe.days.map((function(e){var t=e.items.some((function(e){return"milestone"===e.type})),n=f(e.date,b);return(0,H.jsxs)("div",{className:"tpc-day".concat(t?" milestone-day":""),children:[(0,H.jsxs)("div",{className:"datebox",children:[(0,H.jsx)("div",{className:"dow",children:e.date.toLocaleDateString(void 0,{weekday:"short"})}),(0,H.jsx)("div",{className:"dnum",children:e.date.getDate()}),(0,H.jsx)("div",{className:"mon",children:e.date.toLocaleDateString(void 0,{month:"short",year:"numeric"})}),null!=n&&n>=1&&(0,H.jsxs)("div",{className:"cday",children:["Cycle Day ",n]})]}),(0,H.jsx)("div",{className:"items",children:e.items.map((function(t,n){var r,a=je(t),c=!!S[a],o="".concat(e.dateKey,":").concat(n),s=Te&&t.isAnchorMarker&&re===t.anchorKey,l=t.isAnchorMarker&&!!N[t.anchorKey];return(0,H.jsxs)("div",{className:"tpc-item".concat(c?" done":""),children:[(0,H.jsx)("span",{className:"tpc-chip ".concat(t.type),children:null!==(r=_e[t.type])&&void 0!==r?r:t.type}
2),(0,H.jsxs)("div",{className:"body",style:{flex:1},children:[(0,H.jsxs)("div",{className:"lbl",children:[t.label,l&&(0,H.jsx)("span",{className:"tpc-pin",title:"Date pinned to this day",children:"pinned"})]}),ke[t.type]&&(0,H.jsx)("div",{className:"tpc-who",children:ke[t.type]}),t.isAnchorMarker&&Te&&(s?(0,H.jsxs)("div",{className:"tpc-inline-edit",children:[(0,H.jsx)(Se,{value:ie,autoFocus:!0,onChange:function(e){return oe(e.target.value)}}),(0,H.jsx)("button",{className:"tpc-inline-confirm",onClick:Fe,children:"Set date"}),(0,H.jsx)("button",{className:"tpc-inline-cancel",onClick:Ge,children:"Cancel"}),l&&(0,H.jsx)("button",{className:"reset",onClick:function(){Ie(t.anchorKey,""),Ge()},children:"Reset to auto"})]}):(0,H.jsxs)("button",{className:"tpc-edit-date-btn",onClick:function(){return e=t.anchorKey,n=N[t.anchorKey]||t.dateKey,ae(e),void oe(n||"");var e,n},children:[p(t.date)," · Edit date"]})),t.detail&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("button",{className:"tpc-guide-btn",onClick:function(){return function(e){he((function(t){return pe(pe({},t),{},fe({},e,!t[e]))}))}(o)},children:le[o]?"â² Hide guide":"? What is this?"}),le[o]&&(0,H.jsx)("div",{className:"tpc-guide",children:t.detail})]}),I[a]&&K!==a&&(0,H.jsxs)("div",{className:"tpc-entry-note",children:[(0,H.jsx)("span",{className:"tpc-entry-note__who",children:"From your doctor"}),I[a]]}),i.is_admin&&(K===a?(0,H.jsxs)("div",{className:"tpc-note-edit",children:[(0,H.jsx)("textarea",{rows:2,autoFocus:!0,value:B,placeholder:"A remark the patient will see on this step",onChange:function(e){return V(e.target.value)}}),(0,H.jsxs)("div",{className:"tpc-note-edit__actions",children:[(0,H.jsx)("button",{className:"tpc-inline-confirm",onClick:function(){M((function(e){var t=pe({},e);return B.trim()?t[a]=B.trim():delete t[a],t})),Z(!0),R(null),V("")},children:"Save remark"}),(0,H.jsx)("button",{className:"tpc-inline-cancel",onClick:function(){R(null),V("")},children:"Cancel"})]})]}):(0,H.jsx)("button",{className:"tpc-guide-btn",onClick:function(){R(a),V(I[a]||"")},children:I[a]?"Edit this remark":"+ Add a remark"}))]}),(0,H.jsxs)("div",{className:"tpc-item-actions",children:["milestone"===t.type&&(0,H.jsx)("a",{className:"gcal",href:x(t),target:"_blank",rel:"noopener noreferrer",children:"+GCal"}),Te&&(0,H.jsx)("button",{className:"tpc-done-btn".concat(c?" done":""),onClick:function(){return Me(t)},children:c?"â Done":"Mark done"})]})]},n)}))})]},e.dateKey)}))]}),i.is_admin&&(0,H.jsxs)("div",{className:"tpc-card tpc-doctorpanel",children:[(0,H.jsx)("h2",{style:{fontSize:"1.15rem"},children:"Doctor's review"}),(0,H.jsxs)("div",{className:"tpc-field",children:[(0,H.jsx)("label",{children:"Notes for the patient"}),(0,H.jsx)("textarea",{rows:3,value:L,onChange:function(e){C(e.target.value),Z(!0)}})]}),(0,H.jsxs)("div",{className:"tpc-doctor-actions",children:[(0,H.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:".92rem"},children:[(0,H.jsx)("input",{type:"checkbox",checked:A,onChange:function(e){P(e.target.checked),Z(!0)}}),"Mark as reviewed"]}),(0,H.jsx)("button",{className:"tpc-btn",onClick:Re,disabled:be,children:be?"Sendingâ¦":"Email calendar to patient"}),Ce&&(0,H.jsx)("span",{className:"tpc-muted",style:{fontSize:".85rem"},children:Ce})]})]}),i.doctor_notes&&!i.is_admin&&(0,H.jsxs)("div",{className:"tpc-card",children:[(0,H.jsx)("h2",{style:{fontSize:"1.05rem"},children:"A note from your doctor"}),(0,H.jsx)("p",{style:{whiteSpace:"pre-wrap"},children:i.doctor_notes})]})]}):null}var De=function(){var e=(0,a.TH)(),t=(0,a.UO)(),n=(0,a.s0)(),i=xe((0,r.useState)((0,c.b)()),2),o=i[0],s=i[1],l=xe((0,r.useState)(!1),2),u=(l[0],l[1]),d=xe((0,r.useState)([]),2),h=d[0],p=d[1],f=xe((0,r.useState)(!1),2),m=f[0],y=f[1],v=xe((0,r.useState)([]),2),g=v[0],x=v[1],b=xe((0,r.useState)(!1),2),j=b[0],w=b[1],N=e.pathname.endsWith("/new"),_=!!t.id,k="1"===new URLSearchParams(e.search).get("admin");(0,r.useEffect)((function(){window.scrollTo(0,0)}),[e.pathname]),(0,r.useEffect)((function(){var e=!o&&!N&&!_;document.title=e?"IVF Treatment Calendar: Your Cycle Day by Day | Dr. Malpani IVF Clinic":"Your treatment calendars | Dr. Malpani IVF Clinic"}),[o,N,_]),(0,r.useEffect)((function(){var e=!0;return window.axios.get("/get-login-user").then((function(t){e&&(t.data&&t.data.id?s({id:t.data.id,name:t.data.name,email:t.data.email,roles:t.data.roles||[],isAdmin:!!t.data.is_admin}):s(null))})).catch((function(){e&&s((function(e){return e}))})).finally((function(){e&&u(!0)})),function(){e=!1}}),[]),(0,r.useEffect)((function(){N&&o&&(y(!0),function(){return I.apply(this,arguments)}().then((function(e){return p(e)})).catch((function(){return p([])})).finally((function(){return y(!1)})))}),[N,o]),(0,r.useEffect)((function(){N||_||!o||(w(!0),function(){return M.apply(this,arguments)}().then((function(e){return x(e)})).catch((function(){return x([])})).finally((function(){return w(!1)})))}),[N,_,o]);var S,O=!o&&!N&&!_;return S=_?(0,H.jsx)(Ce,{authUser:o,planId:t.id,navigate:n,isAdminFlag:k}):N?(0,H.jsx)(Le,{authUser:o,templates:h,templatesLoading:m,navigate:n}):(0,H.jsx)(Ee,{authUser:o,plans:g,plansLoading:j,navigate:n}),(0,H.jsxs)("div",{className:"tpc-wrap",children:[(0,H.jsx)("a",{className:"ui-skip-link",href:O?"#tl-main":"#tpc-main",children:"Skip to content"}),(0,H.jsx)(q.eC,{name:"IVF treatment calendar",navLinks:o?[{to:"/ivf-treatment-calendar/my-calendars",label:"My calendars"}]:[]}),O?S:(0,H.jsx)("main",{id:"tpc-main",children:S})]})}},6800:function(e,t,n){n.d(t,{Z:function(){return f}});var r=n(4379);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function c(){c=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",l=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function d(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{d({},"")}catch(e){d=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var a=t&&t.prototype instanceof x?t:x,c=Object.create(a.prototype),o=new A(r||[]);return i(c,"_invoke",{value:E(e,n,o)}),c}function p(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=h;var f="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function x(){}function b(){}function j(){}var w={};d(w,s,(function(){return this}));var N=Object.getPrototypeOf,_=N&&N(N(P([])));_&&_!==n&&r.call(_,s)&&(w=_);var k=j.prototype=x.prototype=Object.create(w);function S(e){["next","throw","return"].forEach((function(t){d(e,t,(function(e){return this._invoke(t,e)}))}
vendor: 5,010 bytes, line 2
2))}function O(e,t){function n(c,i,o,s){var l=p(e[c],e,i);if("throw"!==l.type){var u=l.arg,d=u.value;return d&&"object"==a(d)&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):t.resolve(d).then((function(e){u.value=e,o(u)}),(function(e){return n("throw",e,o,s)}))}s(l.arg)}var c;i(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return c=c?c.then(a,a):a()}})}function E(t,n,r){var a=f;return function(c,i){if(a===y)throw new Error("Generator is already running");if(a===v){if("throw"===c)throw i;return{value:e,done:!0}}for(r.method=c,r.arg=i;;){var o=r.delegate;if(o){var s=L(o,r);if(s){if(s===g)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=y;var l=p(t,n,r);if("normal"===l.type){if(a=r.done?v:m,l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(a=v,r.method="throw",r.arg=l.arg)}}}function L(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,L(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var c=p(a,t.iterator,n.arg);if("throw"===c.type)return n.method="throw",n.arg=c.arg,n.delegate=null,g;var i=c.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,g):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function P(t){if(t||""===t){var n=t[s];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var c=-1,i=function n(){for(;++c<t.length;)if(r.call(t,c))return n.value=t[c],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(a(t)+" is not iterable")}return b.prototype=j,i(k,"constructor",{value:j,configurable:!0}),i(j,"constructor",{value:b,configurable:!0}),b.displayName=d(j,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,j):(e.__proto__=j,d(e,u,"GeneratorFunction")),e.prototype=Object.create(k),e},t.awrap=function(e){return{__await:e}},S(O.prototype),d(O.prototype,l,(function(){return this})),t.AsyncIterator=O,t.async=function(e,n,r,a,c){void 0===c&&(c=Promise);var i=new O(h(e,n,r,a),c);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},S(k),d(k,u,"Generator"),d(k,s,(function(){return this})),d(k,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=P,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var c=this.tryEntries.length-1;c>=0;--c){var i=this.tryEntries[c],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),l=r.call(i,"finallyLoc");if(s&&l){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var c=a;break}}c&&("break"===e||"continue"===e)&&c.tryLoc<=t&&t<=c.finallyLoc&&(c=null);var i=c?c.completion:{};return i.type=e,i.arg=t,c?(this.method="next",this.next=c.finallyLoc,g):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),g},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];
2if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),D(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;D(n)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:P(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),g}},t}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t,n){var r;return r=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(t,"string"),(t="symbol"==a(r)?r:String(r))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,c,i,o=[],s=!0,l=!1;try{if(c=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=c.call(n)).done)&&(o.push(r.value),o.length!==t);s=!0);}catch(e){l=!0,a=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw a}}return o}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function d(e,t,n,r,a,c,i){try{var o=e[c](i),s=o.value}catch(e){return void n(e)}o.done?t(s):Promise.resolve(s).then(r,a)}function h(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var c=e.apply(t,n);function i(e){d(c,r,a,i,o,"next",e)}function o(e){d(c,r,a,i,o,"throw",e)}i(void 0)}))}}var p=function(e){var t;return(null===(t=document.querySelector('meta[name="'.concat(e,'"]')))||void 0===t?void 0:t.content)||""};function f(e){var t=e.tool,n=e.metaName,a=e.storageKey,i=e.routes,s=(p(n)||"").replace(/\/$/,""),u=function(){return""!==s},d="".concat(a,"_token"),f="".concat(a,"_refresh"),m=window.axios.create(),y=function(e){return localStorage.setItem(d,e.access_token),e.refresh_token&&localStorage.setItem(f,e.refresh_token),e.access_token},v=function(){localStorage.removeItem(d),localStorage.removeItem(f)},g=function(){try{return new URLSearchParams(window.location.search).get("mt")}catch(e){return null}};function x(e){return b.apply(this,arguments)}function b(){return(b=h(c().mark((function e(t){var n,r,a;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m.post("".concat(s,"/api/v1/mt/session"),{mt:t},{headers:{"Content-Type":"application/json"}});case 2:n=e.sent,r=n.data;try{(a=new URL(window.location.href)).searchParams.delete("mt"),window.history.replaceState({},"",a.toString())}catch(e){}return e.abrupt("return",y(r.data));case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var j=null;function w(){return(w=h(c().mark((function e(){var n,r,a,i,o;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!u()){e.next=4;break}if(!(n=g())){e.next=4;break}return e.abrupt("return",x(n));case 4:return e.next=6,window.axios.post("/api/tools/".concat(t,"/ticket"),{});case 6:return r=e.sent,a=r.data,e.next=10,m.post("".concat(s,"/api/v1/auth/session"),{ticket:a.data.ticket},{headers:{"Content-Type":"application/json"}});case 10:return i=e.sent,o=i.data,e.abrupt("return",y(o.data));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return j||(j=function(){return w.apply(this,arguments)}().finally((function(){j=null}))),j}function _(){return k.apply(this,arguments)}function k(){return k=h(c().mark((function e(){var t,n,r,a,i,o,l=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(l.length>0&&void 0!==l[0]?l[0]:{}).force,n=void 0!==t&&t){e.next=5;break}if(!(r=localStorage.getItem(d))){e.next=5;break}return e.abrupt("return",r);case 5:if(!(a=localStorage.getItem(f))||n){e.next=18;break}return e.prev=7,e.next=10,m.post("".concat(s,"/api/v1/auth/refresh"),{refresh_token:a});case 10:return i=e.sent,o=i.data,e.abrupt("return",y(o.data));case 15:e.prev=15,e.t0=e.catch(7),v();case 18:return e.abrupt("return",N());case 19:case"end":return e.stop()}}),e,null,[[7,15]])}))),k.apply(this,arguments)}function S(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l(i[e],2),r=n[0],a=n[1],c=u()?a:r;return Object.entries(t).forEach((function(e){var t=l(e,2),n=t[0],r=t[1];c=c.replace(":".concat(n),encodeURIComponent(r))})),u()?"".concat(s).concat(c):c}function O(){return O=h(c().mark((function e(t,n){var a,i,s,l,d,p,f,y,g=arguments;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=(a=g.length>2&&void 0!==g[2]?g[2]:{}).params,s=void 0===i?{}:i,l=a.data,d=a.config,p=void 0===d?{}:d,f=function(){var e=h(c().mark((function e(r){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(u()?m:window.axios).request(o(o({method:t,url:S(n,s),data:l},p),{},{headers:o(o({},p.headers||{}),{},{Authorization:"Bearer ".concat(r)})}
2)));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),u()){e.next=4;break}return e.abrupt("return",f((0,r.bW)()));case 4:return e.prev=4,e.t0=f,e.next=8,_();case 8:return e.t1=e.sent,e.next=11,(0,e.t0)(e.t1);case 11:return e.abrupt("return",e.sent);case 14:if(e.prev=14,e.t2=e.catch(4),401!==(null===e.t2||void 0===e.t2||null===(y=e.t2.response)||void 0===y?void 0:y.status)){e.next=23;break}return v(),e.t3=f,e.next=21,_({force:!0});case 21:return e.t4=e.sent,e.abrupt("return",(0,e.t3)(e.t4));case 23:throw e.t2;case 24:case"end":return e.stop()}}),e,null,[[4,14]])}))),O.apply(this,arguments)}return{BASE:s,isRemote:u,request:function(e,t){return O.apply(this,arguments)},requestPublic:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.params,a=void 0===r?{}:r,c=n.query,i=void 0===c?{}:c,s=n.config,l=void 0===s?{}:s;return(u()?m:window.axios).request(o({method:e,url:S(t,a),params:u()?i:void 0},l))},url:S,clearSession:v,isSignedIn:function(){return Boolean((0,r.bW)())||u()&&(Boolean(localStorage.getItem(d))||Boolean(g()))}}}}}]);
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.