Files
AdPlatform-Client/Client-Client/dist/bundle.js
Grae Jones dcb510e28c
All checks were successful
Client Client / build-deploy (push) Successful in 23s
Revised Client
2026-03-22 07:56:38 -07:00

2 lines
749 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*! For license information please see bundle.js.LICENSE.txt */
(()=>{"use strict";var e={20(e,t,n){var r=n(540),o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(e,t,n){var r,a={},l=null,d=null;for(r in void 0!==n&&(l=""+n),void 0!==t.key&&(l=""+t.key),void 0!==t.ref&&(d=t.ref),t)i.call(t,r)&&!c.hasOwnProperty(r)&&(a[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===a[r]&&(a[r]=t[r]);return{$$typeof:o,type:e,key:l,ref:d,props:a,_owner:s.current}}t.Fragment=a,t.jsx=l,t.jsxs=l},27(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,"/* ═══════════════════════════════════════════════════\n Campaign Intelligence Styles\n ═══════════════════════════════════════════════════ */\n\n/* Tabs */\n.intel-tabs {\n display: flex;\n gap: 4px;\n padding: 4px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-lg);\n margin-bottom: 24px;\n}\n.intel-tab {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 20px;\n background: none;\n border: none;\n border-radius: var(--radius-md);\n font-size: 14px;\n font-weight: 500;\n font-family: var(--font-sans);\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all var(--transition-fast);\n position: relative;\n}\n.intel-tab:hover { background: var(--color-bg-elevated); color: var(--color-text); }\n.intel-tab.active {\n background: var(--color-bg-elevated);\n color: var(--color-primary);\n box-shadow: var(--shadow-sm);\n font-weight: 600;\n}\n.tab-badge {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 20px;\n height: 20px;\n padding: 0 6px;\n background: var(--color-danger);\n color: white;\n border-radius: 10px;\n font-size: 11px;\n font-weight: 700;\n}\n\n/* Alert Summary */\n.intel-alert-summary { display: flex; gap: 8px; align-items: center; }\n.intel-alert-badge {\n display: inline-flex;\n align-items: center;\n padding: 4px 12px;\n border-radius: 16px;\n font-size: 12px;\n font-weight: 600;\n}\n.intel-alert-badge.sev-critical { background: var(--color-danger-light); color: var(--color-danger); }\n.intel-alert-badge.sev-warning { background: var(--color-warning-light); color: var(--color-warning); }\n.intel-alert-badge.sev-info { background: var(--color-primary-light); color: var(--color-primary); }\n\n/* Section Header */\n.intel-section-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 16px;\n}\n.intel-section-header h3 { font-size: 16px; font-weight: 600; }\n\n/* ─── Health Cards ─── */\n.health-grid { display: flex; flex-direction: column; gap: 16px; }\n.health-card {\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n padding: 20px;\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.health-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-text-muted); }\n.health-card.health-red { border-left: 4px solid var(--color-danger); }\n.health-card.health-yellow { border-left: 4px solid var(--color-warning); }\n.health-card.health-green { border-left: 4px solid var(--color-success); }\n\n.health-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n}\n.health-card-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; }\n.health-dot { font-size: 14px; }\n.health-status-label {\n font-size: 12px;\n font-weight: 600;\n padding: 2px 10px;\n border-radius: 12px;\n}\n.health-status-label.health-green { background: var(--color-success-light); color: var(--color-success); }\n.health-status-label.health-yellow { background: var(--color-warning-light); color: var(--color-warning); }\n.health-status-label.health-red { background: var(--color-danger-light); color: var(--color-danger); }\n\n.health-card-meta {\n display: flex;\n gap: 8px;\n font-size: 13px;\n color: var(--color-text-muted);\n margin-bottom: 14px;\n}\n\n.health-channels { display: flex; flex-direction: column; gap: 6px; }\n.health-channel-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 12px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-md);\n font-size: 13px;\n}\n.health-channel-info { display: flex; align-items: center; gap: 8px; min-width: 140px; }\n.health-channel-dot { font-size: 10px; }\n.health-channel-name { font-weight: 500; }\n.health-channel-stats { display: flex; gap: 16px; color: var(--color-text-secondary); }\n.health-channel-alerts { display: flex; gap: 4px; }\n.alert-count {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 22px;\n height: 22px;\n padding: 0 6px;\n border-radius: 11px;\n font-size: 11px;\n font-weight: 700;\n}\n.alert-count.sev-critical { background: var(--color-danger-light); color: var(--color-danger); }\n.alert-count.sev-warning { background: var(--color-warning-light); color: var(--color-warning); }\n\n/* ─── Recommendations ─── */\n.rec-filters { display: flex; gap: 6px; }\n.rec-list { display: flex; flex-direction: column; gap: 12px; }\n.rec-card {\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n padding: 16px 20px;\n transition: all var(--transition-fast);\n}\n.rec-card.sev-critical { border-left: 4px solid var(--color-danger); }\n.rec-card.sev-warning { border-left: 4px solid var(--color-warning); }\n.rec-card.sev-info { border-left: 4px solid var(--color-primary); }\n\n.rec-card-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 10px;\n font-size: 12px;\n}\n.rec-severity {\n font-weight: 700;\n padding: 2px 8px;\n border-radius: 8px;\n}\n.rec-severity.sev-critical { background: var(--color-danger-light); color: var(--color-danger); }\n.rec-severity.sev-warning { background: var(--color-warning-light); color: var(--color-warning); }\n.rec-severity.sev-info { background: var(--color-primary-light); color: var(--color-primary); }\n\n.rec-category {\n color: var(--color-text-muted);\n text-transform: capitalize;\n}\n.rec-channel { color: var(--color-text-secondary); font-weight: 500; }\n.rec-time { color: var(--color-text-muted); margin-left: auto; }\n\n.rec-card-body { margin-bottom: 12px; }\n.rec-initiative { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 4px; }\n.rec-message { font-size: 14px; color: var(--color-text); line-height: 1.5; }\n.rec-metric {\n margin-top: 8px;\n font-size: 12px;\n color: var(--color-text-muted);\n font-family: var(--font-mono);\n}\n.rec-metric strong { color: var(--color-text-secondary); }\n\n.rec-card-actions {\n display: flex;\n gap: 8px;\n padding-top: 12px;\n border-top: 1px solid var(--color-border-light);\n}\n\n/* ─── Budget Pacing ─── */\n.pacing-select-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));\n gap: 12px;\n}\n.pacing-select-card {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 16px 20px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n text-align: left;\n transition: all var(--transition-fast);\n font-family: var(--font-sans);\n}\n.pacing-select-card:hover { box-shadow: var(--shadow-md); border-color: var(--color-primary); }\n.pacing-select-name { font-size: 15px; font-weight: 600; color: var(--color-text); }\n.pacing-select-meta { font-size: 13px; color: var(--color-text-muted); }\n\n.pacing-bar-container {\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n padding: 20px;\n margin-top: 20px;\n}\n.pacing-bar-labels {\n display: flex;\n justify-content: space-between;\n font-size: 13px;\n color: var(--color-text-secondary);\n margin-bottom: 10px;\n}\n.pacing-bar {\n position: relative;\n height: 24px;\n background: var(--color-bg-subtle);\n border-radius: 12px;\n overflow: hidden;\n}\n.pacing-bar-expected {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background: var(--color-bg-muted);\n border-radius: 12px;\n z-index: 1;\n}\n.pacing-bar-actual {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n border-radius: 12px;\n z-index: 2;\n transition: width 0.5s ease;\n}\n.pacing-bar-actual.on-track { background: var(--color-success); opacity: 0.8; }\n.pacing-bar-actual.overpacing { background: var(--color-danger); opacity: 0.8; }\n.pacing-bar-actual.underpacing { background: var(--color-warning); opacity: 0.8; }\n\n.pacing-bar-legend {\n display: flex;\n gap: 20px;\n margin-top: 10px;\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.legend-dot {\n display: inline-block;\n width: 10px;\n height: 10px;\n border-radius: 5px;\n margin-right: 6px;\n vertical-align: middle;\n}\n.legend-dot.expected { background: var(--color-bg-muted); }\n.legend-dot.actual { background: var(--color-success); }\n\n/* Color helpers */\n.text-red { color: var(--color-danger) !important; }\n.text-orange { color: var(--color-warning) !important; }\n.text-green { color: var(--color-success) !important; }\n.text-blue { color: var(--color-primary) !important; }\n\n/* Responsive */\n@media (max-width: 900px) {\n .health-channel-stats { display: none; }\n .rec-card-header { flex-wrap: wrap; }\n .pacing-select-grid { grid-template-columns: 1fr; }\n}\n",""]);const s=i},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},72(e){var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var a={},i=[],s=0;s<e.length;s++){var c=e[s],l=r.base?c[0]+r.base:c[0],d=a[l]||0,u="".concat(l," ").concat(d);a[l]=d+1;var h=n(u),p={css:c[1],media:c[2],sourceMap:c[3],supports:c[4],layer:c[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var f=o(p,r);r.byIndex=s,t.splice(s,0,{identifier:u,updater:f,references:1})}i.push(u)}return i}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var a=r(e=e||[],o=o||{});return function(e){e=e||[];for(var i=0;i<a.length;i++){var s=n(a[i]);t[s].references--}for(var c=r(e,o),l=0;l<a.length;l++){var d=n(a[l]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}a=c}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},159(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},287(e,t){var n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.iterator,f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,m={};function v(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||f}function b(){}function y(e,t,n){this.props=e,this.context=t,this.refs=m,this.updater=n||f}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=v.prototype;var x=y.prototype=new b;x.constructor=y,g(x,v.prototype),x.isPureReactComponent=!0;var w=Array.isArray,k=Object.prototype.hasOwnProperty,C={current:null},S={key:!0,ref:!0,__self:!0,__source:!0};function j(e,t,r){var o,a={},i=null,s=null;if(null!=t)for(o in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(i=""+t.key),t)k.call(t,o)&&!S.hasOwnProperty(o)&&(a[o]=t[o]);var c=arguments.length-2;if(1===c)a.children=r;else if(1<c){for(var l=Array(c),d=0;d<c;d++)l[d]=arguments[d+2];a.children=l}if(e&&e.defaultProps)for(o in c=e.defaultProps)void 0===a[o]&&(a[o]=c[o]);return{$$typeof:n,type:e,key:i,ref:s,props:a,_owner:C.current}}function T(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}var I=/\/+/g;function A(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function N(e,t,o,a,i){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var c=!1;if(null===e)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case n:case r:c=!0}}if(c)return i=i(c=e),e=""===a?"."+A(c,0):a,w(i)?(o="",null!=e&&(o=e.replace(I,"$&/")+"/"),N(i,t,o,"",function(e){return e})):null!=i&&(T(i)&&(i=function(e,t){return{$$typeof:n,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(i,o+(!i.key||c&&c.key===i.key?"":(""+i.key).replace(I,"$&/")+"/")+e)),t.push(i)),1;if(c=0,a=""===a?".":a+":",w(e))for(var l=0;l<e.length;l++){var d=a+A(s=e[l],l);c+=N(s,t,o,d,i)}else if(d=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=p&&e[p]||e["@@iterator"])?e:null}(e),"function"==typeof d)for(e=d.call(e),l=0;!(s=e.next()).done;)c+=N(s=s.value,t,o,d=a+A(s,l++),i);else if("object"===s)throw t=String(e),Error("Objects are not valid as a React child (found: "+("[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return c}function E(e,t,n){if(null==e)return e;var r=[],o=0;return N(e,r,"","",function(e){return t.call(n,e,o++)}),r}function _(e){if(-1===e._status){var t=e._result;(t=t()).then(function(t){0!==e._status&&-1!==e._status||(e._status=1,e._result=t)},function(t){0!==e._status&&-1!==e._status||(e._status=2,e._result=t)}),-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var P={current:null},O={transition:null},R={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:O,ReactCurrentOwner:C};function M(){throw Error("act(...) is not supported in production builds of React.")}t.Children={map:E,forEach:function(e,t,n){E(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return E(e,function(){t++}),t},toArray:function(e){return E(e,function(e){return e})||[]},only:function(e){if(!T(e))throw Error("React.Children.only expected to receive a single React element child.");return e}},t.Component=v,t.Fragment=o,t.Profiler=i,t.PureComponent=y,t.StrictMode=a,t.Suspense=d,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=R,t.act=M,t.cloneElement=function(e,t,r){if(null==e)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o=g({},e.props),a=e.key,i=e.ref,s=e._owner;if(null!=t){if(void 0!==t.ref&&(i=t.ref,s=C.current),void 0!==t.key&&(a=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)k.call(t,l)&&!S.hasOwnProperty(l)&&(o[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)o.children=r;else if(1<l){c=Array(l);for(var d=0;d<l;d++)c[d]=arguments[d+2];o.children=c}return{$$typeof:n,type:e.type,key:a,ref:i,props:o,_owner:s}},t.createContext=function(e){return(e={$$typeof:c,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null}).Provider={$$typeof:s,_context:e},e.Consumer=e},t.createElement=j,t.createFactory=function(e){var t=j.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:l,render:e}},t.isValidElement=T,t.lazy=function(e){return{$$typeof:h,_payload:{_status:-1,_result:e},_init:_}},t.memo=function(e,t){return{$$typeof:u,type:e,compare:void 0===t?null:t}},t.startTransition=function(e){var t=O.transition;O.transition={};try{e()}finally{O.transition=t}},t.unstable_act=M,t.useCallback=function(e,t){return P.current.useCallback(e,t)},t.useContext=function(e){return P.current.useContext(e)},t.useDebugValue=function(){},t.useDeferredValue=function(e){return P.current.useDeferredValue(e)},t.useEffect=function(e,t){return P.current.useEffect(e,t)},t.useId=function(){return P.current.useId()},t.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)},t.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)},t.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)},t.useMemo=function(e,t){return P.current.useMemo(e,t)},t.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)},t.useRef=function(e){return P.current.useRef(e)},t.useState=function(e){return P.current.useState(e)},t.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)},t.useTransition=function(){return P.current.useTransition()},t.version="18.3.1"},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,o,a){"string"==typeof e&&(e=[[null,e,void 0]]);var i={};if(r)for(var s=0;s<this.length;s++){var c=this[s][0];null!=c&&(i[c]=!0)}for(var l=0;l<e.length;l++){var d=[].concat(e[l]);r&&i[d[0]]||(void 0!==a&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),t.push(d))}},t}},321(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,"/* ════════════════════════════════════════════════\n Forecast Comparison Card — AllocationStep\n Add to existing wizard stylesheet\n ════════════════════════════════════════════════ */\n\n.forecast-section {\n margin: 16px 0 24px;\n}\n\n.forecast-loading {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 20px;\n background: var(--surface-secondary, #f8f9fb);\n border-radius: 12px;\n color: var(--text-secondary, #6b7280);\n font-size: 0.9rem;\n}\n\n.forecast-error {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n background: #fef3c7;\n border-radius: 8px;\n color: #92400e;\n font-size: 0.85rem;\n}\n\n/* ── Card container ── */\n\n.forecast-card {\n background: var(--surface-secondary, #f8f9fb);\n border: 1px solid var(--border-light, #e5e7eb);\n border-radius: 12px;\n overflow: hidden;\n margin-bottom: 16px;\n}\n\n.forecast-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 14px 18px;\n border-bottom: 1px solid var(--border-light, #e5e7eb);\n background: white;\n}\n\n.forecast-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-weight: 600;\n font-size: 0.95rem;\n color: var(--text-primary, #1a1a2e);\n}\n\n.forecast-objective-tag {\n font-size: 0.78rem;\n padding: 3px 10px;\n border-radius: 20px;\n background: var(--primary-light, #eef2ff);\n color: var(--primary, #4F46E5);\n font-weight: 500;\n}\n\n/* ── Channel comparison columns ── */\n\n.forecast-channels {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));\n gap: 1px;\n background: var(--border-light, #e5e7eb);\n}\n\n.forecast-channel {\n background: white;\n padding: 16px 18px;\n}\n\n.forecast-channel-template {\n background: #fafafa;\n}\n\n.forecast-ch-header {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-bottom: 12px;\n flex-wrap: wrap;\n}\n\n.forecast-ch-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n.forecast-ch-name {\n font-weight: 600;\n font-size: 0.9rem;\n color: var(--text-primary, #1a1a2e);\n}\n\n.forecast-ch-budget {\n margin-left: auto;\n font-size: 0.85rem;\n font-weight: 500;\n color: var(--text-secondary, #6b7280);\n}\n\n/* ── Metrics grid ── */\n\n.forecast-ch-metrics {\n display: grid;\n grid-template-columns: repeat(2, 1fr);\n gap: 8px;\n margin-bottom: 10px;\n}\n\n.forecast-metric {\n display: flex;\n flex-direction: column;\n}\n\n.forecast-metric-value {\n font-size: 1.15rem;\n font-weight: 700;\n color: var(--text-primary, #1a1a2e);\n line-height: 1.2;\n}\n\n.forecast-metric-label {\n font-size: 0.75rem;\n color: var(--text-tertiary, #9ca3af);\n text-transform: uppercase;\n letter-spacing: 0.02em;\n}\n\n/* ── Detail row (CPC, CPM, CPA) ── */\n\n.forecast-ch-detail {\n display: flex;\n gap: 12px;\n flex-wrap: wrap;\n font-size: 0.8rem;\n color: var(--text-secondary, #6b7280);\n margin-bottom: 8px;\n}\n\n/* ── Strength label ── */\n\n.forecast-ch-strength {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 0.8rem;\n font-weight: 500;\n color: var(--text-secondary, #6b7280);\n padding-top: 8px;\n border-top: 1px solid var(--border-light, #e5e7eb);\n}\n\n.forecast-strength-dot {\n width: 6px;\n height: 6px;\n border-radius: 50%;\n}\n\n/* ── Confidence indicator ── */\n\n.forecast-ch-confidence {\n font-size: 0.75rem;\n color: var(--text-tertiary, #9ca3af);\n margin-top: 4px;\n}\n\n/* ── Template-only note (TikTok etc.) ── */\n\n.forecast-ch-template-note {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n font-size: 0.82rem;\n color: var(--text-tertiary, #9ca3af);\n line-height: 1.4;\n padding: 8px 0;\n}\n\n.forecast-ch-template-note svg {\n flex-shrink: 0;\n margin-top: 2px;\n}\n\n/* ── Recommendation highlights ── */\n\n.forecast-highlights {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n padding: 12px 18px;\n background: white;\n border-top: 1px solid var(--border-light, #e5e7eb);\n}\n\n.forecast-highlight {\n font-size: 0.82rem;\n padding: 4px 12px;\n background: var(--surface-secondary, #f8f9fb);\n border-radius: 20px;\n color: var(--text-secondary, #6b7280);\n}\n\n/* ── Reset button ── */\n\n.forecast-reset-btn {\n margin: 8px 18px 12px;\n}\n",""]);const s=i},338(e,t,n){var r=n(961);t.H=r.createRoot,r.hydrateRoot},463(e,t){function n(e,t){var n=e.length;e.push(t);e:for(;0<n;){var r=n-1>>>1,o=e[r];if(!(0<a(o,t)))break e;e[r]=t,e[n]=o,n=r}}function r(e){return 0===e.length?null:e[0]}function o(e){if(0===e.length)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;e:for(var r=0,o=e.length,i=o>>>1;r<i;){var s=2*(r+1)-1,c=e[s],l=s+1,d=e[l];if(0>a(c,n))l<o&&0>a(d,c)?(e[r]=d,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else{if(!(l<o&&0>a(d,n)))break e;e[r]=d,e[l]=n,r=l}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if("object"==typeof performance&&"function"==typeof performance.now){var i=performance;t.unstable_now=function(){return i.now()}}else{var s=Date,c=s.now();t.unstable_now=function(){return s.now()-c}}var l=[],d=[],u=1,h=null,p=3,f=!1,g=!1,m=!1,v="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,y="undefined"!=typeof setImmediate?setImmediate:null;function x(e){for(var t=r(d);null!==t;){if(null===t.callback)o(d);else{if(!(t.startTime<=e))break;o(d),t.sortIndex=t.expirationTime,n(l,t)}t=r(d)}}function w(e){if(m=!1,x(e),!g)if(null!==r(l))g=!0,O(k);else{var t=r(d);null!==t&&R(w,t.startTime-e)}}function k(e,n){g=!1,m&&(m=!1,b(T),T=-1),f=!0;var a=p;try{for(x(n),h=r(l);null!==h&&(!(h.expirationTime>n)||e&&!N());){var i=h.callback;if("function"==typeof i){h.callback=null,p=h.priorityLevel;var s=i(h.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?h.callback=s:h===r(l)&&o(l),x(n)}else o(l);h=r(l)}if(null!==h)var c=!0;else{var u=r(d);null!==u&&R(w,u.startTime-n),c=!1}return c}finally{h=null,p=a,f=!1}}"undefined"!=typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);var C,S=!1,j=null,T=-1,I=5,A=-1;function N(){return!(t.unstable_now()-A<I)}function E(){if(null!==j){var e=t.unstable_now();A=e;var n=!0;try{n=j(!0,e)}finally{n?C():(S=!1,j=null)}}else S=!1}if("function"==typeof y)C=function(){y(E)};else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,P=_.port2;_.port1.onmessage=E,C=function(){P.postMessage(null)}}else C=function(){v(E,0)};function O(e){j=e,S||(S=!0,C())}function R(e,n){T=v(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){g||f||(g=!0,O(k))},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return p},t.unstable_getFirstCallbackNode=function(){return r(l)},t.unstable_next=function(e){switch(p){case 1:case 2:case 3:var t=3;break;default:t=p}var n=p;p=t;try{return e()}finally{p=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=p;p=e;try{return t()}finally{p=n}},t.unstable_scheduleCallback=function(e,o,a){var i=t.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0<a?i+a:i,e){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return e={id:u++,callback:o,priorityLevel:e,startTime:a,expirationTime:s=a+s,sortIndex:-1},a>i?(e.sortIndex=a,n(d,e),null===r(l)&&e===r(d)&&(m?(b(T),T=-1):m=!0,R(w,a-i))):(e.sortIndex=s,n(l,e),g||f||(g=!0,O(k))),e},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},540(e,t,n){e.exports=n(287)},551(e,t,n){var r=n(540),o=n(982);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,s={};function c(e,t){l(e,t),l(e+"Capture",t)}function l(e,t){for(s[e]=t,e=0;e<t.length;e++)i.add(t[e])}var d=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),u=Object.prototype.hasOwnProperty,h=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p={},f={};function g(e,t,n,r,o,a,i){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=i}var m={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){m[e]=new g(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];m[t]=new g(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){m[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){m[e]=new g(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){m[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){m[e]=new g(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){m[e]=new g(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){m[e]=new g(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){m[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)});var v=/[\-:]([a-z])/g;function b(e){return e[1].toUpperCase()}function y(e,t,n,r){var o=m.hasOwnProperty(t)?m[t]:null;(null!==o?0!==o.type:r||!(2<t.length)||"o"!==t[0]&&"O"!==t[0]||"n"!==t[1]&&"N"!==t[1])&&(function(e,t,n,r){if(null==t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!u.call(f,e)||!u.call(p,e)&&(h.test(e)?f[e]=!0:(p[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(v,b);m[t]=new g(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(v,b);m[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(v,b);m[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){m[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)}),m.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){m[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)});var x=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,w=Symbol.for("react.element"),k=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),I=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),N=Symbol.for("react.suspense"),E=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),P=Symbol.for("react.lazy");Symbol.for("react.scope"),Symbol.for("react.debug_trace_mode");var O=Symbol.for("react.offscreen");Symbol.for("react.legacy_hidden"),Symbol.for("react.cache"),Symbol.for("react.tracing_marker");var R=Symbol.iterator;function M(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=R&&e[R]||e["@@iterator"])?e:null}var z,L=Object.assign;function D(e){if(void 0===z)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);z=t&&t[1]||""}return"\n"+z+e}var F=!1;function q(e,t){if(!e||F)return"";F=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&"string"==typeof t.stack){for(var o=t.stack.split("\n"),a=r.stack.split("\n"),i=o.length-1,s=a.length-1;1<=i&&0<=s&&o[i]!==a[s];)s--;for(;1<=i&&0<=s;i--,s--)if(o[i]!==a[s]){if(1!==i||1!==s)do{if(i--,0>--s||o[i]!==a[s]){var c="\n"+o[i].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}}while(1<=i&&0<=s);break}}}finally{F=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?D(e):""}function B(e){switch(e.tag){case 5:return D(e.type);case 16:return D("Lazy");case 13:return D("Suspense");case 19:return D("SuspenseList");case 0:case 2:case 15:return q(e.type,!1);case 11:return q(e.type.render,!1);case 1:return q(e.type,!0);default:return""}}function U(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case C:return"Fragment";case k:return"Portal";case j:return"Profiler";case S:return"StrictMode";case N:return"Suspense";case E:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case I:return(e.displayName||"Context")+".Consumer";case T:return(e._context.displayName||"Context")+".Provider";case A:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case _:return null!==(t=e.displayName||null)?t:U(e.type)||"Memo";case P:t=e._payload,e=e._init;try{return U(e(t))}catch(e){}}return null}function H(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=(e=t.render).displayName||e.name||"",t.displayName||(""!==e?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return U(t);case 8:return t===S?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if("function"==typeof t)return t.displayName||t.name||null;if("string"==typeof t)return t}return null}function K(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function $(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function G(e){e._valueTracker||(e._valueTracker=function(e){var t=$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function W(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function V(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function Q(e,t){var n=t.checked;return L({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function Y(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=K(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function J(e,t){null!=(t=t.checked)&&y(e,"checked",t,!1)}function X(e,t){J(e,t);var n=K(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?ee(e,t.type,n):t.hasOwnProperty("defaultValue")&&ee(e,t.type,K(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function Z(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function ee(e,t,n){"number"===t&&V(e.ownerDocument)===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var te=Array.isArray;function ne(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+K(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function re(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(a(91));return L({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function oe(e,t){var n=t.value;if(null==n){if(n=t.children,t=t.defaultValue,null!=n){if(null!=t)throw Error(a(92));if(te(n)){if(1<n.length)throw Error(a(93));n=n[0]}t=n}null==t&&(t=""),n=t}e._wrapperState={initialValue:K(n)}}function ae(e,t){var n=K(t.value),r=K(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function ie(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}function se(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ce(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?se(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var le,de,ue=(de=function(e,t){if("http://www.w3.org/2000/svg"!==e.namespaceURI||"innerHTML"in e)e.innerHTML=t;else{for((le=le||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}},"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,t,n,r){MSApp.execUnsafeLocalFunction(function(){return de(e,t)})}:de);function he(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var pe={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},fe=["Webkit","ms","Moz","O"];function ge(e,t,n){return null==t||"boolean"==typeof t||""===t?"":n||"number"!=typeof t||0===t||pe.hasOwnProperty(e)&&pe[e]?(""+t).trim():t+"px"}function me(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=ge(n,t[n],r);"float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(pe).forEach(function(e){fe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),pe[t]=pe[e]})});var ve=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function be(e,t){if(t){if(ve[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(a(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(a(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(a(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(a(62))}}function ye(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var xe=null;function we(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var ke=null,Ce=null,Se=null;function je(e){if(e=xo(e)){if("function"!=typeof ke)throw Error(a(280));var t=e.stateNode;t&&(t=ko(t),ke(e.stateNode,e.type,t))}}function Te(e){Ce?Se?Se.push(e):Se=[e]:Ce=e}function Ie(){if(Ce){var e=Ce,t=Se;if(Se=Ce=null,je(e),t)for(e=0;e<t.length;e++)je(t[e])}}function Ae(e,t){return e(t)}function Ne(){}var Ee=!1;function _e(e,t,n){if(Ee)return e(t,n);Ee=!0;try{return Ae(e,t,n)}finally{Ee=!1,(null!==Ce||null!==Se)&&(Ne(),Ie())}}function Pe(e,t){var n=e.stateNode;if(null===n)return null;var r=ko(n);if(null===r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}if(e)return null;if(n&&"function"!=typeof n)throw Error(a(231,t,typeof n));return n}var Oe=!1;if(d)try{var Re={};Object.defineProperty(Re,"passive",{get:function(){Oe=!0}}),window.addEventListener("test",Re,Re),window.removeEventListener("test",Re,Re)}catch(de){Oe=!1}function Me(e,t,n,r,o,a,i,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var ze=!1,Le=null,De=!1,Fe=null,qe={onError:function(e){ze=!0,Le=e}};function Be(e,t,n,r,o,a,i,s,c){ze=!1,Le=null,Me.apply(qe,arguments)}function Ue(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{!!(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function He(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&null!==(e=e.alternate)&&(t=e.memoizedState),null!==t)return t.dehydrated}return null}function Ke(e){if(Ue(e)!==e)throw Error(a(188))}function $e(e){return null!==(e=function(e){var t=e.alternate;if(!t){if(null===(t=Ue(e)))throw Error(a(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(null===o)break;var i=o.alternate;if(null===i){if(null!==(r=o.return)){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Ke(o),e;if(i===r)return Ke(o),t;i=i.sibling}throw Error(a(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,c=o.child;c;){if(c===n){s=!0,n=o,r=i;break}if(c===r){s=!0,r=o,n=i;break}c=c.sibling}if(!s){for(c=i.child;c;){if(c===n){s=!0,n=i,r=o;break}if(c===r){s=!0,r=i,n=o;break}c=c.sibling}if(!s)throw Error(a(189))}}if(n.alternate!==r)throw Error(a(190))}if(3!==n.tag)throw Error(a(188));return n.stateNode.current===n?e:t}(e))?Ge(e):null}function Ge(e){if(5===e.tag||6===e.tag)return e;for(e=e.child;null!==e;){var t=Ge(e);if(null!==t)return t;e=e.sibling}return null}var We=o.unstable_scheduleCallback,Ve=o.unstable_cancelCallback,Qe=o.unstable_shouldYield,Ye=o.unstable_requestPaint,Je=o.unstable_now,Xe=o.unstable_getCurrentPriorityLevel,Ze=o.unstable_ImmediatePriority,et=o.unstable_UserBlockingPriority,tt=o.unstable_NormalPriority,nt=o.unstable_LowPriority,rt=o.unstable_IdlePriority,ot=null,at=null,it=Math.clz32?Math.clz32:function(e){return 0===(e>>>=0)?32:31-(st(e)/ct|0)|0},st=Math.log,ct=Math.LN2,lt=64,dt=4194304;function ut(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194240&e;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return 130023424&e;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ht(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,o=e.suspendedLanes,a=e.pingedLanes,i=268435455&n;if(0!==i){var s=i&~o;0!==s?r=ut(s):0!==(a&=i)&&(r=ut(a))}else 0!==(i=n&~o)?r=ut(i):0!==a&&(r=ut(a));if(0===r)return 0;if(0!==t&&t!==r&&0===(t&o)&&((o=r&-r)>=(a=t&-t)||16===o&&4194240&a))return t;if(4&r&&(r|=16&n),0!==(t=e.entangledLanes))for(e=e.entanglements,t&=r;0<t;)o=1<<(n=31-it(t)),r|=e[n],t&=~o;return r}function pt(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function ft(e){return 0!=(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function gt(){var e=lt;return!(4194240&(lt<<=1))&&(lt=64),e}function mt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function vt(e,t,n){e.pendingLanes|=t,536870912!==t&&(e.suspendedLanes=0,e.pingedLanes=0),(e=e.eventTimes)[t=31-it(t)]=n}function bt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-it(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var yt=0;function xt(e){return 1<(e&=-e)?4<e?268435455&e?16:536870912:4:1}var wt,kt,Ct,St,jt,Tt=!1,It=[],At=null,Nt=null,Et=null,_t=new Map,Pt=new Map,Ot=[],Rt="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Mt(e,t){switch(e){case"focusin":case"focusout":At=null;break;case"dragenter":case"dragleave":Nt=null;break;case"mouseover":case"mouseout":Et=null;break;case"pointerover":case"pointerout":_t.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pt.delete(t.pointerId)}}function zt(e,t,n,r,o,a){return null===e||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[o]},null!==t&&null!==(t=xo(t))&&kt(t),e):(e.eventSystemFlags|=r,t=e.targetContainers,null!==o&&-1===t.indexOf(o)&&t.push(o),e)}function Lt(e){var t=yo(e.target);if(null!==t){var n=Ue(t);if(null!==n)if(13===(t=n.tag)){if(null!==(t=He(n)))return e.blockedOn=t,void jt(e.priority,function(){Ct(n)})}else if(3===t&&n.stateNode.current.memoizedState.isDehydrated)return void(e.blockedOn=3===n.tag?n.stateNode.containerInfo:null)}e.blockedOn=null}function Dt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==n)return null!==(t=xo(n))&&kt(t),e.blockedOn=n,!1;var r=new(n=e.nativeEvent).constructor(n.type,n);xe=r,n.target.dispatchEvent(r),xe=null,t.shift()}return!0}function Ft(e,t,n){Dt(e)&&n.delete(t)}function qt(){Tt=!1,null!==At&&Dt(At)&&(At=null),null!==Nt&&Dt(Nt)&&(Nt=null),null!==Et&&Dt(Et)&&(Et=null),_t.forEach(Ft),Pt.forEach(Ft)}function Bt(e,t){e.blockedOn===t&&(e.blockedOn=null,Tt||(Tt=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,qt)))}function Ut(e){function t(t){return Bt(t,e)}if(0<It.length){Bt(It[0],e);for(var n=1;n<It.length;n++){var r=It[n];r.blockedOn===e&&(r.blockedOn=null)}}for(null!==At&&Bt(At,e),null!==Nt&&Bt(Nt,e),null!==Et&&Bt(Et,e),_t.forEach(t),Pt.forEach(t),n=0;n<Ot.length;n++)(r=Ot[n]).blockedOn===e&&(r.blockedOn=null);for(;0<Ot.length&&null===(n=Ot[0]).blockedOn;)Lt(n),null===n.blockedOn&&Ot.shift()}var Ht=x.ReactCurrentBatchConfig,Kt=!0;function $t(e,t,n,r){var o=yt,a=Ht.transition;Ht.transition=null;try{yt=1,Wt(e,t,n,r)}finally{yt=o,Ht.transition=a}}function Gt(e,t,n,r){var o=yt,a=Ht.transition;Ht.transition=null;try{yt=4,Wt(e,t,n,r)}finally{yt=o,Ht.transition=a}}function Wt(e,t,n,r){if(Kt){var o=Qt(e,t,n,r);if(null===o)Kr(e,t,r,Vt,n),Mt(e,r);else if(function(e,t,n,r,o){switch(t){case"focusin":return At=zt(At,e,t,n,r,o),!0;case"dragenter":return Nt=zt(Nt,e,t,n,r,o),!0;case"mouseover":return Et=zt(Et,e,t,n,r,o),!0;case"pointerover":var a=o.pointerId;return _t.set(a,zt(_t.get(a)||null,e,t,n,r,o)),!0;case"gotpointercapture":return a=o.pointerId,Pt.set(a,zt(Pt.get(a)||null,e,t,n,r,o)),!0}return!1}(o,e,t,n,r))r.stopPropagation();else if(Mt(e,r),4&t&&-1<Rt.indexOf(e)){for(;null!==o;){var a=xo(o);if(null!==a&&wt(a),null===(a=Qt(e,t,n,r))&&Kr(e,t,r,Vt,n),a===o)break;o=a}null!==o&&r.stopPropagation()}else Kr(e,t,r,null,n)}}var Vt=null;function Qt(e,t,n,r){if(Vt=null,null!==(e=yo(e=we(r))))if(null===(t=Ue(e)))e=null;else if(13===(n=t.tag)){if(null!==(e=He(t)))return e;e=null}else if(3===n){if(t.stateNode.current.memoizedState.isDehydrated)return 3===t.tag?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Vt=e,null}function Yt(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Xe()){case Ze:return 1;case et:return 4;case tt:case nt:return 16;case rt:return 536870912;default:return 16}default:return 16}}var Jt=null,Xt=null,Zt=null;function en(){if(Zt)return Zt;var e,t,n=Xt,r=n.length,o="value"in Jt?Jt.value:Jt.textContent,a=o.length;for(e=0;e<r&&n[e]===o[e];e++);var i=r-e;for(t=1;t<=i&&n[r-t]===o[a-t];t++);return Zt=o.slice(e,1<t?1-t:void 0)}function tn(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function nn(){return!0}function rn(){return!1}function on(e){function t(t,n,r,o,a){for(var i in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=o,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(i)&&(t=e[i],this[i]=t?t(o):o[i]);return this.isDefaultPrevented=(null!=o.defaultPrevented?o.defaultPrevented:!1===o.returnValue)?nn:rn,this.isPropagationStopped=rn,this}return L(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=nn)},persist:function(){},isPersistent:nn}),t}var an,sn,cn,ln={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dn=on(ln),un=L({},ln,{view:0,detail:0}),hn=on(un),pn=L({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:jn,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cn&&(cn&&"mousemove"===e.type?(an=e.screenX-cn.screenX,sn=e.screenY-cn.screenY):sn=an=0,cn=e),an)},movementY:function(e){return"movementY"in e?e.movementY:sn}}),fn=on(pn),gn=on(L({},pn,{dataTransfer:0})),mn=on(L({},un,{relatedTarget:0})),vn=on(L({},ln,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=L({},ln,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),yn=on(bn),xn=on(L({},ln,{data:0})),wn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},kn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Cn={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Sn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Cn[e])&&!!t[e]}function jn(){return Sn}var Tn=L({},un,{key:function(e){if(e.key){var t=wn[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=tn(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?kn[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:jn,charCode:function(e){return"keypress"===e.type?tn(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?tn(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),In=on(Tn),An=on(L({},pn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Nn=on(L({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:jn})),En=on(L({},ln,{propertyName:0,elapsedTime:0,pseudoElement:0})),_n=L({},pn,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Pn=on(_n),On=[9,13,27,32],Rn=d&&"CompositionEvent"in window,Mn=null;d&&"documentMode"in document&&(Mn=document.documentMode);var zn=d&&"TextEvent"in window&&!Mn,Ln=d&&(!Rn||Mn&&8<Mn&&11>=Mn),Dn=String.fromCharCode(32),Fn=!1;function qn(e,t){switch(e){case"keyup":return-1!==On.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bn(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Un=!1,Hn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Kn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Hn[e.type]:"textarea"===t}function $n(e,t,n,r){Te(r),0<(t=Gr(t,"onChange")).length&&(n=new dn("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Gn=null,Wn=null;function Vn(e){Dr(e,0)}function Qn(e){if(W(wo(e)))return e}function Yn(e,t){if("change"===e)return t}var Jn=!1;if(d){var Xn;if(d){var Zn="oninput"in document;if(!Zn){var er=document.createElement("div");er.setAttribute("oninput","return;"),Zn="function"==typeof er.oninput}Xn=Zn}else Xn=!1;Jn=Xn&&(!document.documentMode||9<document.documentMode)}function tr(){Gn&&(Gn.detachEvent("onpropertychange",nr),Wn=Gn=null)}function nr(e){if("value"===e.propertyName&&Qn(Wn)){var t=[];$n(t,Wn,e,we(e)),_e(Vn,t)}}function rr(e,t,n){"focusin"===e?(tr(),Wn=n,(Gn=t).attachEvent("onpropertychange",nr)):"focusout"===e&&tr()}function or(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Qn(Wn)}function ar(e,t){if("click"===e)return Qn(t)}function ir(e,t){if("input"===e||"change"===e)return Qn(t)}var sr="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t};function cr(e,t){if(sr(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!u.call(t,o)||!sr(e[o],t[o]))return!1}return!0}function lr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function dr(e,t){var n,r=lr(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=lr(r)}}function ur(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?ur(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function hr(){for(var e=window,t=V();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(!n)break;t=V((e=t.contentWindow).document)}return t}function pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function fr(e){var t=hr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ur(n.ownerDocument.documentElement,n)){if(null!==r&&pr(n))if(t=r.start,void 0===(e=r.end)&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if((e=(t=n.ownerDocument||document)&&t.defaultView||window).getSelection){e=e.getSelection();var o=n.textContent.length,a=Math.min(r.start,o);r=void 0===r.end?a:Math.min(r.end,o),!e.extend&&a>r&&(o=r,r=a,a=o),o=dr(n,a);var i=dr(n,r);o&&i&&(1!==e.rangeCount||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&((t=t.createRange()).setStart(o.node,o.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.offset),e.addRange(t)))}for(t=[],e=n;e=e.parentNode;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;n<t.length;n++)(e=t[n]).element.scrollLeft=e.left,e.element.scrollTop=e.top}}var gr=d&&"documentMode"in document&&11>=document.documentMode,mr=null,vr=null,br=null,yr=!1;function xr(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;yr||null==mr||mr!==V(r)||(r="selectionStart"in(r=mr)&&pr(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},br&&cr(br,r)||(br=r,0<(r=Gr(vr,"onSelect")).length&&(t=new dn("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=mr)))}function wr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var kr={animationend:wr("Animation","AnimationEnd"),animationiteration:wr("Animation","AnimationIteration"),animationstart:wr("Animation","AnimationStart"),transitionend:wr("Transition","TransitionEnd")},Cr={},Sr={};function jr(e){if(Cr[e])return Cr[e];if(!kr[e])return e;var t,n=kr[e];for(t in n)if(n.hasOwnProperty(t)&&t in Sr)return Cr[e]=n[t];return e}d&&(Sr=document.createElement("div").style,"AnimationEvent"in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),"TransitionEvent"in window||delete kr.transitionend.transition);var Tr=jr("animationend"),Ir=jr("animationiteration"),Ar=jr("animationstart"),Nr=jr("transitionend"),Er=new Map,_r="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Pr(e,t){Er.set(e,t),c(t,[e])}for(var Or=0;Or<_r.length;Or++){var Rr=_r[Or];Pr(Rr.toLowerCase(),"on"+(Rr[0].toUpperCase()+Rr.slice(1)))}Pr(Tr,"onAnimationEnd"),Pr(Ir,"onAnimationIteration"),Pr(Ar,"onAnimationStart"),Pr("dblclick","onDoubleClick"),Pr("focusin","onFocus"),Pr("focusout","onBlur"),Pr(Nr,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Mr="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zr=new Set("cancel close invalid load scroll toggle".split(" ").concat(Mr));function Lr(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,function(e,t,n,r,o,i,s,c,l){if(Be.apply(this,arguments),ze){if(!ze)throw Error(a(198));var d=Le;ze=!1,Le=null,De||(De=!0,Fe=d)}}(r,t,void 0,e),e.currentTarget=null}function Dr(e,t){t=!!(4&t);for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var a=void 0;if(t)for(var i=r.length-1;0<=i;i--){var s=r[i],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&o.isPropagationStopped())break e;Lr(o,s,l),a=c}else for(i=0;i<r.length;i++){if(c=(s=r[i]).instance,l=s.currentTarget,s=s.listener,c!==a&&o.isPropagationStopped())break e;Lr(o,s,l),a=c}}}if(De)throw e=Fe,De=!1,Fe=null,e}function Fr(e,t){var n=t[mo];void 0===n&&(n=t[mo]=new Set);var r=e+"__bubble";n.has(r)||(Hr(t,e,2,!1),n.add(r))}function qr(e,t,n){var r=0;t&&(r|=4),Hr(n,e,r,t)}var Br="_reactListening"+Math.random().toString(36).slice(2);function Ur(e){if(!e[Br]){e[Br]=!0,i.forEach(function(t){"selectionchange"!==t&&(zr.has(t)||qr(t,!1,e),qr(t,!0,e))});var t=9===e.nodeType?e:e.ownerDocument;null===t||t[Br]||(t[Br]=!0,qr("selectionchange",!1,t))}}function Hr(e,t,n,r){switch(Yt(t)){case 1:var o=$t;break;case 4:o=Gt;break;default:o=Wt}n=o.bind(null,t,n,e),o=void 0,!Oe||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(o=!0),r?void 0!==o?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):void 0!==o?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Kr(e,t,n,r,o){var a=r;if(!(1&t||2&t||null===r))e:for(;;){if(null===r)return;var i=r.tag;if(3===i||4===i){var s=r.stateNode.containerInfo;if(s===o||8===s.nodeType&&s.parentNode===o)break;if(4===i)for(i=r.return;null!==i;){var c=i.tag;if((3===c||4===c)&&((c=i.stateNode.containerInfo)===o||8===c.nodeType&&c.parentNode===o))return;i=i.return}for(;null!==s;){if(null===(i=yo(s)))return;if(5===(c=i.tag)||6===c){r=a=i;continue e}s=s.parentNode}}r=r.return}_e(function(){var r=a,o=we(n),i=[];e:{var s=Er.get(e);if(void 0!==s){var c=dn,l=e;switch(e){case"keypress":if(0===tn(n))break e;case"keydown":case"keyup":c=In;break;case"focusin":l="focus",c=mn;break;case"focusout":l="blur",c=mn;break;case"beforeblur":case"afterblur":c=mn;break;case"click":if(2===n.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":c=fn;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":c=gn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":c=Nn;break;case Tr:case Ir:case Ar:c=vn;break;case Nr:c=En;break;case"scroll":c=hn;break;case"wheel":c=Pn;break;case"copy":case"cut":case"paste":c=yn;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":c=An}var d=!!(4&t),u=!d&&"scroll"===e,h=d?null!==s?s+"Capture":null:s;d=[];for(var p,f=r;null!==f;){var g=(p=f).stateNode;if(5===p.tag&&null!==g&&(p=g,null!==h&&null!=(g=Pe(f,h))&&d.push($r(f,g,p))),u)break;f=f.return}0<d.length&&(s=new c(s,l,null,n,o),i.push({event:s,listeners:d}))}}if(!(7&t)){if(c="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||n===xe||!(l=n.relatedTarget||n.fromElement)||!yo(l)&&!l[go])&&(c||s)&&(s=o.window===o?o:(s=o.ownerDocument)?s.defaultView||s.parentWindow:window,c?(c=r,null!==(l=(l=n.relatedTarget||n.toElement)?yo(l):null)&&(l!==(u=Ue(l))||5!==l.tag&&6!==l.tag)&&(l=null)):(c=null,l=r),c!==l)){if(d=fn,g="onMouseLeave",h="onMouseEnter",f="mouse","pointerout"!==e&&"pointerover"!==e||(d=An,g="onPointerLeave",h="onPointerEnter",f="pointer"),u=null==c?s:wo(c),p=null==l?s:wo(l),(s=new d(g,f+"leave",c,n,o)).target=u,s.relatedTarget=p,g=null,yo(o)===r&&((d=new d(h,f+"enter",l,n,o)).target=p,d.relatedTarget=u,g=d),u=g,c&&l)e:{for(h=l,f=0,p=d=c;p;p=Wr(p))f++;for(p=0,g=h;g;g=Wr(g))p++;for(;0<f-p;)d=Wr(d),f--;for(;0<p-f;)h=Wr(h),p--;for(;f--;){if(d===h||null!==h&&d===h.alternate)break e;d=Wr(d),h=Wr(h)}d=null}else d=null;null!==c&&Vr(i,s,c,d,!1),null!==l&&null!==u&&Vr(i,u,l,d,!0)}if("select"===(c=(s=r?wo(r):window).nodeName&&s.nodeName.toLowerCase())||"input"===c&&"file"===s.type)var m=Yn;else if(Kn(s))if(Jn)m=ir;else{m=or;var v=rr}else(c=s.nodeName)&&"input"===c.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(m=ar);switch(m&&(m=m(e,r))?$n(i,m,n,o):(v&&v(e,s,r),"focusout"===e&&(v=s._wrapperState)&&v.controlled&&"number"===s.type&&ee(s,"number",s.value)),v=r?wo(r):window,e){case"focusin":(Kn(v)||"true"===v.contentEditable)&&(mr=v,vr=r,br=null);break;case"focusout":br=vr=mr=null;break;case"mousedown":yr=!0;break;case"contextmenu":case"mouseup":case"dragend":yr=!1,xr(i,n,o);break;case"selectionchange":if(gr)break;case"keydown":case"keyup":xr(i,n,o)}var b;if(Rn)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Un?qn(e,n)&&(y="onCompositionEnd"):"keydown"===e&&229===n.keyCode&&(y="onCompositionStart");y&&(Ln&&"ko"!==n.locale&&(Un||"onCompositionStart"!==y?"onCompositionEnd"===y&&Un&&(b=en()):(Xt="value"in(Jt=o)?Jt.value:Jt.textContent,Un=!0)),0<(v=Gr(r,y)).length&&(y=new xn(y,e,null,n,o),i.push({event:y,listeners:v}),(b||null!==(b=Bn(n)))&&(y.data=b))),(b=zn?function(e,t){switch(e){case"compositionend":return Bn(t);case"keypress":return 32!==t.which?null:(Fn=!0,Dn);case"textInput":return(e=t.data)===Dn&&Fn?null:e;default:return null}}(e,n):function(e,t){if(Un)return"compositionend"===e||!Rn&&qn(e,t)?(e=en(),Zt=Xt=Jt=null,Un=!1,e):null;switch(e){case"paste":default:return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Ln&&"ko"!==t.locale?null:t.data}}(e,n))&&0<(r=Gr(r,"onBeforeInput")).length&&(o=new xn("onBeforeInput","beforeinput",null,n,o),i.push({event:o,listeners:r}),o.data=b)}Dr(i,t)})}function $r(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Gr(e,t){for(var n=t+"Capture",r=[];null!==e;){var o=e,a=o.stateNode;5===o.tag&&null!==a&&(o=a,null!=(a=Pe(e,n))&&r.unshift($r(e,a,o)),null!=(a=Pe(e,t))&&r.push($r(e,a,o))),e=e.return}return r}function Wr(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function Vr(e,t,n,r,o){for(var a=t._reactName,i=[];null!==n&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(null!==c&&c===r)break;5===s.tag&&null!==l&&(s=l,o?null!=(c=Pe(n,a))&&i.unshift($r(n,c,s)):o||null!=(c=Pe(n,a))&&i.push($r(n,c,s))),n=n.return}0!==i.length&&e.push({event:t,listeners:i})}var Qr=/\r\n?/g,Yr=/\u0000|\uFFFD/g;function Jr(e){return("string"==typeof e?e:""+e).replace(Qr,"\n").replace(Yr,"")}function Xr(e,t,n){if(t=Jr(t),Jr(e)!==t&&n)throw Error(a(425))}function Zr(){}var eo=null,to=null;function no(e,t){return"textarea"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var ro="function"==typeof setTimeout?setTimeout:void 0,oo="function"==typeof clearTimeout?clearTimeout:void 0,ao="function"==typeof Promise?Promise:void 0,io="function"==typeof queueMicrotask?queueMicrotask:void 0!==ao?function(e){return ao.resolve(null).then(e).catch(so)}:ro;function so(e){setTimeout(function(){throw e})}function co(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&8===o.nodeType)if("/$"===(n=o.data)){if(0===r)return e.removeChild(o),void Ut(t);r--}else"$"!==n&&"$?"!==n&&"$!"!==n||r++;n=o}while(n);Ut(t)}function lo(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break;if(8===t){if("$"===(t=e.data)||"$!"===t||"$?"===t)break;if("/$"===t)return null}}return e}function uo(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var n=e.data;if("$"===n||"$!"===n||"$?"===n){if(0===t)return e;t--}else"/$"===n&&t++}e=e.previousSibling}return null}var ho=Math.random().toString(36).slice(2),po="__reactFiber$"+ho,fo="__reactProps$"+ho,go="__reactContainer$"+ho,mo="__reactEvents$"+ho,vo="__reactListeners$"+ho,bo="__reactHandles$"+ho;function yo(e){var t=e[po];if(t)return t;for(var n=e.parentNode;n;){if(t=n[go]||n[po]){if(n=t.alternate,null!==t.child||null!==n&&null!==n.child)for(e=uo(e);null!==e;){if(n=e[po])return n;e=uo(e)}return t}n=(e=n).parentNode}return null}function xo(e){return!(e=e[po]||e[go])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function wo(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(a(33))}function ko(e){return e[fo]||null}var Co=[],So=-1;function jo(e){return{current:e}}function To(e){0>So||(e.current=Co[So],Co[So]=null,So--)}function Io(e,t){So++,Co[So]=e.current,e.current=t}var Ao={},No=jo(Ao),Eo=jo(!1),_o=Ao;function Po(e,t){var n=e.type.contextTypes;if(!n)return Ao;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,a={};for(o in n)a[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Oo(e){return null!=e.childContextTypes}function Ro(){To(Eo),To(No)}function Mo(e,t,n){if(No.current!==Ao)throw Error(a(168));Io(No,t),Io(Eo,n)}function zo(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var o in r=r.getChildContext())if(!(o in t))throw Error(a(108,H(e)||"Unknown",o));return L({},n,r)}function Lo(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ao,_o=No.current,Io(No,e),Io(Eo,Eo.current),!0}function Do(e,t,n){var r=e.stateNode;if(!r)throw Error(a(169));n?(e=zo(e,t,_o),r.__reactInternalMemoizedMergedChildContext=e,To(Eo),To(No),Io(No,e)):To(Eo),Io(Eo,n)}var Fo=null,qo=!1,Bo=!1;function Uo(e){null===Fo?Fo=[e]:Fo.push(e)}function Ho(){if(!Bo&&null!==Fo){Bo=!0;var e=0,t=yt;try{var n=Fo;for(yt=1;e<n.length;e++){var r=n[e];do{r=r(!0)}while(null!==r)}Fo=null,qo=!1}catch(t){throw null!==Fo&&(Fo=Fo.slice(e+1)),We(Ze,Ho),t}finally{yt=t,Bo=!1}}return null}var Ko=[],$o=0,Go=null,Wo=0,Vo=[],Qo=0,Yo=null,Jo=1,Xo="";function Zo(e,t){Ko[$o++]=Wo,Ko[$o++]=Go,Go=e,Wo=t}function ea(e,t,n){Vo[Qo++]=Jo,Vo[Qo++]=Xo,Vo[Qo++]=Yo,Yo=e;var r=Jo;e=Xo;var o=32-it(r)-1;r&=~(1<<o),n+=1;var a=32-it(t)+o;if(30<a){var i=o-o%5;a=(r&(1<<i)-1).toString(32),r>>=i,o-=i,Jo=1<<32-it(t)+o|n<<o|r,Xo=a+e}else Jo=1<<a|n<<o|r,Xo=e}function ta(e){null!==e.return&&(Zo(e,1),ea(e,1,0))}function na(e){for(;e===Go;)Go=Ko[--$o],Ko[$o]=null,Wo=Ko[--$o],Ko[$o]=null;for(;e===Yo;)Yo=Vo[--Qo],Vo[Qo]=null,Xo=Vo[--Qo],Vo[Qo]=null,Jo=Vo[--Qo],Vo[Qo]=null}var ra=null,oa=null,aa=!1,ia=null;function sa(e,t){var n=El(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,null===(t=e.deletions)?(e.deletions=[n],e.flags|=16):t.push(n)}function ca(e,t){switch(e.tag){case 5:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,ra=e,oa=lo(t.firstChild),!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,ra=e,oa=null,!0);case 13:return null!==(t=8!==t.nodeType?null:t)&&(n=null!==Yo?{id:Jo,overflow:Xo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},(n=El(18,null,null,0)).stateNode=t,n.return=e,e.child=n,ra=e,oa=null,!0);default:return!1}}function la(e){return!(!(1&e.mode)||128&e.flags)}function da(e){if(aa){var t=oa;if(t){var n=t;if(!ca(e,t)){if(la(e))throw Error(a(418));t=lo(n.nextSibling);var r=ra;t&&ca(e,t)?sa(r,n):(e.flags=-4097&e.flags|2,aa=!1,ra=e)}}else{if(la(e))throw Error(a(418));e.flags=-4097&e.flags|2,aa=!1,ra=e}}}function ua(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ra=e}function ha(e){if(e!==ra)return!1;if(!aa)return ua(e),aa=!0,!1;var t;if((t=3!==e.tag)&&!(t=5!==e.tag)&&(t="head"!==(t=e.type)&&"body"!==t&&!no(e.type,e.memoizedProps)),t&&(t=oa)){if(la(e))throw pa(),Error(a(418));for(;t;)sa(e,t),t=lo(t.nextSibling)}if(ua(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(a(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var n=e.data;if("/$"===n){if(0===t){oa=lo(e.nextSibling);break e}t--}else"$"!==n&&"$!"!==n&&"$?"!==n||t++}e=e.nextSibling}oa=null}}else oa=ra?lo(e.stateNode.nextSibling):null;return!0}function pa(){for(var e=oa;e;)e=lo(e.nextSibling)}function fa(){oa=ra=null,aa=!1}function ga(e){null===ia?ia=[e]:ia.push(e)}var ma=x.ReactCurrentBatchConfig;function va(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){if(n=n._owner){if(1!==n.tag)throw Error(a(309));var r=n.stateNode}if(!r)throw Error(a(147,e));var o=r,i=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===i?t.ref:(t=function(e){var t=o.refs;null===e?delete t[i]:t[i]=e},t._stringRef=i,t)}if("string"!=typeof e)throw Error(a(284));if(!n._owner)throw Error(a(290,e))}return e}function ba(e,t){throw e=Object.prototype.toString.call(t),Error(a(31,"[object Object]"===e?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ya(e){return(0,e._init)(e._payload)}function xa(e){function t(t,n){if(e){var r=t.deletions;null===r?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t){return(e=Pl(e,t)).index=0,e.sibling=null,e}function i(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.flags|=2,n):r:(t.flags|=2,n):(t.flags|=1048576,n)}function s(t){return e&&null===t.alternate&&(t.flags|=2),t}function c(e,t,n,r){return null===t||6!==t.tag?((t=zl(n,e.mode,r)).return=e,t):((t=o(t,n)).return=e,t)}function l(e,t,n,r){var a=n.type;return a===C?u(e,t,n.props.children,r,n.key):null!==t&&(t.elementType===a||"object"==typeof a&&null!==a&&a.$$typeof===P&&ya(a)===t.type)?((r=o(t,n.props)).ref=va(e,t,n),r.return=e,r):((r=Ol(n.type,n.key,n.props,null,e.mode,r)).ref=va(e,t,n),r.return=e,r)}function d(e,t,n,r){return null===t||4!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Ll(n,e.mode,r)).return=e,t):((t=o(t,n.children||[])).return=e,t)}function u(e,t,n,r,a){return null===t||7!==t.tag?((t=Rl(n,e.mode,r,a)).return=e,t):((t=o(t,n)).return=e,t)}function h(e,t,n){if("string"==typeof t&&""!==t||"number"==typeof t)return(t=zl(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case w:return(n=Ol(t.type,t.key,t.props,null,e.mode,n)).ref=va(e,null,t),n.return=e,n;case k:return(t=Ll(t,e.mode,n)).return=e,t;case P:return h(e,(0,t._init)(t._payload),n)}if(te(t)||M(t))return(t=Rl(t,e.mode,n,null)).return=e,t;ba(e,t)}return null}function p(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n&&""!==n||"number"==typeof n)return null!==o?null:c(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case w:return n.key===o?l(e,t,n,r):null;case k:return n.key===o?d(e,t,n,r):null;case P:return p(e,t,(o=n._init)(n._payload),r)}if(te(n)||M(n))return null!==o?null:u(e,t,n,r,null);ba(e,n)}return null}function f(e,t,n,r,o){if("string"==typeof r&&""!==r||"number"==typeof r)return c(t,e=e.get(n)||null,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case w:return l(t,e=e.get(null===r.key?n:r.key)||null,r,o);case k:return d(t,e=e.get(null===r.key?n:r.key)||null,r,o);case P:return f(e,t,n,(0,r._init)(r._payload),o)}if(te(r)||M(r))return u(t,e=e.get(n)||null,r,o,null);ba(t,r)}return null}function g(o,a,s,c){for(var l=null,d=null,u=a,g=a=0,m=null;null!==u&&g<s.length;g++){u.index>g?(m=u,u=null):m=u.sibling;var v=p(o,u,s[g],c);if(null===v){null===u&&(u=m);break}e&&u&&null===v.alternate&&t(o,u),a=i(v,a,g),null===d?l=v:d.sibling=v,d=v,u=m}if(g===s.length)return n(o,u),aa&&Zo(o,g),l;if(null===u){for(;g<s.length;g++)null!==(u=h(o,s[g],c))&&(a=i(u,a,g),null===d?l=u:d.sibling=u,d=u);return aa&&Zo(o,g),l}for(u=r(o,u);g<s.length;g++)null!==(m=f(u,o,g,s[g],c))&&(e&&null!==m.alternate&&u.delete(null===m.key?g:m.key),a=i(m,a,g),null===d?l=m:d.sibling=m,d=m);return e&&u.forEach(function(e){return t(o,e)}),aa&&Zo(o,g),l}function m(o,s,c,l){var d=M(c);if("function"!=typeof d)throw Error(a(150));if(null==(c=d.call(c)))throw Error(a(151));for(var u=d=null,g=s,m=s=0,v=null,b=c.next();null!==g&&!b.done;m++,b=c.next()){g.index>m?(v=g,g=null):v=g.sibling;var y=p(o,g,b.value,l);if(null===y){null===g&&(g=v);break}e&&g&&null===y.alternate&&t(o,g),s=i(y,s,m),null===u?d=y:u.sibling=y,u=y,g=v}if(b.done)return n(o,g),aa&&Zo(o,m),d;if(null===g){for(;!b.done;m++,b=c.next())null!==(b=h(o,b.value,l))&&(s=i(b,s,m),null===u?d=b:u.sibling=b,u=b);return aa&&Zo(o,m),d}for(g=r(o,g);!b.done;m++,b=c.next())null!==(b=f(g,o,m,b.value,l))&&(e&&null!==b.alternate&&g.delete(null===b.key?m:b.key),s=i(b,s,m),null===u?d=b:u.sibling=b,u=b);return e&&g.forEach(function(e){return t(o,e)}),aa&&Zo(o,m),d}return function e(r,a,i,c){if("object"==typeof i&&null!==i&&i.type===C&&null===i.key&&(i=i.props.children),"object"==typeof i&&null!==i){switch(i.$$typeof){case w:e:{for(var l=i.key,d=a;null!==d;){if(d.key===l){if((l=i.type)===C){if(7===d.tag){n(r,d.sibling),(a=o(d,i.props.children)).return=r,r=a;break e}}else if(d.elementType===l||"object"==typeof l&&null!==l&&l.$$typeof===P&&ya(l)===d.type){n(r,d.sibling),(a=o(d,i.props)).ref=va(r,d,i),a.return=r,r=a;break e}n(r,d);break}t(r,d),d=d.sibling}i.type===C?((a=Rl(i.props.children,r.mode,c,i.key)).return=r,r=a):((c=Ol(i.type,i.key,i.props,null,r.mode,c)).ref=va(r,a,i),c.return=r,r=c)}return s(r);case k:e:{for(d=i.key;null!==a;){if(a.key===d){if(4===a.tag&&a.stateNode.containerInfo===i.containerInfo&&a.stateNode.implementation===i.implementation){n(r,a.sibling),(a=o(a,i.children||[])).return=r,r=a;break e}n(r,a);break}t(r,a),a=a.sibling}(a=Ll(i,r.mode,c)).return=r,r=a}return s(r);case P:return e(r,a,(d=i._init)(i._payload),c)}if(te(i))return g(r,a,i,c);if(M(i))return m(r,a,i,c);ba(r,i)}return"string"==typeof i&&""!==i||"number"==typeof i?(i=""+i,null!==a&&6===a.tag?(n(r,a.sibling),(a=o(a,i)).return=r,r=a):(n(r,a),(a=zl(i,r.mode,c)).return=r,r=a),s(r)):n(r,a)}}var wa=xa(!0),ka=xa(!1),Ca=jo(null),Sa=null,ja=null,Ta=null;function Ia(){Ta=ja=Sa=null}function Aa(e){var t=Ca.current;To(Ca),e._currentValue=t}function Na(e,t,n){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,null!==r&&(r.childLanes|=t)):null!==r&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ea(e,t){Sa=e,Ta=ja=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!==(e.lanes&t)&&(ys=!0),e.firstContext=null)}function _a(e){var t=e._currentValue;if(Ta!==e)if(e={context:e,memoizedValue:t,next:null},null===ja){if(null===Sa)throw Error(a(308));ja=e,Sa.dependencies={lanes:0,firstContext:e}}else ja=ja.next=e;return t}var Pa=null;function Oa(e){null===Pa?Pa=[e]:Pa.push(e)}function Ra(e,t,n,r){var o=t.interleaved;return null===o?(n.next=n,Oa(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ma(e,r)}function Ma(e,t){e.lanes|=t;var n=e.alternate;for(null!==n&&(n.lanes|=t),n=e,e=e.return;null!==e;)e.childLanes|=t,null!==(n=e.alternate)&&(n.childLanes|=t),n=e,e=e.return;return 3===n.tag?n.stateNode:null}var za=!1;function La(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Da(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Fa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function qa(e,t,n){var r=e.updateQueue;if(null===r)return null;if(r=r.shared,2&Ic){var o=r.pending;return null===o?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ma(e,n)}return null===(o=r.interleaved)?(t.next=t,Oa(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ma(e,n)}function Ba(e,t,n){if(null!==(t=t.updateQueue)&&(t=t.shared,4194240&n)){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}function Ua(e,t){var n=e.updateQueue,r=e.alternate;if(null!==r&&n===(r=r.updateQueue)){var o=null,a=null;if(null!==(n=n.firstBaseUpdate)){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};null===a?o=a=i:a=a.next=i,n=n.next}while(null!==n);null===a?o=a=t:a=a.next=t}else o=a=t;return n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:a,shared:r.shared,effects:r.effects},void(e.updateQueue=n)}null===(e=n.lastBaseUpdate)?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Ha(e,t,n,r){var o=e.updateQueue;za=!1;var a=o.firstBaseUpdate,i=o.lastBaseUpdate,s=o.shared.pending;if(null!==s){o.shared.pending=null;var c=s,l=c.next;c.next=null,null===i?a=l:i.next=l,i=c;var d=e.alternate;null!==d&&(s=(d=d.updateQueue).lastBaseUpdate)!==i&&(null===s?d.firstBaseUpdate=l:s.next=l,d.lastBaseUpdate=c)}if(null!==a){var u=o.baseState;for(i=0,d=l=c=null,s=a;;){var h=s.lane,p=s.eventTime;if((r&h)===h){null!==d&&(d=d.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var f=e,g=s;switch(h=t,p=n,g.tag){case 1:if("function"==typeof(f=g.payload)){u=f.call(p,u,h);break e}u=f;break e;case 3:f.flags=-65537&f.flags|128;case 0:if(null==(h="function"==typeof(f=g.payload)?f.call(p,u,h):f))break e;u=L({},u,h);break e;case 2:za=!0}}null!==s.callback&&0!==s.lane&&(e.flags|=64,null===(h=o.effects)?o.effects=[s]:h.push(s))}else p={eventTime:p,lane:h,tag:s.tag,payload:s.payload,callback:s.callback,next:null},null===d?(l=d=p,c=u):d=d.next=p,i|=h;if(null===(s=s.next)){if(null===(s=o.shared.pending))break;s=(h=s).next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}if(null===d&&(c=u),o.baseState=c,o.firstBaseUpdate=l,o.lastBaseUpdate=d,null!==(t=o.shared.interleaved)){o=t;do{i|=o.lane,o=o.next}while(o!==t)}else null===a&&(o.shared.lanes=0);Mc|=i,e.lanes=i,e.memoizedState=u}}function Ka(e,t,n){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(null!==o){if(r.callback=null,r=n,"function"!=typeof o)throw Error(a(191,o));o.call(r)}}}var $a={},Ga=jo($a),Wa=jo($a),Va=jo($a);function Qa(e){if(e===$a)throw Error(a(174));return e}function Ya(e,t){switch(Io(Va,t),Io(Wa,e),Io(Ga,$a),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ce(null,"");break;default:t=ce(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}To(Ga),Io(Ga,t)}function Ja(){To(Ga),To(Wa),To(Va)}function Xa(e){Qa(Va.current);var t=Qa(Ga.current),n=ce(t,e.type);t!==n&&(Io(Wa,e),Io(Ga,n))}function Za(e){Wa.current===e&&(To(Ga),To(Wa))}var ei=jo(0);function ti(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(128&t.flags)return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ni=[];function ri(){for(var e=0;e<ni.length;e++)ni[e]._workInProgressVersionPrimary=null;ni.length=0}var oi=x.ReactCurrentDispatcher,ai=x.ReactCurrentBatchConfig,ii=0,si=null,ci=null,li=null,di=!1,ui=!1,hi=0,pi=0;function fi(){throw Error(a(321))}function gi(e,t){if(null===t)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!sr(e[n],t[n]))return!1;return!0}function mi(e,t,n,r,o,i){if(ii=i,si=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oi.current=null===e||null===e.memoizedState?Zi:es,e=n(r,o),ui){i=0;do{if(ui=!1,hi=0,25<=i)throw Error(a(301));i+=1,li=ci=null,t.updateQueue=null,oi.current=ts,e=n(r,o)}while(ui)}if(oi.current=Xi,t=null!==ci&&null!==ci.next,ii=0,li=ci=si=null,di=!1,t)throw Error(a(300));return e}function vi(){var e=0!==hi;return hi=0,e}function bi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===li?si.memoizedState=li=e:li=li.next=e,li}function yi(){if(null===ci){var e=si.alternate;e=null!==e?e.memoizedState:null}else e=ci.next;var t=null===li?si.memoizedState:li.next;if(null!==t)li=t,ci=e;else{if(null===e)throw Error(a(310));e={memoizedState:(ci=e).memoizedState,baseState:ci.baseState,baseQueue:ci.baseQueue,queue:ci.queue,next:null},null===li?si.memoizedState=li=e:li=li.next=e}return li}function xi(e,t){return"function"==typeof t?t(e):t}function wi(e){var t=yi(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=ci,o=r.baseQueue,i=n.pending;if(null!==i){if(null!==o){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(null!==o){i=o.next,r=r.baseState;var c=s=null,l=null,d=i;do{var u=d.lane;if((ii&u)===u)null!==l&&(l=l.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var h={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};null===l?(c=l=h,s=r):l=l.next=h,si.lanes|=u,Mc|=u}d=d.next}while(null!==d&&d!==i);null===l?s=r:l.next=c,sr(r,t.memoizedState)||(ys=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(null!==(e=n.interleaved)){o=e;do{i=o.lane,si.lanes|=i,Mc|=i,o=o.next}while(o!==e)}else null===o&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function ki(e){var t=yi(),n=t.queue;if(null===n)throw Error(a(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(null!==o){n.pending=null;var s=o=o.next;do{i=e(i,s.action),s=s.next}while(s!==o);sr(i,t.memoizedState)||(ys=!0),t.memoizedState=i,null===t.baseQueue&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Ci(){}function Si(e,t){var n=si,r=yi(),o=t(),i=!sr(r.memoizedState,o);if(i&&(r.memoizedState=o,ys=!0),r=r.queue,zi(Ii.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||null!==li&&1&li.memoizedState.tag){if(n.flags|=2048,_i(9,Ti.bind(null,n,r,o,t),void 0,null),null===Ac)throw Error(a(349));30&ii||ji(n,t,o)}return o}function ji(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},null===(t=si.updateQueue)?(t={lastEffect:null,stores:null},si.updateQueue=t,t.stores=[e]):null===(n=t.stores)?t.stores=[e]:n.push(e)}function Ti(e,t,n,r){t.value=n,t.getSnapshot=r,Ai(t)&&Ni(e)}function Ii(e,t,n){return n(function(){Ai(t)&&Ni(e)})}function Ai(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!sr(e,n)}catch(e){return!0}}function Ni(e){var t=Ma(e,1);null!==t&&tl(t,e,1,-1)}function Ei(e){var t=bi();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:xi,lastRenderedState:e},t.queue=e,e=e.dispatch=Vi.bind(null,si,e),[t.memoizedState,e]}function _i(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},null===(t=si.updateQueue)?(t={lastEffect:null,stores:null},si.updateQueue=t,t.lastEffect=e.next=e):null===(n=t.lastEffect)?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Pi(){return yi().memoizedState}function Oi(e,t,n,r){var o=bi();si.flags|=e,o.memoizedState=_i(1|t,n,void 0,void 0===r?null:r)}function Ri(e,t,n,r){var o=yi();r=void 0===r?null:r;var a=void 0;if(null!==ci){var i=ci.memoizedState;if(a=i.destroy,null!==r&&gi(r,i.deps))return void(o.memoizedState=_i(t,n,a,r))}si.flags|=e,o.memoizedState=_i(1|t,n,a,r)}function Mi(e,t){return Oi(8390656,8,e,t)}function zi(e,t){return Ri(2048,8,e,t)}function Li(e,t){return Ri(4,2,e,t)}function Di(e,t){return Ri(4,4,e,t)}function Fi(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function qi(e,t,n){return n=null!=n?n.concat([e]):null,Ri(4,4,Fi.bind(null,t,e),n)}function Bi(){}function Ui(e,t){var n=yi();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gi(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Hi(e,t){var n=yi();t=void 0===t?null:t;var r=n.memoizedState;return null!==r&&null!==t&&gi(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Ki(e,t,n){return 21&ii?(sr(n,t)||(n=gt(),si.lanes|=n,Mc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,ys=!0),e.memoizedState=n)}function $i(e,t){var n=yt;yt=0!==n&&4>n?n:4,e(!0);var r=ai.transition;ai.transition={};try{e(!1),t()}finally{yt=n,ai.transition=r}}function Gi(){return yi().memoizedState}function Wi(e,t,n){var r=el(e);n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qi(e)?Yi(t,n):null!==(n=Ra(e,t,n,r))&&(tl(n,e,r,Zc()),Ji(n,t,r))}function Vi(e,t,n){var r=el(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qi(e))Yi(t,o);else{var a=e.alternate;if(0===e.lanes&&(null===a||0===a.lanes)&&null!==(a=t.lastRenderedReducer))try{var i=t.lastRenderedState,s=a(i,n);if(o.hasEagerState=!0,o.eagerState=s,sr(s,i)){var c=t.interleaved;return null===c?(o.next=o,Oa(t)):(o.next=c.next,c.next=o),void(t.interleaved=o)}}catch(e){}null!==(n=Ra(e,t,o,r))&&(tl(n,e,r,o=Zc()),Ji(n,t,r))}}function Qi(e){var t=e.alternate;return e===si||null!==t&&t===si}function Yi(e,t){ui=di=!0;var n=e.pending;null===n?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ji(e,t,n){if(4194240&n){var r=t.lanes;n|=r&=e.pendingLanes,t.lanes=n,bt(e,n)}}var Xi={readContext:_a,useCallback:fi,useContext:fi,useEffect:fi,useImperativeHandle:fi,useInsertionEffect:fi,useLayoutEffect:fi,useMemo:fi,useReducer:fi,useRef:fi,useState:fi,useDebugValue:fi,useDeferredValue:fi,useTransition:fi,useMutableSource:fi,useSyncExternalStore:fi,useId:fi,unstable_isNewReconciler:!1},Zi={readContext:_a,useCallback:function(e,t){return bi().memoizedState=[e,void 0===t?null:t],e},useContext:_a,useEffect:Mi,useImperativeHandle:function(e,t,n){return n=null!=n?n.concat([e]):null,Oi(4194308,4,Fi.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Oi(4194308,4,e,t)},useInsertionEffect:function(e,t){return Oi(4,2,e,t)},useMemo:function(e,t){var n=bi();return t=void 0===t?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=bi();return t=void 0!==n?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Wi.bind(null,si,e),[r.memoizedState,e]},useRef:function(e){return e={current:e},bi().memoizedState=e},useState:Ei,useDebugValue:Bi,useDeferredValue:function(e){return bi().memoizedState=e},useTransition:function(){var e=Ei(!1),t=e[0];return e=$i.bind(null,e[1]),bi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=si,o=bi();if(aa){if(void 0===n)throw Error(a(407));n=n()}else{if(n=t(),null===Ac)throw Error(a(349));30&ii||ji(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Mi(Ii.bind(null,r,i,e),[e]),r.flags|=2048,_i(9,Ti.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=bi(),t=Ac.identifierPrefix;if(aa){var n=Xo;t=":"+t+"R"+(n=(Jo&~(1<<32-it(Jo)-1)).toString(32)+n),0<(n=hi++)&&(t+="H"+n.toString(32)),t+=":"}else t=":"+t+"r"+(n=pi++).toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},es={readContext:_a,useCallback:Ui,useContext:_a,useEffect:zi,useImperativeHandle:qi,useInsertionEffect:Li,useLayoutEffect:Di,useMemo:Hi,useReducer:wi,useRef:Pi,useState:function(){return wi(xi)},useDebugValue:Bi,useDeferredValue:function(e){return Ki(yi(),ci.memoizedState,e)},useTransition:function(){return[wi(xi)[0],yi().memoizedState]},useMutableSource:Ci,useSyncExternalStore:Si,useId:Gi,unstable_isNewReconciler:!1},ts={readContext:_a,useCallback:Ui,useContext:_a,useEffect:zi,useImperativeHandle:qi,useInsertionEffect:Li,useLayoutEffect:Di,useMemo:Hi,useReducer:ki,useRef:Pi,useState:function(){return ki(xi)},useDebugValue:Bi,useDeferredValue:function(e){var t=yi();return null===ci?t.memoizedState=e:Ki(t,ci.memoizedState,e)},useTransition:function(){return[ki(xi)[0],yi().memoizedState]},useMutableSource:Ci,useSyncExternalStore:Si,useId:Gi,unstable_isNewReconciler:!1};function ns(e,t){if(e&&e.defaultProps){for(var n in t=L({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function rs(e,t,n,r){n=null==(n=n(r,t=e.memoizedState))?t:L({},t,n),e.memoizedState=n,0===e.lanes&&(e.updateQueue.baseState=n)}var os={isMounted:function(e){return!!(e=e._reactInternals)&&Ue(e)===e},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Zc(),o=el(e),a=Fa(r,o);a.payload=t,null!=n&&(a.callback=n),null!==(t=qa(e,a,o))&&(tl(t,e,o,r),Ba(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Zc(),o=el(e),a=Fa(r,o);a.tag=1,a.payload=t,null!=n&&(a.callback=n),null!==(t=qa(e,a,o))&&(tl(t,e,o,r),Ba(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Zc(),r=el(e),o=Fa(n,r);o.tag=2,null!=t&&(o.callback=t),null!==(t=qa(e,o,r))&&(tl(t,e,r,n),Ba(t,e,r))}};function as(e,t,n,r,o,a,i){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,a,i):!(t.prototype&&t.prototype.isPureReactComponent&&cr(n,r)&&cr(o,a))}function is(e,t,n){var r=!1,o=Ao,a=t.contextType;return"object"==typeof a&&null!==a?a=_a(a):(o=Oo(t)?_o:No.current,a=(r=null!=(r=t.contextTypes))?Po(e,o):Ao),t=new t(n,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=os,e.stateNode=t,t._reactInternals=e,r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=a),t}function ss(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&os.enqueueReplaceState(t,t.state,null)}function cs(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},La(e);var a=t.contextType;"object"==typeof a&&null!==a?o.context=_a(a):(a=Oo(t)?_o:No.current,o.context=Po(e,a)),o.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(rs(e,t,a,n),o.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(t=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&os.enqueueReplaceState(o,o.state,null),Ha(e,n,o,r),o.state=e.memoizedState),"function"==typeof o.componentDidMount&&(e.flags|=4194308)}function ls(e,t){try{var n="",r=t;do{n+=B(r),r=r.return}while(r);var o=n}catch(e){o="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:o,digest:null}}function ds(e,t,n){return{value:e,source:null,stack:null!=n?n:null,digest:null!=t?t:null}}function us(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var hs="function"==typeof WeakMap?WeakMap:Map;function ps(e,t,n){(n=Fa(-1,n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Hc||(Hc=!0,Kc=r),us(0,t)},n}function fs(e,t,n){(n=Fa(-1,n)).tag=3;var r=e.type.getDerivedStateFromError;if("function"==typeof r){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){us(0,t)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(n.callback=function(){us(0,t),"function"!=typeof r&&(null===$c?$c=new Set([this]):$c.add(this));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),n}function gs(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new hs;var o=new Set;r.set(t,o)}else void 0===(o=r.get(t))&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=Sl.bind(null,e,t,n),t.then(e,e))}function ms(e){do{var t;if((t=13===e.tag)&&(t=null===(t=e.memoizedState)||null!==t.dehydrated),t)return e;e=e.return}while(null!==e);return null}function vs(e,t,n,r,o){return 1&e.mode?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,1===n.tag&&(null===n.alternate?n.tag=17:((t=Fa(-1,1)).tag=2,qa(n,t,1))),n.lanes|=1),e)}var bs=x.ReactCurrentOwner,ys=!1;function xs(e,t,n,r){t.child=null===e?ka(t,null,n,r):wa(t,e.child,n,r)}function ws(e,t,n,r,o){n=n.render;var a=t.ref;return Ea(t,o),r=mi(e,t,n,r,a,o),n=vi(),null===e||ys?(aa&&n&&ta(t),t.flags|=1,xs(e,t,r,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Hs(e,t,o))}function ks(e,t,n,r,o){if(null===e){var a=n.type;return"function"!=typeof a||_l(a)||void 0!==a.defaultProps||null!==n.compare||void 0!==n.defaultProps?((e=Ol(n.type,null,r,t,t.mode,o)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=a,Cs(e,t,a,r,o))}if(a=e.child,0===(e.lanes&o)){var i=a.memoizedProps;if((n=null!==(n=n.compare)?n:cr)(i,r)&&e.ref===t.ref)return Hs(e,t,o)}return t.flags|=1,(e=Pl(a,r)).ref=t.ref,e.return=t,t.child=e}function Cs(e,t,n,r,o){if(null!==e){var a=e.memoizedProps;if(cr(a,r)&&e.ref===t.ref){if(ys=!1,t.pendingProps=r=a,0===(e.lanes&o))return t.lanes=e.lanes,Hs(e,t,o);131072&e.flags&&(ys=!0)}}return Ts(e,t,n,r,o)}function Ss(e,t,n){var r=t.pendingProps,o=r.children,a=null!==e?e.memoizedState:null;if("hidden"===r.mode)if(1&t.mode){if(!(1073741824&n))return e=null!==a?a.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Io(Pc,_c),_c|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=null!==a?a.baseLanes:n,Io(Pc,_c),_c|=r}else t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Io(Pc,_c),_c|=n;else null!==a?(r=a.baseLanes|n,t.memoizedState=null):r=n,Io(Pc,_c),_c|=r;return xs(e,t,o,n),t.child}function js(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ts(e,t,n,r,o){var a=Oo(n)?_o:No.current;return a=Po(t,a),Ea(t,o),n=mi(e,t,n,r,a,o),r=vi(),null===e||ys?(aa&&r&&ta(t),t.flags|=1,xs(e,t,n,o),t.child):(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Hs(e,t,o))}function Is(e,t,n,r,o){if(Oo(n)){var a=!0;Lo(t)}else a=!1;if(Ea(t,o),null===t.stateNode)Us(e,t),is(t,n,r),cs(t,n,r,o),r=!0;else if(null===e){var i=t.stateNode,s=t.memoizedProps;i.props=s;var c=i.context,l=n.contextType;l="object"==typeof l&&null!==l?_a(l):Po(t,l=Oo(n)?_o:No.current);var d=n.getDerivedStateFromProps,u="function"==typeof d||"function"==typeof i.getSnapshotBeforeUpdate;u||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==r||c!==l)&&ss(t,i,r,l),za=!1;var h=t.memoizedState;i.state=h,Ha(t,r,i,o),c=t.memoizedState,s!==r||h!==c||Eo.current||za?("function"==typeof d&&(rs(t,n,d,r),c=t.memoizedState),(s=za||as(t,n,s,r,h,c,l))?(u||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||("function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"==typeof i.componentDidMount&&(t.flags|=4194308)):("function"==typeof i.componentDidMount&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),i.props=r,i.state=c,i.context=l,r=s):("function"==typeof i.componentDidMount&&(t.flags|=4194308),r=!1)}else{i=t.stateNode,Da(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:ns(t.type,s),i.props=l,u=t.pendingProps,h=i.context,c="object"==typeof(c=n.contextType)&&null!==c?_a(c):Po(t,c=Oo(n)?_o:No.current);var p=n.getDerivedStateFromProps;(d="function"==typeof p||"function"==typeof i.getSnapshotBeforeUpdate)||"function"!=typeof i.UNSAFE_componentWillReceiveProps&&"function"!=typeof i.componentWillReceiveProps||(s!==u||h!==c)&&ss(t,i,r,c),za=!1,h=t.memoizedState,i.state=h,Ha(t,r,i,o);var f=t.memoizedState;s!==u||h!==f||Eo.current||za?("function"==typeof p&&(rs(t,n,p,r),f=t.memoizedState),(l=za||as(t,n,l,r,h,f,c)||!1)?(d||"function"!=typeof i.UNSAFE_componentWillUpdate&&"function"!=typeof i.componentWillUpdate||("function"==typeof i.componentWillUpdate&&i.componentWillUpdate(r,f,c),"function"==typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(r,f,c)),"function"==typeof i.componentDidUpdate&&(t.flags|=4),"function"==typeof i.getSnapshotBeforeUpdate&&(t.flags|=1024)):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=f),i.props=r,i.state=f,i.context=c,r=l):("function"!=typeof i.componentDidUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),"function"!=typeof i.getSnapshotBeforeUpdate||s===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return As(e,t,n,r,a,o)}function As(e,t,n,r,o,a){js(e,t);var i=!!(128&t.flags);if(!r&&!i)return o&&Do(t,n,!1),Hs(e,t,a);r=t.stateNode,bs.current=t;var s=i&&"function"!=typeof n.getDerivedStateFromError?null:r.render();return t.flags|=1,null!==e&&i?(t.child=wa(t,e.child,null,a),t.child=wa(t,null,s,a)):xs(e,t,s,a),t.memoizedState=r.state,o&&Do(t,n,!0),t.child}function Ns(e){var t=e.stateNode;t.pendingContext?Mo(0,t.pendingContext,t.pendingContext!==t.context):t.context&&Mo(0,t.context,!1),Ya(e,t.containerInfo)}function Es(e,t,n,r,o){return fa(),ga(o),t.flags|=256,xs(e,t,n,r),t.child}var _s,Ps,Os,Rs={dehydrated:null,treeContext:null,retryLane:0};function Ms(e){return{baseLanes:e,cachePool:null,transitions:null}}function zs(e,t,n){var r,o=t.pendingProps,i=ei.current,s=!1,c=!!(128&t.flags);if((r=c)||(r=(null===e||null!==e.memoizedState)&&!!(2&i)),r?(s=!0,t.flags&=-129):null!==e&&null===e.memoizedState||(i|=1),Io(ei,1&i),null===e)return da(t),null!==(e=t.memoizedState)&&null!==(e=e.dehydrated)?(1&t.mode?"$!"===e.data?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(c=o.children,e=o.fallback,s?(o=t.mode,s=t.child,c={mode:"hidden",children:c},1&o||null===s?s=Ml(c,o,0,null):(s.childLanes=0,s.pendingProps=c),e=Rl(e,o,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Ms(n),t.memoizedState=Rs,e):Ls(t,c));if(null!==(i=e.memoizedState)&&null!==(r=i.dehydrated))return function(e,t,n,r,o,i,s){if(n)return 256&t.flags?(t.flags&=-257,Ds(e,t,s,r=ds(Error(a(422))))):null!==t.memoizedState?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Ml({mode:"visible",children:r.children},o,0,null),(i=Rl(i,o,s,null)).flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,1&t.mode&&wa(t,e.child,null,s),t.child.memoizedState=Ms(s),t.memoizedState=Rs,i);if(!(1&t.mode))return Ds(e,t,s,null);if("$!"===o.data){if(r=o.nextSibling&&o.nextSibling.dataset)var c=r.dgst;return r=c,Ds(e,t,s,r=ds(i=Error(a(419)),r,void 0))}if(c=0!==(s&e.childLanes),ys||c){if(null!==(r=Ac)){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}0!==(o=0!==(o&(r.suspendedLanes|s))?0:o)&&o!==i.retryLane&&(i.retryLane=o,Ma(e,o),tl(r,e,o,-1))}return fl(),Ds(e,t,s,r=ds(Error(a(421))))}return"$?"===o.data?(t.flags|=128,t.child=e.child,t=Tl.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,oa=lo(o.nextSibling),ra=t,aa=!0,ia=null,null!==e&&(Vo[Qo++]=Jo,Vo[Qo++]=Xo,Vo[Qo++]=Yo,Jo=e.id,Xo=e.overflow,Yo=t),(t=Ls(t,r.children)).flags|=4096,t)}(e,t,c,o,r,i,n);if(s){s=o.fallback,c=t.mode,r=(i=e.child).sibling;var l={mode:"hidden",children:o.children};return 1&c||t.child===i?(o=Pl(i,l)).subtreeFlags=14680064&i.subtreeFlags:((o=t.child).childLanes=0,o.pendingProps=l,t.deletions=null),null!==r?s=Pl(r,s):(s=Rl(s,c,n,null)).flags|=2,s.return=t,o.return=t,o.sibling=s,t.child=o,o=s,s=t.child,c=null===(c=e.child.memoizedState)?Ms(n):{baseLanes:c.baseLanes|n,cachePool:null,transitions:c.transitions},s.memoizedState=c,s.childLanes=e.childLanes&~n,t.memoizedState=Rs,o}return e=(s=e.child).sibling,o=Pl(s,{mode:"visible",children:o.children}),!(1&t.mode)&&(o.lanes=n),o.return=t,o.sibling=null,null!==e&&(null===(n=t.deletions)?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=o,t.memoizedState=null,o}function Ls(e,t){return(t=Ml({mode:"visible",children:t},e.mode,0,null)).return=e,e.child=t}function Ds(e,t,n,r){return null!==r&&ga(r),wa(t,e.child,null,n),(e=Ls(t,t.pendingProps.children)).flags|=2,t.memoizedState=null,e}function Fs(e,t,n){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),Na(e.return,t,n)}function qs(e,t,n,r,o){var a=e.memoizedState;null===a?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=o)}function Bs(e,t,n){var r=t.pendingProps,o=r.revealOrder,a=r.tail;if(xs(e,t,r.children,n),2&(r=ei.current))r=1&r|2,t.flags|=128;else{if(null!==e&&128&e.flags)e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Fs(e,n,t);else if(19===e.tag)Fs(e,n,t);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Io(ei,r),1&t.mode)switch(o){case"forwards":for(n=t.child,o=null;null!==n;)null!==(e=n.alternate)&&null===ti(e)&&(o=n),n=n.sibling;null===(n=o)?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),qs(t,!1,o,n,a);break;case"backwards":for(n=null,o=t.child,t.child=null;null!==o;){if(null!==(e=o.alternate)&&null===ti(e)){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}qs(t,!0,n,null,a);break;case"together":qs(t,!1,null,null,void 0);break;default:t.memoizedState=null}else t.memoizedState=null;return t.child}function Us(e,t){!(1&t.mode)&&null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Hs(e,t,n){if(null!==e&&(t.dependencies=e.dependencies),Mc|=t.lanes,0===(n&t.childLanes))return null;if(null!==e&&t.child!==e.child)throw Error(a(153));if(null!==t.child){for(n=Pl(e=t.child,e.pendingProps),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Pl(e,e.pendingProps)).return=t;n.sibling=null}return t.child}function Ks(e,t){if(!aa)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;null!==t;)null!==t.alternate&&(n=t),t=t.sibling;null===n?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;null!==n;)null!==n.alternate&&(r=n),n=n.sibling;null===r?t||null===e.tail?e.tail=null:e.tail.sibling=null:r.sibling=null}}function $s(e){var t=null!==e.alternate&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=14680064&o.subtreeFlags,r|=14680064&o.flags,o.return=e,o=o.sibling;else for(o=e.child;null!==o;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Gs(e,t,n){var r=t.pendingProps;switch(na(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $s(t),null;case 1:case 17:return Oo(t.type)&&Ro(),$s(t),null;case 3:return r=t.stateNode,Ja(),To(Eo),To(No),ri(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),null!==e&&null!==e.child||(ha(t)?t.flags|=4:null===e||e.memoizedState.isDehydrated&&!(256&t.flags)||(t.flags|=1024,null!==ia&&(al(ia),ia=null))),$s(t),null;case 5:Za(t);var o=Qa(Va.current);if(n=t.type,null!==e&&null!=t.stateNode)Ps(e,t,n,r),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(null===t.stateNode)throw Error(a(166));return $s(t),null}if(e=Qa(Ga.current),ha(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[po]=t,r[fo]=i,e=!!(1&t.mode),n){case"dialog":Fr("cancel",r),Fr("close",r);break;case"iframe":case"object":case"embed":Fr("load",r);break;case"video":case"audio":for(o=0;o<Mr.length;o++)Fr(Mr[o],r);break;case"source":Fr("error",r);break;case"img":case"image":case"link":Fr("error",r),Fr("load",r);break;case"details":Fr("toggle",r);break;case"input":Y(r,i),Fr("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Fr("invalid",r);break;case"textarea":oe(r,i),Fr("invalid",r)}for(var c in be(n,i),o=null,i)if(i.hasOwnProperty(c)){var l=i[c];"children"===c?"string"==typeof l?r.textContent!==l&&(!0!==i.suppressHydrationWarning&&Xr(r.textContent,l,e),o=["children",l]):"number"==typeof l&&r.textContent!==""+l&&(!0!==i.suppressHydrationWarning&&Xr(r.textContent,l,e),o=["children",""+l]):s.hasOwnProperty(c)&&null!=l&&"onScroll"===c&&Fr("scroll",r)}switch(n){case"input":G(r),Z(r,i,!0);break;case"textarea":G(r),ie(r);break;case"select":case"option":break;default:"function"==typeof i.onClick&&(r.onclick=Zr)}r=o,t.updateQueue=r,null!==r&&(t.flags|=4)}else{c=9===o.nodeType?o:o.ownerDocument,"http://www.w3.org/1999/xhtml"===e&&(e=se(n)),"http://www.w3.org/1999/xhtml"===e?"script"===n?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof r.is?e=c.createElement(n,{is:r.is}):(e=c.createElement(n),"select"===n&&(c=e,r.multiple?c.multiple=!0:r.size&&(c.size=r.size))):e=c.createElementNS(e,n),e[po]=t,e[fo]=r,_s(e,t),t.stateNode=e;e:{switch(c=ye(n,r),n){case"dialog":Fr("cancel",e),Fr("close",e),o=r;break;case"iframe":case"object":case"embed":Fr("load",e),o=r;break;case"video":case"audio":for(o=0;o<Mr.length;o++)Fr(Mr[o],e);o=r;break;case"source":Fr("error",e),o=r;break;case"img":case"image":case"link":Fr("error",e),Fr("load",e),o=r;break;case"details":Fr("toggle",e),o=r;break;case"input":Y(e,r),o=Q(e,r),Fr("invalid",e);break;case"option":default:o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=L({},r,{value:void 0}),Fr("invalid",e);break;case"textarea":oe(e,r),o=re(e,r),Fr("invalid",e)}for(i in be(n,o),l=o)if(l.hasOwnProperty(i)){var d=l[i];"style"===i?me(e,d):"dangerouslySetInnerHTML"===i?null!=(d=d?d.__html:void 0)&&ue(e,d):"children"===i?"string"==typeof d?("textarea"!==n||""!==d)&&he(e,d):"number"==typeof d&&he(e,""+d):"suppressContentEditableWarning"!==i&&"suppressHydrationWarning"!==i&&"autoFocus"!==i&&(s.hasOwnProperty(i)?null!=d&&"onScroll"===i&&Fr("scroll",e):null!=d&&y(e,i,d,c))}switch(n){case"input":G(e),Z(e,r,!1);break;case"textarea":G(e),ie(e);break;case"option":null!=r.value&&e.setAttribute("value",""+K(r.value));break;case"select":e.multiple=!!r.multiple,null!=(i=r.value)?ne(e,!!r.multiple,i,!1):null!=r.defaultValue&&ne(e,!!r.multiple,r.defaultValue,!0);break;default:"function"==typeof o.onClick&&(e.onclick=Zr)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}null!==t.ref&&(t.flags|=512,t.flags|=2097152)}return $s(t),null;case 6:if(e&&null!=t.stateNode)Os(0,t,e.memoizedProps,r);else{if("string"!=typeof r&&null===t.stateNode)throw Error(a(166));if(n=Qa(Va.current),Qa(Ga.current),ha(t)){if(r=t.stateNode,n=t.memoizedProps,r[po]=t,(i=r.nodeValue!==n)&&null!==(e=ra))switch(e.tag){case 3:Xr(r.nodeValue,n,!!(1&e.mode));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Xr(r.nodeValue,n,!!(1&e.mode))}i&&(t.flags|=4)}else(r=(9===n.nodeType?n:n.ownerDocument).createTextNode(r))[po]=t,t.stateNode=r}return $s(t),null;case 13:if(To(ei),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(aa&&null!==oa&&1&t.mode&&!(128&t.flags))pa(),fa(),t.flags|=98560,i=!1;else if(i=ha(t),null!==r&&null!==r.dehydrated){if(null===e){if(!i)throw Error(a(318));if(!(i=null!==(i=t.memoizedState)?i.dehydrated:null))throw Error(a(317));i[po]=t}else fa(),!(128&t.flags)&&(t.memoizedState=null),t.flags|=4;$s(t),i=!1}else null!==ia&&(al(ia),ia=null),i=!0;if(!i)return 65536&t.flags?t:null}return 128&t.flags?(t.lanes=n,t):((r=null!==r)!=(null!==e&&null!==e.memoizedState)&&r&&(t.child.flags|=8192,1&t.mode&&(null===e||1&ei.current?0===Oc&&(Oc=3):fl())),null!==t.updateQueue&&(t.flags|=4),$s(t),null);case 4:return Ja(),null===e&&Ur(t.stateNode.containerInfo),$s(t),null;case 10:return Aa(t.type._context),$s(t),null;case 19:if(To(ei),null===(i=t.memoizedState))return $s(t),null;if(r=!!(128&t.flags),null===(c=i.rendering))if(r)Ks(i,!1);else{if(0!==Oc||null!==e&&128&e.flags)for(e=t.child;null!==e;){if(null!==(c=ti(e))){for(t.flags|=128,Ks(i,!1),null!==(r=c.updateQueue)&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;null!==n;)e=r,(i=n).flags&=14680066,null===(c=i.alternate)?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,e=c.dependencies,i.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Io(ei,1&ei.current|2),t.child}e=e.sibling}null!==i.tail&&Je()>Bc&&(t.flags|=128,r=!0,Ks(i,!1),t.lanes=4194304)}else{if(!r)if(null!==(e=ti(c))){if(t.flags|=128,r=!0,null!==(n=e.updateQueue)&&(t.updateQueue=n,t.flags|=4),Ks(i,!0),null===i.tail&&"hidden"===i.tailMode&&!c.alternate&&!aa)return $s(t),null}else 2*Je()-i.renderingStartTime>Bc&&1073741824!==n&&(t.flags|=128,r=!0,Ks(i,!1),t.lanes=4194304);i.isBackwards?(c.sibling=t.child,t.child=c):(null!==(n=i.last)?n.sibling=c:t.child=c,i.last=c)}return null!==i.tail?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Je(),t.sibling=null,n=ei.current,Io(ei,r?1&n|2:1&n),t):($s(t),null);case 22:case 23:return dl(),r=null!==t.memoizedState,null!==e&&null!==e.memoizedState!==r&&(t.flags|=8192),r&&1&t.mode?!!(1073741824&_c)&&($s(t),6&t.subtreeFlags&&(t.flags|=8192)):$s(t),null;case 24:case 25:return null}throw Error(a(156,t.tag))}function Ws(e,t){switch(na(t),t.tag){case 1:return Oo(t.type)&&Ro(),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Ja(),To(Eo),To(No),ri(),65536&(e=t.flags)&&!(128&e)?(t.flags=-65537&e|128,t):null;case 5:return Za(t),null;case 13:if(To(ei),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(a(340));fa()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return To(ei),null;case 4:return Ja(),null;case 10:return Aa(t.type._context),null;case 22:case 23:return dl(),null;default:return null}}_s=function(e,t){for(var n=t.child;null!==n;){if(5===n.tag||6===n.tag)e.appendChild(n.stateNode);else if(4!==n.tag&&null!==n.child){n.child.return=n,n=n.child;continue}if(n===t)break;for(;null===n.sibling;){if(null===n.return||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ps=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Qa(Ga.current);var a,i=null;switch(n){case"input":o=Q(e,o),r=Q(e,r),i=[];break;case"select":o=L({},o,{value:void 0}),r=L({},r,{value:void 0}),i=[];break;case"textarea":o=re(e,o),r=re(e,r),i=[];break;default:"function"!=typeof o.onClick&&"function"==typeof r.onClick&&(e.onclick=Zr)}for(d in be(n,r),n=null,o)if(!r.hasOwnProperty(d)&&o.hasOwnProperty(d)&&null!=o[d])if("style"===d){var c=o[d];for(a in c)c.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else"dangerouslySetInnerHTML"!==d&&"children"!==d&&"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&"autoFocus"!==d&&(s.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var l=r[d];if(c=null!=o?o[d]:void 0,r.hasOwnProperty(d)&&l!==c&&(null!=l||null!=c))if("style"===d)if(c){for(a in c)!c.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in l)l.hasOwnProperty(a)&&c[a]!==l[a]&&(n||(n={}),n[a]=l[a])}else n||(i||(i=[]),i.push(d,n)),n=l;else"dangerouslySetInnerHTML"===d?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(i=i||[]).push(d,l)):"children"===d?"string"!=typeof l&&"number"!=typeof l||(i=i||[]).push(d,""+l):"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&(s.hasOwnProperty(d)?(null!=l&&"onScroll"===d&&Fr("scroll",e),i||c===l||(i=[])):(i=i||[]).push(d,l))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}},Os=function(e,t,n,r){n!==r&&(t.flags|=4)};var Vs=!1,Qs=!1,Ys="function"==typeof WeakSet?WeakSet:Set,Js=null;function Xs(e,t){var n=e.ref;if(null!==n)if("function"==typeof n)try{n(null)}catch(n){Cl(e,t,n)}else n.current=null}function Zs(e,t,n){try{n()}catch(n){Cl(e,t,n)}}var ec=!1;function tc(e,t,n){var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var o=r=r.next;do{if((o.tag&e)===e){var a=o.destroy;o.destroy=void 0,void 0!==a&&Zs(t,n,a)}o=o.next}while(o!==r)}}function nc(e,t){if(null!==(t=null!==(t=t.updateQueue)?t.lastEffect:null)){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function rc(e){var t=e.ref;if(null!==t){var n=e.stateNode;e.tag,e=n,"function"==typeof t?t(e):t.current=e}}function oc(e){var t=e.alternate;null!==t&&(e.alternate=null,oc(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&(delete t[po],delete t[fo],delete t[mo],delete t[vo],delete t[bo]),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function ac(e){return 5===e.tag||3===e.tag||4===e.tag}function ic(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||ac(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(2&e.flags)continue e;if(null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function sc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?8===n.nodeType?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(8===n.nodeType?(t=n.parentNode).insertBefore(e,n):(t=n).appendChild(e),null!=(n=n._reactRootContainer)||null!==t.onclick||(t.onclick=Zr));else if(4!==r&&null!==(e=e.child))for(sc(e,t,n),e=e.sibling;null!==e;)sc(e,t,n),e=e.sibling}function cc(e,t,n){var r=e.tag;if(5===r||6===r)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(4!==r&&null!==(e=e.child))for(cc(e,t,n),e=e.sibling;null!==e;)cc(e,t,n),e=e.sibling}var lc=null,dc=!1;function uc(e,t,n){for(n=n.child;null!==n;)hc(e,t,n),n=n.sibling}function hc(e,t,n){if(at&&"function"==typeof at.onCommitFiberUnmount)try{at.onCommitFiberUnmount(ot,n)}catch(e){}switch(n.tag){case 5:Qs||Xs(n,t);case 6:var r=lc,o=dc;lc=null,uc(e,t,n),dc=o,null!==(lc=r)&&(dc?(e=lc,n=n.stateNode,8===e.nodeType?e.parentNode.removeChild(n):e.removeChild(n)):lc.removeChild(n.stateNode));break;case 18:null!==lc&&(dc?(e=lc,n=n.stateNode,8===e.nodeType?co(e.parentNode,n):1===e.nodeType&&co(e,n),Ut(e)):co(lc,n.stateNode));break;case 4:r=lc,o=dc,lc=n.stateNode.containerInfo,dc=!0,uc(e,t,n),lc=r,dc=o;break;case 0:case 11:case 14:case 15:if(!Qs&&null!==(r=n.updateQueue)&&null!==(r=r.lastEffect)){o=r=r.next;do{var a=o,i=a.destroy;a=a.tag,void 0!==i&&(2&a||4&a)&&Zs(n,t,i),o=o.next}while(o!==r)}uc(e,t,n);break;case 1:if(!Qs&&(Xs(n,t),"function"==typeof(r=n.stateNode).componentWillUnmount))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Cl(n,t,e)}uc(e,t,n);break;case 21:uc(e,t,n);break;case 22:1&n.mode?(Qs=(r=Qs)||null!==n.memoizedState,uc(e,t,n),Qs=r):uc(e,t,n);break;default:uc(e,t,n)}}function pc(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var n=e.stateNode;null===n&&(n=e.stateNode=new Ys),t.forEach(function(t){var r=Il.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function fc(e,t){var n=t.deletions;if(null!==n)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,c=s;e:for(;null!==c;){switch(c.tag){case 5:lc=c.stateNode,dc=!1;break e;case 3:case 4:lc=c.stateNode.containerInfo,dc=!0;break e}c=c.return}if(null===lc)throw Error(a(160));hc(i,s,o),lc=null,dc=!1;var l=o.alternate;null!==l&&(l.return=null),o.return=null}catch(e){Cl(o,t,e)}}if(12854&t.subtreeFlags)for(t=t.child;null!==t;)gc(t,e),t=t.sibling}function gc(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(fc(t,e),mc(e),4&r){try{tc(3,e,e.return),nc(3,e)}catch(t){Cl(e,e.return,t)}try{tc(5,e,e.return)}catch(t){Cl(e,e.return,t)}}break;case 1:fc(t,e),mc(e),512&r&&null!==n&&Xs(n,n.return);break;case 5:if(fc(t,e),mc(e),512&r&&null!==n&&Xs(n,n.return),32&e.flags){var o=e.stateNode;try{he(o,"")}catch(t){Cl(e,e.return,t)}}if(4&r&&null!=(o=e.stateNode)){var i=e.memoizedProps,s=null!==n?n.memoizedProps:i,c=e.type,l=e.updateQueue;if(e.updateQueue=null,null!==l)try{"input"===c&&"radio"===i.type&&null!=i.name&&J(o,i),ye(c,s);var d=ye(c,i);for(s=0;s<l.length;s+=2){var u=l[s],h=l[s+1];"style"===u?me(o,h):"dangerouslySetInnerHTML"===u?ue(o,h):"children"===u?he(o,h):y(o,u,h,d)}switch(c){case"input":X(o,i);break;case"textarea":ae(o,i);break;case"select":var p=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var f=i.value;null!=f?ne(o,!!i.multiple,f,!1):p!==!!i.multiple&&(null!=i.defaultValue?ne(o,!!i.multiple,i.defaultValue,!0):ne(o,!!i.multiple,i.multiple?[]:"",!1))}o[fo]=i}catch(t){Cl(e,e.return,t)}}break;case 6:if(fc(t,e),mc(e),4&r){if(null===e.stateNode)throw Error(a(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(t){Cl(e,e.return,t)}}break;case 3:if(fc(t,e),mc(e),4&r&&null!==n&&n.memoizedState.isDehydrated)try{Ut(t.containerInfo)}catch(t){Cl(e,e.return,t)}break;case 4:default:fc(t,e),mc(e);break;case 13:fc(t,e),mc(e),8192&(o=e.child).flags&&(i=null!==o.memoizedState,o.stateNode.isHidden=i,!i||null!==o.alternate&&null!==o.alternate.memoizedState||(qc=Je())),4&r&&pc(e);break;case 22:if(u=null!==n&&null!==n.memoizedState,1&e.mode?(Qs=(d=Qs)||u,fc(t,e),Qs=d):fc(t,e),mc(e),8192&r){if(d=null!==e.memoizedState,(e.stateNode.isHidden=d)&&!u&&1&e.mode)for(Js=e,u=e.child;null!==u;){for(h=Js=u;null!==Js;){switch(f=(p=Js).child,p.tag){case 0:case 11:case 14:case 15:tc(4,p,p.return);break;case 1:Xs(p,p.return);var g=p.stateNode;if("function"==typeof g.componentWillUnmount){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(e){Cl(r,n,e)}}break;case 5:Xs(p,p.return);break;case 22:if(null!==p.memoizedState){xc(h);continue}}null!==f?(f.return=p,Js=f):xc(h)}u=u.sibling}e:for(u=null,h=e;;){if(5===h.tag){if(null===u){u=h;try{o=h.stateNode,d?"function"==typeof(i=o.style).setProperty?i.setProperty("display","none","important"):i.display="none":(c=h.stateNode,s=null!=(l=h.memoizedProps.style)&&l.hasOwnProperty("display")?l.display:null,c.style.display=ge("display",s))}catch(t){Cl(e,e.return,t)}}}else if(6===h.tag){if(null===u)try{h.stateNode.nodeValue=d?"":h.memoizedProps}catch(t){Cl(e,e.return,t)}}else if((22!==h.tag&&23!==h.tag||null===h.memoizedState||h===e)&&null!==h.child){h.child.return=h,h=h.child;continue}if(h===e)break e;for(;null===h.sibling;){if(null===h.return||h.return===e)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:fc(t,e),mc(e),4&r&&pc(e);case 21:}}function mc(e){var t=e.flags;if(2&t){try{e:{for(var n=e.return;null!==n;){if(ac(n)){var r=n;break e}n=n.return}throw Error(a(160))}switch(r.tag){case 5:var o=r.stateNode;32&r.flags&&(he(o,""),r.flags&=-33),cc(e,ic(e),o);break;case 3:case 4:var i=r.stateNode.containerInfo;sc(e,ic(e),i);break;default:throw Error(a(161))}}catch(t){Cl(e,e.return,t)}e.flags&=-3}4096&t&&(e.flags&=-4097)}function vc(e,t,n){Js=e,bc(e,t,n)}function bc(e,t,n){for(var r=!!(1&e.mode);null!==Js;){var o=Js,a=o.child;if(22===o.tag&&r){var i=null!==o.memoizedState||Vs;if(!i){var s=o.alternate,c=null!==s&&null!==s.memoizedState||Qs;s=Vs;var l=Qs;if(Vs=i,(Qs=c)&&!l)for(Js=o;null!==Js;)c=(i=Js).child,22===i.tag&&null!==i.memoizedState?wc(o):null!==c?(c.return=i,Js=c):wc(o);for(;null!==a;)Js=a,bc(a,t,n),a=a.sibling;Js=o,Vs=s,Qs=l}yc(e)}else 8772&o.subtreeFlags&&null!==a?(a.return=o,Js=a):yc(e)}}function yc(e){for(;null!==Js;){var t=Js;if(8772&t.flags){var n=t.alternate;try{if(8772&t.flags)switch(t.tag){case 0:case 11:case 15:Qs||nc(5,t);break;case 1:var r=t.stateNode;if(4&t.flags&&!Qs)if(null===n)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:ns(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;null!==i&&Ka(t,i,r);break;case 3:var s=t.updateQueue;if(null!==s){if(n=null,null!==t.child)switch(t.child.tag){case 5:case 1:n=t.child.stateNode}Ka(t,s,n)}break;case 5:var c=t.stateNode;if(null===n&&4&t.flags){n=c;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:case 4:case 12:case 19:case 17:case 21:case 22:case 23:case 25:break;case 13:if(null===t.memoizedState){var d=t.alternate;if(null!==d){var u=d.memoizedState;if(null!==u){var h=u.dehydrated;null!==h&&Ut(h)}}}break;default:throw Error(a(163))}Qs||512&t.flags&&rc(t)}catch(e){Cl(t,t.return,e)}}if(t===e){Js=null;break}if(null!==(n=t.sibling)){n.return=t.return,Js=n;break}Js=t.return}}function xc(e){for(;null!==Js;){var t=Js;if(t===e){Js=null;break}var n=t.sibling;if(null!==n){n.return=t.return,Js=n;break}Js=t.return}}function wc(e){for(;null!==Js;){var t=Js;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{nc(4,t)}catch(e){Cl(t,n,e)}break;case 1:var r=t.stateNode;if("function"==typeof r.componentDidMount){var o=t.return;try{r.componentDidMount()}catch(e){Cl(t,o,e)}}var a=t.return;try{rc(t)}catch(e){Cl(t,a,e)}break;case 5:var i=t.return;try{rc(t)}catch(e){Cl(t,i,e)}}}catch(e){Cl(t,t.return,e)}if(t===e){Js=null;break}var s=t.sibling;if(null!==s){s.return=t.return,Js=s;break}Js=t.return}}var kc,Cc=Math.ceil,Sc=x.ReactCurrentDispatcher,jc=x.ReactCurrentOwner,Tc=x.ReactCurrentBatchConfig,Ic=0,Ac=null,Nc=null,Ec=0,_c=0,Pc=jo(0),Oc=0,Rc=null,Mc=0,zc=0,Lc=0,Dc=null,Fc=null,qc=0,Bc=1/0,Uc=null,Hc=!1,Kc=null,$c=null,Gc=!1,Wc=null,Vc=0,Qc=0,Yc=null,Jc=-1,Xc=0;function Zc(){return 6&Ic?Je():-1!==Jc?Jc:Jc=Je()}function el(e){return 1&e.mode?2&Ic&&0!==Ec?Ec&-Ec:null!==ma.transition?(0===Xc&&(Xc=gt()),Xc):0!==(e=yt)?e:e=void 0===(e=window.event)?16:Yt(e.type):1}function tl(e,t,n,r){if(50<Qc)throw Qc=0,Yc=null,Error(a(185));vt(e,n,r),2&Ic&&e===Ac||(e===Ac&&(!(2&Ic)&&(zc|=n),4===Oc&&il(e,Ec)),nl(e,r),1===n&&0===Ic&&!(1&t.mode)&&(Bc=Je()+500,qo&&Ho()))}function nl(e,t){var n=e.callbackNode;!function(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,a=e.pendingLanes;0<a;){var i=31-it(a),s=1<<i,c=o[i];-1===c?0!==(s&n)&&0===(s&r)||(o[i]=pt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}(e,t);var r=ht(e,e===Ac?Ec:0);if(0===r)null!==n&&Ve(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(null!=n&&Ve(n),1===t)0===e.tag?function(e){qo=!0,Uo(e)}(sl.bind(null,e)):Uo(sl.bind(null,e)),io(function(){!(6&Ic)&&Ho()}),n=null;else{switch(xt(r)){case 1:n=Ze;break;case 4:n=et;break;case 16:default:n=tt;break;case 536870912:n=rt}n=Al(n,rl.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function rl(e,t){if(Jc=-1,Xc=0,6&Ic)throw Error(a(327));var n=e.callbackNode;if(wl()&&e.callbackNode!==n)return null;var r=ht(e,e===Ac?Ec:0);if(0===r)return null;if(30&r||0!==(r&e.expiredLanes)||t)t=gl(e,r);else{t=r;var o=Ic;Ic|=2;var i=pl();for(Ac===e&&Ec===t||(Uc=null,Bc=Je()+500,ul(e,t));;)try{vl();break}catch(t){hl(e,t)}Ia(),Sc.current=i,Ic=o,null!==Nc?t=0:(Ac=null,Ec=0,t=Oc)}if(0!==t){if(2===t&&0!==(o=ft(e))&&(r=o,t=ol(e,o)),1===t)throw n=Rc,ul(e,0),il(e,r),nl(e,Je()),n;if(6===t)il(e,r);else{if(o=e.current.alternate,!(30&r||function(e){for(var t=e;;){if(16384&t.flags){var n=t.updateQueue;if(null!==n&&null!==(n=n.stores))for(var r=0;r<n.length;r++){var o=n[r],a=o.getSnapshot;o=o.value;try{if(!sr(a(),o))return!1}catch(e){return!1}}}if(n=t.child,16384&t.subtreeFlags&&null!==n)n.return=t,t=n;else{if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}(o)||(t=gl(e,r),2===t&&(i=ft(e),0!==i&&(r=i,t=ol(e,i))),1!==t)))throw n=Rc,ul(e,0),il(e,r),nl(e,Je()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(a(345));case 2:case 5:xl(e,Fc,Uc);break;case 3:if(il(e,r),(130023424&r)===r&&10<(t=qc+500-Je())){if(0!==ht(e,0))break;if(((o=e.suspendedLanes)&r)!==r){Zc(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ro(xl.bind(null,e,Fc,Uc),t);break}xl(e,Fc,Uc);break;case 4:if(il(e,r),(4194240&r)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-it(r);i=1<<s,(s=t[s])>o&&(o=s),r&=~i}if(r=o,10<(r=(120>(r=Je()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Cc(r/1960))-r)){e.timeoutHandle=ro(xl.bind(null,e,Fc,Uc),r);break}xl(e,Fc,Uc);break;default:throw Error(a(329))}}}return nl(e,Je()),e.callbackNode===n?rl.bind(null,e):null}function ol(e,t){var n=Dc;return e.current.memoizedState.isDehydrated&&(ul(e,t).flags|=256),2!==(e=gl(e,t))&&(t=Fc,Fc=n,null!==t&&al(t)),e}function al(e){null===Fc?Fc=e:Fc.push.apply(Fc,e)}function il(e,t){for(t&=~Lc,t&=~zc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-it(t),r=1<<n;e[n]=-1,t&=~r}}function sl(e){if(6&Ic)throw Error(a(327));wl();var t=ht(e,0);if(!(1&t))return nl(e,Je()),null;var n=gl(e,t);if(0!==e.tag&&2===n){var r=ft(e);0!==r&&(t=r,n=ol(e,r))}if(1===n)throw n=Rc,ul(e,0),il(e,t),nl(e,Je()),n;if(6===n)throw Error(a(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,xl(e,Fc,Uc),nl(e,Je()),null}function cl(e,t){var n=Ic;Ic|=1;try{return e(t)}finally{0===(Ic=n)&&(Bc=Je()+500,qo&&Ho())}}function ll(e){null!==Wc&&0===Wc.tag&&!(6&Ic)&&wl();var t=Ic;Ic|=1;var n=Tc.transition,r=yt;try{if(Tc.transition=null,yt=1,e)return e()}finally{yt=r,Tc.transition=n,!(6&(Ic=t))&&Ho()}}function dl(){_c=Pc.current,To(Pc)}function ul(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(-1!==n&&(e.timeoutHandle=-1,oo(n)),null!==Nc)for(n=Nc.return;null!==n;){var r=n;switch(na(r),r.tag){case 1:null!=(r=r.type.childContextTypes)&&Ro();break;case 3:Ja(),To(Eo),To(No),ri();break;case 5:Za(r);break;case 4:Ja();break;case 13:case 19:To(ei);break;case 10:Aa(r.type._context);break;case 22:case 23:dl()}n=n.return}if(Ac=e,Nc=e=Pl(e.current,null),Ec=_c=t,Oc=0,Rc=null,Lc=zc=Mc=0,Fc=Dc=null,null!==Pa){for(t=0;t<Pa.length;t++)if(null!==(r=(n=Pa[t]).interleaved)){n.interleaved=null;var o=r.next,a=n.pending;if(null!==a){var i=a.next;a.next=o,r.next=i}n.pending=r}Pa=null}return e}function hl(e,t){for(;;){var n=Nc;try{if(Ia(),oi.current=Xi,di){for(var r=si.memoizedState;null!==r;){var o=r.queue;null!==o&&(o.pending=null),r=r.next}di=!1}if(ii=0,li=ci=si=null,ui=!1,hi=0,jc.current=null,null===n||null===n.return){Oc=1,Rc=t,Nc=null;break}e:{var i=e,s=n.return,c=n,l=t;if(t=Ec,c.flags|=32768,null!==l&&"object"==typeof l&&"function"==typeof l.then){var d=l,u=c,h=u.tag;if(!(1&u.mode||0!==h&&11!==h&&15!==h)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var f=ms(s);if(null!==f){f.flags&=-257,vs(f,s,c,0,t),1&f.mode&&gs(i,d,t),l=d;var g=(t=f).updateQueue;if(null===g){var m=new Set;m.add(l),t.updateQueue=m}else g.add(l);break e}if(!(1&t)){gs(i,d,t),fl();break e}l=Error(a(426))}else if(aa&&1&c.mode){var v=ms(s);if(null!==v){!(65536&v.flags)&&(v.flags|=256),vs(v,s,c,0,t),ga(ls(l,c));break e}}i=l=ls(l,c),4!==Oc&&(Oc=2),null===Dc?Dc=[i]:Dc.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t,Ua(i,ps(0,l,t));break e;case 1:c=l;var b=i.type,y=i.stateNode;if(!(128&i.flags||"function"!=typeof b.getDerivedStateFromError&&(null===y||"function"!=typeof y.componentDidCatch||null!==$c&&$c.has(y)))){i.flags|=65536,t&=-t,i.lanes|=t,Ua(i,fs(i,c,t));break e}}i=i.return}while(null!==i)}yl(n)}catch(e){t=e,Nc===n&&null!==n&&(Nc=n=n.return);continue}break}}function pl(){var e=Sc.current;return Sc.current=Xi,null===e?Xi:e}function fl(){0!==Oc&&3!==Oc&&2!==Oc||(Oc=4),null===Ac||!(268435455&Mc)&&!(268435455&zc)||il(Ac,Ec)}function gl(e,t){var n=Ic;Ic|=2;var r=pl();for(Ac===e&&Ec===t||(Uc=null,ul(e,t));;)try{ml();break}catch(t){hl(e,t)}if(Ia(),Ic=n,Sc.current=r,null!==Nc)throw Error(a(261));return Ac=null,Ec=0,Oc}function ml(){for(;null!==Nc;)bl(Nc)}function vl(){for(;null!==Nc&&!Qe();)bl(Nc)}function bl(e){var t=kc(e.alternate,e,_c);e.memoizedProps=e.pendingProps,null===t?yl(e):Nc=t,jc.current=null}function yl(e){var t=e;do{var n=t.alternate;if(e=t.return,32768&t.flags){if(null!==(n=Ws(n,t)))return n.flags&=32767,void(Nc=n);if(null===e)return Oc=6,void(Nc=null);e.flags|=32768,e.subtreeFlags=0,e.deletions=null}else if(null!==(n=Gs(n,t,_c)))return void(Nc=n);if(null!==(t=t.sibling))return void(Nc=t);Nc=t=e}while(null!==t);0===Oc&&(Oc=5)}function xl(e,t,n){var r=yt,o=Tc.transition;try{Tc.transition=null,yt=1,function(e,t,n,r){do{wl()}while(null!==Wc);if(6&Ic)throw Error(a(327));n=e.finishedWork;var o=e.finishedLanes;if(null===n)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(a(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(function(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-it(n),a=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~a}}(e,i),e===Ac&&(Nc=Ac=null,Ec=0),!(2064&n.subtreeFlags)&&!(2064&n.flags)||Gc||(Gc=!0,Al(tt,function(){return wl(),null})),i=!!(15990&n.flags),15990&n.subtreeFlags||i){i=Tc.transition,Tc.transition=null;var s=yt;yt=1;var c=Ic;Ic|=4,jc.current=null,function(e,t){if(eo=Kt,pr(e=hr())){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{var r=(n=(n=e.ownerDocument)&&n.defaultView||window).getSelection&&n.getSelection();if(r&&0!==r.rangeCount){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch(e){n=null;break e}var s=0,c=-1,l=-1,d=0,u=0,h=e,p=null;t:for(;;){for(var f;h!==n||0!==o&&3!==h.nodeType||(c=s+o),h!==i||0!==r&&3!==h.nodeType||(l=s+r),3===h.nodeType&&(s+=h.nodeValue.length),null!==(f=h.firstChild);)p=h,h=f;for(;;){if(h===e)break t;if(p===n&&++d===o&&(c=s),p===i&&++u===r&&(l=s),null!==(f=h.nextSibling))break;p=(h=p).parentNode}h=f}n=-1===c||-1===l?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(to={focusedElem:e,selectionRange:n},Kt=!1,Js=t;null!==Js;)if(e=(t=Js).child,1028&t.subtreeFlags&&null!==e)e.return=t,Js=e;else for(;null!==Js;){t=Js;try{var g=t.alternate;if(1024&t.flags)switch(t.tag){case 0:case 11:case 15:case 5:case 6:case 4:case 17:break;case 1:if(null!==g){var m=g.memoizedProps,v=g.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:ns(t.type,m),v);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;1===x.nodeType?x.textContent="":9===x.nodeType&&x.documentElement&&x.removeChild(x.documentElement);break;default:throw Error(a(163))}}catch(e){Cl(t,t.return,e)}if(null!==(e=t.sibling)){e.return=t.return,Js=e;break}Js=t.return}g=ec,ec=!1}(e,n),gc(n,e),fr(to),Kt=!!eo,to=eo=null,e.current=n,vc(n,e,o),Ye(),Ic=c,yt=s,Tc.transition=i}else e.current=n;if(Gc&&(Gc=!1,Wc=e,Vc=o),0===(i=e.pendingLanes)&&($c=null),function(e){if(at&&"function"==typeof at.onCommitFiberRoot)try{at.onCommitFiberRoot(ot,e,void 0,!(128&~e.current.flags))}catch(e){}}(n.stateNode),nl(e,Je()),null!==t)for(r=e.onRecoverableError,n=0;n<t.length;n++)r((o=t[n]).value,{componentStack:o.stack,digest:o.digest});if(Hc)throw Hc=!1,e=Kc,Kc=null,e;!!(1&Vc)&&0!==e.tag&&wl(),1&(i=e.pendingLanes)?e===Yc?Qc++:(Qc=0,Yc=e):Qc=0,Ho()}(e,t,n,r)}finally{Tc.transition=o,yt=r}return null}function wl(){if(null!==Wc){var e=xt(Vc),t=Tc.transition,n=yt;try{if(Tc.transition=null,yt=16>e?16:e,null===Wc)var r=!1;else{if(e=Wc,Wc=null,Vc=0,6&Ic)throw Error(a(331));var o=Ic;for(Ic|=4,Js=e.current;null!==Js;){var i=Js,s=i.child;if(16&Js.flags){var c=i.deletions;if(null!==c){for(var l=0;l<c.length;l++){var d=c[l];for(Js=d;null!==Js;){var u=Js;switch(u.tag){case 0:case 11:case 15:tc(8,u,i)}var h=u.child;if(null!==h)h.return=u,Js=h;else for(;null!==Js;){var p=(u=Js).sibling,f=u.return;if(oc(u),u===d){Js=null;break}if(null!==p){p.return=f,Js=p;break}Js=f}}}var g=i.alternate;if(null!==g){var m=g.child;if(null!==m){g.child=null;do{var v=m.sibling;m.sibling=null,m=v}while(null!==m)}}Js=i}}if(2064&i.subtreeFlags&&null!==s)s.return=i,Js=s;else e:for(;null!==Js;){if(2048&(i=Js).flags)switch(i.tag){case 0:case 11:case 15:tc(9,i,i.return)}var b=i.sibling;if(null!==b){b.return=i.return,Js=b;break e}Js=i.return}}var y=e.current;for(Js=y;null!==Js;){var x=(s=Js).child;if(2064&s.subtreeFlags&&null!==x)x.return=s,Js=x;else e:for(s=y;null!==Js;){if(2048&(c=Js).flags)try{switch(c.tag){case 0:case 11:case 15:nc(9,c)}}catch(e){Cl(c,c.return,e)}if(c===s){Js=null;break e}var w=c.sibling;if(null!==w){w.return=c.return,Js=w;break e}Js=c.return}}if(Ic=o,Ho(),at&&"function"==typeof at.onPostCommitFiberRoot)try{at.onPostCommitFiberRoot(ot,e)}catch(e){}r=!0}return r}finally{yt=n,Tc.transition=t}}return!1}function kl(e,t,n){e=qa(e,t=ps(0,t=ls(n,t),1),1),t=Zc(),null!==e&&(vt(e,1,t),nl(e,t))}function Cl(e,t,n){if(3===e.tag)kl(e,e,n);else for(;null!==t;){if(3===t.tag){kl(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===$c||!$c.has(r))){t=qa(t,e=fs(t,e=ls(n,e),1),1),e=Zc(),null!==t&&(vt(t,1,e),nl(t,e));break}}t=t.return}}function Sl(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),t=Zc(),e.pingedLanes|=e.suspendedLanes&n,Ac===e&&(Ec&n)===n&&(4===Oc||3===Oc&&(130023424&Ec)===Ec&&500>Je()-qc?ul(e,0):Lc|=n),nl(e,t)}function jl(e,t){0===t&&(1&e.mode?(t=dt,!(130023424&(dt<<=1))&&(dt=4194304)):t=1);var n=Zc();null!==(e=Ma(e,t))&&(vt(e,t,n),nl(e,n))}function Tl(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),jl(e,n)}function Il(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;null!==o&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(a(314))}null!==r&&r.delete(t),jl(e,n)}function Al(e,t){return We(e,t)}function Nl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function El(e,t,n,r){return new Nl(e,t,n,r)}function _l(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Pl(e,t){var n=e.alternate;return null===n?((n=El(e.tag,t,e.key,e.mode)).elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=14680064&e.flags,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ol(e,t,n,r,o,i){var s=2;if(r=e,"function"==typeof e)_l(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case C:return Rl(n.children,o,i,t);case S:s=8,o|=8;break;case j:return(e=El(12,n,t,2|o)).elementType=j,e.lanes=i,e;case N:return(e=El(13,n,t,o)).elementType=N,e.lanes=i,e;case E:return(e=El(19,n,t,o)).elementType=E,e.lanes=i,e;case O:return Ml(n,o,i,t);default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case T:s=10;break e;case I:s=9;break e;case A:s=11;break e;case _:s=14;break e;case P:s=16,r=null;break e}throw Error(a(130,null==e?e:typeof e,""))}return(t=El(s,n,t,o)).elementType=e,t.type=r,t.lanes=i,t}function Rl(e,t,n,r){return(e=El(7,e,r,t)).lanes=n,e}function Ml(e,t,n,r){return(e=El(22,e,r,t)).elementType=O,e.lanes=n,e.stateNode={isHidden:!1},e}function zl(e,t,n){return(e=El(6,e,null,t)).lanes=n,e}function Ll(e,t,n){return(t=El(4,null!==e.children?e.children:[],e.key,t)).lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Dl(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=mt(0),this.expirationTimes=mt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=mt(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Fl(e,t,n,r,o,a,i,s,c){return e=new Dl(e,t,n,s,c),1===t?(t=1,!0===a&&(t|=8)):t=0,a=El(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},La(a),e}function ql(e){if(!e)return Ao;e:{if(Ue(e=e._reactInternals)!==e||1!==e.tag)throw Error(a(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Oo(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);throw Error(a(171))}if(1===e.tag){var n=e.type;if(Oo(n))return zo(e,n,t)}return t}function Bl(e,t,n,r,o,a,i,s,c){return(e=Fl(n,r,!0,e,0,a,0,s,c)).context=ql(null),n=e.current,(a=Fa(r=Zc(),o=el(n))).callback=null!=t?t:null,qa(n,a,o),e.current.lanes=o,vt(e,o,r),nl(e,r),e}function Ul(e,t,n,r){var o=t.current,a=Zc(),i=el(o);return n=ql(n),null===t.context?t.context=n:t.pendingContext=n,(t=Fa(a,i)).payload={element:e},null!==(r=void 0===r?null:r)&&(t.callback=r),null!==(e=qa(o,t,i))&&(tl(e,o,i,a),Ba(e,o,i)),i}function Hl(e){return(e=e.current).child?(e.child.tag,e.child.stateNode):null}function Kl(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n<t?n:t}}function $l(e,t){Kl(e,t),(e=e.alternate)&&Kl(e,t)}kc=function(e,t,n){if(null!==e)if(e.memoizedProps!==t.pendingProps||Eo.current)ys=!0;else{if(0===(e.lanes&n)&&!(128&t.flags))return ys=!1,function(e,t,n){switch(t.tag){case 3:Ns(t),fa();break;case 5:Xa(t);break;case 1:Oo(t.type)&&Lo(t);break;case 4:Ya(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Io(Ca,r._currentValue),r._currentValue=o;break;case 13:if(null!==(r=t.memoizedState))return null!==r.dehydrated?(Io(ei,1&ei.current),t.flags|=128,null):0!==(n&t.child.childLanes)?zs(e,t,n):(Io(ei,1&ei.current),null!==(e=Hs(e,t,n))?e.sibling:null);Io(ei,1&ei.current);break;case 19:if(r=0!==(n&t.childLanes),128&e.flags){if(r)return Bs(e,t,n);t.flags|=128}if(null!==(o=t.memoizedState)&&(o.rendering=null,o.tail=null,o.lastEffect=null),Io(ei,ei.current),r)break;return null;case 22:case 23:return t.lanes=0,Ss(e,t,n)}return Hs(e,t,n)}(e,t,n);ys=!!(131072&e.flags)}else ys=!1,aa&&1048576&t.flags&&ea(t,Wo,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Us(e,t),e=t.pendingProps;var o=Po(t,No.current);Ea(t,n),o=mi(null,t,r,e,o,n);var i=vi();return t.flags|=1,"object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oo(r)?(i=!0,Lo(t)):i=!1,t.memoizedState=null!==o.state&&void 0!==o.state?o.state:null,La(t),o.updater=os,t.stateNode=o,o._reactInternals=t,cs(t,r,e,n),t=As(null,t,r,!0,i,n)):(t.tag=0,aa&&i&&ta(t),xs(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Us(e,t),e=t.pendingProps,r=(o=r._init)(r._payload),t.type=r,o=t.tag=function(e){if("function"==typeof e)return _l(e)?1:0;if(null!=e){if((e=e.$$typeof)===A)return 11;if(e===_)return 14}return 2}(r),e=ns(r,e),o){case 0:t=Ts(null,t,r,e,n);break e;case 1:t=Is(null,t,r,e,n);break e;case 11:t=ws(null,t,r,e,n);break e;case 14:t=ks(null,t,r,ns(r.type,e),n);break e}throw Error(a(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,Ts(e,t,r,o=t.elementType===r?o:ns(r,o),n);case 1:return r=t.type,o=t.pendingProps,Is(e,t,r,o=t.elementType===r?o:ns(r,o),n);case 3:e:{if(Ns(t),null===e)throw Error(a(387));r=t.pendingProps,o=(i=t.memoizedState).element,Da(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated){if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,256&t.flags){t=Es(e,t,r,n,o=ls(Error(a(423)),t));break e}if(r!==o){t=Es(e,t,r,n,o=ls(Error(a(424)),t));break e}for(oa=lo(t.stateNode.containerInfo.firstChild),ra=t,aa=!0,ia=null,n=ka(t,null,r,n),t.child=n;n;)n.flags=-3&n.flags|4096,n=n.sibling}else{if(fa(),r===o){t=Hs(e,t,n);break e}xs(e,t,r,n)}t=t.child}return t;case 5:return Xa(t),null===e&&da(t),r=t.type,o=t.pendingProps,i=null!==e?e.memoizedProps:null,s=o.children,no(r,o)?s=null:null!==i&&no(r,i)&&(t.flags|=32),js(e,t),xs(e,t,s,n),t.child;case 6:return null===e&&da(t),null;case 13:return zs(e,t,n);case 4:return Ya(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=wa(t,null,r,n):xs(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,ws(e,t,r,o=t.elementType===r?o:ns(r,o),n);case 7:return xs(e,t,t.pendingProps,n),t.child;case 8:case 12:return xs(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Io(Ca,r._currentValue),r._currentValue=s,null!==i)if(sr(i.value,s)){if(i.children===o.children&&!Eo.current){t=Hs(e,t,n);break e}}else for(null!==(i=t.child)&&(i.return=t);null!==i;){var c=i.dependencies;if(null!==c){s=i.child;for(var l=c.firstContext;null!==l;){if(l.context===r){if(1===i.tag){(l=Fa(-1,n&-n)).tag=2;var d=i.updateQueue;if(null!==d){var u=(d=d.shared).pending;null===u?l.next=l:(l.next=u.next,u.next=l),d.pending=l}}i.lanes|=n,null!==(l=i.alternate)&&(l.lanes|=n),Na(i.return,n,t),c.lanes|=n;break}l=l.next}}else if(10===i.tag)s=i.type===t.type?null:i.child;else if(18===i.tag){if(null===(s=i.return))throw Error(a(341));s.lanes|=n,null!==(c=s.alternate)&&(c.lanes|=n),Na(s,n,t),s=i.sibling}else s=i.child;if(null!==s)s.return=i;else for(s=i;null!==s;){if(s===t){s=null;break}if(null!==(i=s.sibling)){i.return=s.return,s=i;break}s=s.return}i=s}xs(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Ea(t,n),r=r(o=_a(o)),t.flags|=1,xs(e,t,r,n),t.child;case 14:return o=ns(r=t.type,t.pendingProps),ks(e,t,r,o=ns(r.type,o),n);case 15:return Cs(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:ns(r,o),Us(e,t),t.tag=1,Oo(r)?(e=!0,Lo(t)):e=!1,Ea(t,n),is(t,r,o),cs(t,r,o,n),As(null,t,r,!0,e,n);case 19:return Bs(e,t,n);case 22:return Ss(e,t,n)}throw Error(a(156,t.tag))};var Gl="function"==typeof reportError?reportError:function(e){console.error(e)};function Wl(e){this._internalRoot=e}function Vl(e){this._internalRoot=e}function Ql(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType)}function Yl(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Jl(){}function Xl(e,t,n,r,o){var a=n._reactRootContainer;if(a){var i=a;if("function"==typeof o){var s=o;o=function(){var e=Hl(i);s.call(e)}}Ul(t,i,e,o)}else i=function(e,t,n,r,o){if(o){if("function"==typeof r){var a=r;r=function(){var e=Hl(i);a.call(e)}}var i=Bl(t,r,e,0,null,!1,0,"",Jl);return e._reactRootContainer=i,e[go]=i.current,Ur(8===e.nodeType?e.parentNode:e),ll(),i}for(;o=e.lastChild;)e.removeChild(o);if("function"==typeof r){var s=r;r=function(){var e=Hl(c);s.call(e)}}var c=Fl(e,0,!1,null,0,!1,0,"",Jl);return e._reactRootContainer=c,e[go]=c.current,Ur(8===e.nodeType?e.parentNode:e),ll(function(){Ul(t,c,n,r)}),c}(n,t,e,o,r);return Hl(i)}Vl.prototype.render=Wl.prototype.render=function(e){var t=this._internalRoot;if(null===t)throw Error(a(409));Ul(e,t,null,null)},Vl.prototype.unmount=Wl.prototype.unmount=function(){var e=this._internalRoot;if(null!==e){this._internalRoot=null;var t=e.containerInfo;ll(function(){Ul(null,e,null,null)}),t[go]=null}},Vl.prototype.unstable_scheduleHydration=function(e){if(e){var t=St();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ot.length&&0!==t&&t<Ot[n].priority;n++);Ot.splice(n,0,e),0===n&&Lt(e)}},wt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ut(t.pendingLanes);0!==n&&(bt(t,1|n),nl(t,Je()),!(6&Ic)&&(Bc=Je()+500,Ho()))}break;case 13:ll(function(){var t=Ma(e,1);if(null!==t){var n=Zc();tl(t,e,1,n)}}),$l(e,1)}},kt=function(e){if(13===e.tag){var t=Ma(e,134217728);null!==t&&tl(t,e,134217728,Zc()),$l(e,134217728)}},Ct=function(e){if(13===e.tag){var t=el(e),n=Ma(e,t);null!==n&&tl(n,e,t,Zc()),$l(e,t)}},St=function(){return yt},jt=function(e,t){var n=yt;try{return yt=e,t()}finally{yt=n}},ke=function(e,t,n){switch(t){case"input":if(X(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=ko(r);if(!o)throw Error(a(90));W(r),X(r,o)}}}break;case"textarea":ae(e,n);break;case"select":null!=(t=n.value)&&ne(e,!!n.multiple,t,!1)}},Ae=cl,Ne=ll;var Zl={usingClientEntryPoint:!1,Events:[xo,wo,ko,Te,Ie,cl]},ed={findFiberByHostInstance:yo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},td={bundleType:ed.bundleType,version:ed.version,rendererPackageName:ed.rendererPackageName,rendererConfig:ed.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=$e(e))?null:e.stateNode},findFiberByHostInstance:ed.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var nd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!nd.isDisabled&&nd.supportsFiber)try{ot=nd.inject(td),at=nd}catch(de){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Zl,t.createPortal=function(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Ql(t))throw Error(a(200));return function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:k,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)},t.createRoot=function(e,t){if(!Ql(e))throw Error(a(299));var n=!1,r="",o=Gl;return null!=t&&(!0===t.unstable_strictMode&&(n=!0),void 0!==t.identifierPrefix&&(r=t.identifierPrefix),void 0!==t.onRecoverableError&&(o=t.onRecoverableError)),t=Fl(e,1,!1,null,0,n,0,r,o),e[go]=t.current,Ur(8===e.nodeType?e.parentNode:e),new Wl(t)},t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(a(188));throw e=Object.keys(e).join(","),Error(a(268,e))}return null===(e=$e(t))?null:e.stateNode},t.flushSync=function(e){return ll(e)},t.hydrate=function(e,t,n){if(!Yl(t))throw Error(a(200));return Xl(null,e,t,!0,n)},t.hydrateRoot=function(e,t,n){if(!Ql(e))throw Error(a(405));var r=null!=n&&n.hydratedSources||null,o=!1,i="",s=Gl;if(null!=n&&(!0===n.unstable_strictMode&&(o=!0),void 0!==n.identifierPrefix&&(i=n.identifierPrefix),void 0!==n.onRecoverableError&&(s=n.onRecoverableError)),t=Bl(t,null,e,1,null!=n?n:null,o,0,i,s),e[go]=t.current,Ur(e),r)for(e=0;e<r.length;e++)o=(o=(n=r[e])._getVersion)(n._source),null==t.mutableSourceEagerHydrationData?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Vl(t)},t.render=function(e,t,n){if(!Yl(t))throw Error(a(200));return Xl(null,e,t,!1,n)},t.unmountComponentAtNode=function(e){if(!Yl(e))throw Error(a(40));return!!e._reactRootContainer&&(ll(function(){Xl(null,null,e,!1,function(){e._reactRootContainer=null,e[go]=null})}),!0)},t.unstable_batchedUpdates=cl,t.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Yl(n))throw Error(a(200));if(null==e||void 0===e._reactInternals)throw Error(a(38));return Xl(e,t,n,!1,r)},t.version="18.3.1-next-f1338f8080-20240426"},601(e){e.exports=function(e){return e[1]}},659(e){var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},671(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,'/* ================================================================\n LAUNCH PROGRESS & RESULTS — append to wizard.css\n ================================================================ */\n\n/* Progress spinner during create/launch */\n.submit-progress {\n text-align: center;\n padding: 48px 24px;\n}\n.submit-progress h2 {\n margin: 16px 0 8px;\n font-size: 1.25rem;\n}\n.submit-progress p {\n color: #6b7280;\n margin-bottom: 32px;\n}\n\n.progress-spinner {\n width: 48px;\n height: 48px;\n border: 3px solid #e5e7eb;\n border-top-color: #3b82f6;\n border-radius: 50%;\n margin: 0 auto;\n animation: spin 0.8s linear infinite;\n}\n@keyframes spin {\n to { transform: rotate(360deg); }\n}\n\n/* Two-step progress indicator */\n.progress-steps {\n display: flex;\n justify-content: center;\n gap: 32px;\n margin-top: 24px;\n}\n.progress-step {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 0.875rem;\n color: #9ca3af;\n}\n.progress-step.step-active {\n color: #3b82f6;\n font-weight: 500;\n}\n.progress-step.step-done {\n color: #10b981;\n}\n.step-indicator {\n width: 24px;\n height: 24px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 0.75rem;\n font-weight: 600;\n background: #f3f4f6;\n}\n.step-active .step-indicator {\n background: #dbeafe;\n color: #3b82f6;\n}\n.step-done .step-indicator {\n background: #d1fae5;\n color: #10b981;\n}\n.mini-spinner {\n display: inline-block;\n width: 14px;\n height: 14px;\n border: 2px solid #93c5fd;\n border-top-color: #3b82f6;\n border-radius: 50%;\n animation: spin 0.6s linear infinite;\n}\n\n/* Per-channel launch results */\n.launch-results {\n text-align: left;\n margin: 24px auto;\n max-width: 480px;\n}\n.launch-results h3 {\n font-size: 0.875rem;\n text-transform: uppercase;\n letter-spacing: 0.05em;\n color: #6b7280;\n margin-bottom: 12px;\n}\n.launch-channel-result {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n border-radius: 8px;\n margin-bottom: 8px;\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n flex-wrap: wrap;\n}\n.launch-channel-result.launch-status-submitted {\n border-color: #d1fae5;\n background: #f0fdf4;\n}\n.launch-channel-result.launch-status-pending_review {\n border-color: #fef3c7;\n background: #fffbeb;\n}\n.launch-channel-result.launch-status-error {\n border-color: #fecaca;\n background: #fef2f2;\n}\n.launch-channel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.launch-channel-name {\n font-weight: 500;\n min-width: 100px;\n}\n.launch-status-badge {\n font-size: 0.8rem;\n font-weight: 500;\n padding: 2px 8px;\n border-radius: 4px;\n margin-left: auto;\n}\n.launch-status-badge.status-submitted {\n color: #059669;\n background: #d1fae5;\n}\n.launch-status-badge.status-pending_review {\n color: #d97706;\n background: #fef3c7;\n}\n.launch-status-badge.status-error {\n color: #dc2626;\n background: #fecaca;\n}\n.launch-channel-message {\n width: 100%;\n font-size: 0.8rem;\n color: #6b7280;\n padding-left: 20px;\n}\n.launch-external-id {\n font-size: 0.75rem;\n font-family: monospace;\n color: #9ca3af;\n padding-left: 20px;\n}\n\n/* Error state */\n.submit-error {\n text-align: center;\n padding: 48px 24px;\n}\n.submit-error h2 {\n margin: 16px 0 8px;\n color: #dc2626;\n}\n.submit-error p {\n color: #6b7280;\n margin-bottom: 24px;\n}\n.error-actions {\n display: flex;\n justify-content: center;\n gap: 12px;\n}\n\n/* Status badges in results */\n.status-badge.status-warning {\n background: #fef3c7;\n color: #d97706;\n}\n\n/* ================================================================\n CONFIRM LAUNCH MODAL\n ================================================================ */\n\n.confirm-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n padding: 24px;\n backdrop-filter: blur(2px);\n}\n.confirm-modal {\n background: #fff;\n border-radius: 12px;\n max-width: 520px;\n width: 100%;\n padding: 28px 32px;\n box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);\n animation: modalIn 0.2s ease-out;\n}\n@keyframes modalIn {\n from { opacity: 0; transform: translateY(12px) scale(0.98); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n}\n\n.confirm-header {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 12px;\n}\n.confirm-icon-wrap {\n width: 44px;\n height: 44px;\n border-radius: 50%;\n background: #fffbeb;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n}\n.confirm-header h2 {\n font-size: 1.15rem;\n margin: 0;\n}\n.confirm-subtitle {\n font-size: 0.9rem;\n color: #4b5563;\n margin: 0 0 20px;\n line-height: 1.5;\n}\n\n/* Billing summary table */\n.confirm-billing {\n border: 1px solid #e5e7eb;\n border-radius: 8px;\n overflow: hidden;\n margin-bottom: 16px;\n}\n.confirm-billing-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 10px 16px;\n font-size: 0.875rem;\n border-bottom: 1px solid #f3f4f6;\n}\n.confirm-billing-row:last-child {\n border-bottom: none;\n}\n.confirm-billing-sub {\n background: #f9fafb;\n padding-left: 28px;\n font-size: 0.825rem;\n color: #6b7280;\n}\n.confirm-billing-total {\n background: #f0f9ff;\n font-weight: 600;\n border-top: 2px solid #e5e7eb;\n}\n.confirm-amount {\n font-weight: 600;\n font-variant-numeric: tabular-nums;\n}\n.confirm-ch-dot {\n display: inline-block;\n width: 8px;\n height: 8px;\n border-radius: 50%;\n margin-right: 6px;\n vertical-align: middle;\n}\n\n/* Note / fine print */\n.confirm-note {\n font-size: 0.78rem;\n color: #9ca3af;\n line-height: 1.5;\n margin-bottom: 16px;\n}\n\n/* Terms checkbox */\n.confirm-terms {\n display: flex;\n align-items: flex-start;\n gap: 10px;\n padding: 14px 16px;\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n border-radius: 8px;\n margin-bottom: 20px;\n cursor: pointer;\n font-size: 0.84rem;\n line-height: 1.5;\n color: #374151;\n}\n.confirm-terms input[type="checkbox"] {\n margin-top: 3px;\n width: 16px;\n height: 16px;\n flex-shrink: 0;\n accent-color: #3b82f6;\n cursor: pointer;\n}\n\n/* Actions */\n.confirm-actions {\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n}\n.confirm-actions .btn-primary:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n/* Pricing source tag (visible when client has negotiated rate) */\n.confirm-pricing-source {\n color: #059669;\n font-weight: 500;\n}\n',""]);const s=i},767(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,"/* ═══════════════════════════════════════════════\n Campaign Wizard Styles\n Extends the core AdPlatform design system\n ═══════════════════════════════════════════════ */\n\n/* ── Wrapper ── */\n.wizard-wrapper {\n display: flex;\n flex-direction: column;\n flex: 1;\n min-height: 0; /* allow flex shrink */\n overflow: hidden; /* children scroll, not us */\n background: var(--color-bg);\n margin: -32px; /* cancel content-area padding to fill full space */\n}\n.wizard-loading,\n.wizard-error {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 16px;\n padding: 80px 24px;\n color: var(--color-text-muted);\n}\n\n/* ── Header ── */\n.wizard-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 32px;\n background: var(--color-bg-elevated);\n border-bottom: 1px solid var(--color-border);\n}\n.wizard-header-left {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.wizard-back-btn {\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: 1px solid var(--color-border);\n border-radius: var(--radius-md);\n color: var(--color-text-muted);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.wizard-back-btn:hover {\n background: var(--color-bg-subtle);\n color: var(--color-text);\n border-color: var(--color-text-muted);\n}\n.wizard-title {\n font-size: 18px;\n font-weight: 600;\n color: var(--color-text);\n letter-spacing: -0.2px;\n}\n.wizard-subtitle {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n.wizard-header-right {\n display: flex;\n align-items: center;\n gap: 14px;\n}\n.save-indicator {\n font-size: 12px;\n color: var(--color-text-muted);\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.save-indicator.saved {\n color: var(--color-success);\n}\n\n/* ── Step Rail ── */\n.wizard-rail {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0;\n padding: 14px 32px;\n background: var(--color-bg-elevated);\n border-bottom: 1px solid var(--color-border);\n position: relative;\n overflow: hidden;\n}\n.wizard-rail::before {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n height: 3px;\n background: var(--color-border-light);\n}\n.wizard-rail-progress {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3px;\n background: var(--color-primary);\n transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);\n border-radius: 0 2px 2px 0;\n}\n.wizard-rail-step {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 8px 20px;\n background: none;\n border: none;\n cursor: pointer;\n transition: all var(--transition-fast);\n position: relative;\n z-index: 1;\n}\n.wizard-rail-step:hover .rail-step-label {\n color: var(--color-text);\n}\n.rail-step-indicator {\n width: 26px;\n height: 26px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n font-size: 12px;\n font-weight: 600;\n background: var(--color-bg-subtle);\n color: var(--color-text-muted);\n border: 2px solid var(--color-border);\n transition: all var(--transition-fast);\n}\n.wizard-rail-step.active .rail-step-indicator {\n background: var(--color-primary);\n color: white;\n border-color: var(--color-primary);\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);\n}\n.wizard-rail-step.complete .rail-step-indicator {\n background: var(--color-primary);\n color: white;\n border-color: var(--color-primary);\n}\n.wizard-rail-step.past .rail-step-indicator {\n background: var(--color-primary-light);\n color: var(--color-primary);\n border-color: var(--color-primary);\n}\n.rail-step-label {\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-muted);\n transition: color var(--transition-fast);\n}\n.wizard-rail-step.active .rail-step-label {\n color: var(--color-primary);\n font-weight: 600;\n}\n.wizard-rail-step.complete .rail-step-label,\n.wizard-rail-step.past .rail-step-label {\n color: var(--color-text-secondary);\n}\n\n/* Connectors between steps */\n.wizard-rail-step:not(:last-child)::after {\n content: '';\n display: block;\n width: 40px;\n height: 2px;\n background: var(--color-border);\n margin-left: 12px;\n}\n.wizard-rail-step.complete:not(:last-child)::after,\n.wizard-rail-step.past:not(:last-child)::after {\n background: var(--color-primary);\n}\n\n/* ── Body ── */\n.wizard-body {\n flex: 1;\n min-height: 0;\n overflow-y: auto;\n padding: 24px 32px 32px;\n max-width: 820px;\n margin: 0 auto;\n width: 100%;\n}\n\n/* ── Footer ── */\n.wizard-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 12px 32px;\n background: var(--color-bg-elevated);\n border-top: 1px solid var(--color-border);\n}\n.wizard-footer-center {\n font-size: 13px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n\n/* ── Step Content (shared) ── */\n.wizard-step-content {\n animation: stepFadeIn 0.3s ease;\n}\n.wizard-step-content .form-group {\n margin-bottom: 16px;\n}\n@keyframes stepFadeIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.step-intro {\n margin-bottom: 20px;\n}\n.step-intro h2 {\n font-size: 22px;\n font-weight: 700;\n color: var(--color-text);\n letter-spacing: -0.3px;\n margin-bottom: 6px;\n}\n.step-intro p {\n font-size: 14px;\n color: var(--color-text-secondary);\n line-height: 1.5;\n}\n\n.field-hint {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-top: 6px;\n}\n.field-sub-label {\n font-size: 12px;\n font-weight: 500;\n color: var(--color-text-muted);\n margin-bottom: 4px;\n display: block;\n}\n.field-error {\n font-size: 13px;\n color: var(--color-danger);\n margin-top: 6px;\n}\n.text-muted {\n color: var(--color-text-muted);\n}\n\n/* ── Step 1: Business ── */\n.url-input-row {\n display: flex;\n gap: 12px;\n}\n.url-input-row .form-input {\n flex: 1;\n}\n.analysis-card {\n background: var(--color-success-light);\n border: 1px solid #a7f3d0;\n border-radius: var(--radius-lg);\n margin-bottom: 24px;\n overflow: hidden;\n}\n.analysis-card-header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-success);\n}\n.analysis-card-body {\n padding: 0 16px 16px;\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.analysis-detail {\n display: flex;\n gap: 12px;\n font-size: 13px;\n}\n.analysis-label {\n min-width: 90px;\n font-weight: 600;\n color: #065f46;\n flex-shrink: 0;\n}\n.analysis-value {\n color: #064e3b;\n line-height: 1.5;\n}\n.category-tag {\n display: inline-block;\n padding: 2px 10px;\n background: rgba(5, 150, 105, 0.15);\n color: var(--color-success);\n border-radius: 20px;\n font-size: 12px;\n font-weight: 600;\n}\n.objective-grid {\n display: grid;\n grid-template-columns: 1fr 1fr 1fr;\n gap: 10px;\n}\n.objective-card {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 2px;\n padding: 12px 14px;\n background: var(--color-bg-elevated);\n border: 2px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n transition: all var(--transition-fast);\n text-align: left;\n}\n.objective-card:hover {\n border-color: var(--color-primary);\n background: var(--color-primary-light);\n}\n.objective-card.selected {\n border-color: var(--color-primary);\n background: var(--color-primary-light);\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);\n}\n.objective-icon {\n font-size: 18px;\n margin-bottom: 2px;\n}\n.objective-label {\n font-size: 13px;\n font-weight: 600;\n color: var(--color-text);\n}\n.objective-desc {\n font-size: 11px;\n color: var(--color-text-muted);\n line-height: 1.3;\n}\n\n/* ── Step 2: Budget ── */\n\n/* Category select enhanced */\n.form-select-lg {\n padding: 12px 14px;\n font-size: 15px;\n min-height: 48px;\n}\n\n/* ── Channel Recommendation Badge ── */\n.channel-rec-badge {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 3px 8px;\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n border-radius: 10px;\n background: var(--color-success-light, #ecfdf5);\n color: var(--color-success, #059669);\n}\n.channel-rec-badge svg {\n width: 10px;\n height: 10px;\n}\n\n/* Channel strength hint */\n.channel-strength {\n display: flex;\n align-items: center;\n gap: 4px;\n margin-top: 6px;\n font-size: 11px;\n color: var(--color-text-muted);\n font-style: italic;\n}\n\n/* Channel context bar */\n.channel-context-bar {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 12px 16px;\n background: var(--color-primary-bg, #EEF2FF);\n border: 1px solid color-mix(in srgb, var(--color-primary) 15%, transparent);\n border-radius: 10px;\n margin-bottom: 20px;\n font-size: 13px;\n color: var(--color-primary);\n}\n.channel-context-bar svg {\n flex-shrink: 0;\n}\n\n.budget-input-wrap {\n display: flex;\n align-items: center;\n gap: 0;\n max-width: 280px;\n}\n.budget-prefix,\n.budget-suffix {\n padding: 10px 12px;\n background: var(--color-bg-subtle);\n border: 1px solid var(--color-border);\n font-size: 14px;\n font-weight: 500;\n color: var(--color-text-secondary);\n}\n.budget-prefix {\n border-radius: var(--radius-md) 0 0 var(--radius-md);\n border-right: none;\n}\n.budget-suffix {\n border-radius: 0 var(--radius-md) var(--radius-md) 0;\n border-left: none;\n white-space: nowrap;\n}\n.budget-input {\n border-radius: 0 !important;\n text-align: center;\n font-weight: 600;\n font-size: 18px;\n}\n.budget-presets {\n display: flex;\n gap: 8px;\n margin-top: 12px;\n}\n.preset-chip {\n padding: 6px 16px;\n border: 1px solid var(--color-border);\n border-radius: 20px;\n background: var(--color-bg-elevated);\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.preset-chip:hover {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n.preset-chip.active {\n background: var(--color-primary);\n border-color: var(--color-primary);\n color: white;\n}\n.estimate-banner {\n padding: 16px 20px;\n background: var(--color-primary-light);\n border: 1px solid #bfdbfe;\n border-radius: var(--radius-lg);\n margin-bottom: 24px;\n}\n.estimate-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 14px;\n color: var(--color-primary-dark);\n}\n.estimate-row strong {\n font-size: 18px;\n}\n.estimate-note {\n font-size: 12px;\n color: #3b82f6;\n margin-top: 8px;\n line-height: 1.5;\n}\n.bidding-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 10px;\n}\n.bidding-card {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 14px 16px;\n background: var(--color-bg-elevated);\n border: 2px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n transition: all var(--transition-fast);\n text-align: left;\n}\n.bidding-card:hover {\n border-color: var(--color-primary);\n}\n.bidding-card.selected {\n border-color: var(--color-primary);\n background: var(--color-primary-light);\n}\n.bidding-card-top {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.bidding-label {\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text);\n}\n.recommended-tag {\n font-size: 10px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n padding: 2px 8px;\n background: var(--color-success-light);\n color: var(--color-success);\n border-radius: 10px;\n}\n.bidding-desc {\n font-size: 12px;\n color: var(--color-text-muted);\n line-height: 1.4;\n}\n.toggle-label {\n display: flex;\n align-items: center;\n gap: 6px;\n cursor: pointer;\n font-size: 12px;\n}\n.toggle-text {\n color: var(--color-text-muted);\n}\n\n/* ── Step 3: Creative ── */\n.generate-bar {\n margin-bottom: 28px;\n padding: 20px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n transition: all 0.2s ease;\n}\n.generate-bar.empty {\n background: linear-gradient(135deg, #eef2ff 0%, #f0fdf4 100%);\n border-color: #c7d2fe;\n}\n.generate-bar-content {\n display: flex;\n align-items: center;\n gap: 16px;\n}\n.generate-bar-icon {\n width: 44px;\n height: 44px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-primary-light, #eef2ff);\n border-radius: 10px;\n color: var(--color-primary);\n flex-shrink: 0;\n}\n.generate-bar.empty .generate-bar-icon {\n background: white;\n}\n.generate-bar-text {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n.generate-bar-text strong {\n font-size: 14px;\n color: var(--color-text);\n}\n.generate-bar-text span {\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.creative-section {\n margin-bottom: 28px;\n}\n.creative-section-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 8px;\n}\n.creative-section-header h3 {\n font-size: 16px;\n font-weight: 600;\n color: var(--color-text);\n}\n.creative-section-hint {\n font-size: 13px;\n color: var(--color-text-muted);\n margin-bottom: 12px;\n}\n.asset-count {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n\n/* Asset Editor */\n.asset-editor {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.asset-row {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 14px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-md);\n transition: border-color var(--transition-fast);\n}\n.asset-row:hover {\n border-color: var(--color-text-muted);\n}\n.asset-row.editing {\n border-color: var(--color-primary);\n box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);\n}\n.asset-text {\n flex: 1;\n font-size: 14px;\n color: var(--color-text);\n}\n.char-counter {\n font-size: 11px;\n font-family: var(--font-mono);\n color: var(--color-text-muted);\n flex-shrink: 0;\n}\n.char-counter.over {\n color: var(--color-danger);\n font-weight: 600;\n}\n.asset-action {\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n color: var(--color-text-muted);\n cursor: pointer;\n border-radius: var(--radius-sm);\n flex-shrink: 0;\n}\n.asset-action:hover {\n background: var(--color-bg-subtle);\n color: var(--color-text);\n}\n.asset-action.danger:hover {\n background: var(--color-danger-light);\n color: var(--color-danger);\n}\n.asset-edit-row {\n display: flex;\n align-items: center;\n gap: 8px;\n width: 100%;\n}\n.asset-edit-row .form-input {\n flex: 1;\n margin: 0;\n}\n.add-asset-btn {\n align-self: flex-start;\n margin-top: 4px;\n}\n\n/* Images */\n.image-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));\n gap: 12px;\n}\n.image-thumb {\n position: relative;\n border-radius: var(--radius-md);\n overflow: hidden;\n border: 1px solid var(--color-border);\n aspect-ratio: 4/3;\n background: var(--color-bg-subtle);\n}\n.image-thumb img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.image-thumb-meta {\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n padding: 6px 8px;\n background: linear-gradient(transparent, rgba(0,0,0,0.6));\n display: flex;\n gap: 6px;\n}\n.orientation-tag,\n.dim-tag {\n font-size: 10px;\n font-weight: 600;\n color: white;\n background: rgba(0,0,0,0.4);\n padding: 1px 6px;\n border-radius: 4px;\n}\n.image-remove {\n position: absolute;\n top: 6px;\n right: 6px;\n width: 24px;\n height: 24px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: rgba(0,0,0,0.6);\n border: none;\n border-radius: 50%;\n color: white;\n cursor: pointer;\n opacity: 0;\n transition: opacity var(--transition-fast);\n}\n.image-thumb:hover .image-remove {\n opacity: 1;\n}\n.empty-images {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n padding: 32px;\n background: var(--color-bg-subtle);\n border: 2px dashed var(--color-border);\n border-radius: var(--radius-lg);\n color: var(--color-text-muted);\n font-size: 13px;\n}\n\n/* Ad Preview */\n.ad-preview-card {\n max-width: 400px;\n padding: 16px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n box-shadow: var(--shadow-sm);\n}\n.ad-preview-label {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-bottom: 4px;\n}\n.ad-preview-headline {\n font-size: 18px;\n font-weight: 600;\n color: #1a0dab;\n margin-bottom: 4px;\n cursor: pointer;\n}\n.ad-preview-desc {\n font-size: 13px;\n color: var(--color-text-secondary);\n line-height: 1.5;\n}\n\n/* ── Step 4: Audience ── */\n.audience-section {\n margin-bottom: 24px;\n padding-bottom: 20px;\n border-bottom: 1px solid var(--color-border-light);\n}\n.audience-section:last-child {\n border-bottom: none;\n}\n.audience-section h3 {\n font-size: 16px;\n font-weight: 600;\n color: var(--color-text);\n margin-bottom: 12px;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.optional-tag {\n font-size: 10px;\n font-weight: 500;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--color-text-muted);\n background: var(--color-bg-subtle);\n padding: 2px 8px;\n border-radius: 10px;\n}\n\n/* Geo Search */\n.geo-search-wrap {\n position: relative;\n margin-bottom: 12px;\n}\n.geo-search-spinner {\n position: absolute;\n right: 12px;\n top: 50%;\n transform: translateY(-50%);\n}\n.geo-dropdown {\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n margin-top: 4px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n box-shadow: var(--shadow-lg);\n max-height: 240px;\n overflow-y: auto;\n z-index: 50;\n}\n.geo-result {\n display: flex;\n align-items: center;\n gap: 10px;\n width: 100%;\n padding: 10px 14px;\n background: none;\n border: none;\n cursor: pointer;\n text-align: left;\n transition: background var(--transition-fast);\n}\n.geo-result:hover {\n background: var(--color-bg-subtle);\n}\n.geo-result:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.geo-result-name {\n font-size: 14px;\n font-weight: 500;\n color: var(--color-text);\n}\n.geo-result-type {\n font-size: 11px;\n font-weight: 600;\n padding: 1px 8px;\n background: var(--color-primary-light);\n color: var(--color-primary);\n border-radius: 10px;\n}\n.geo-result-canonical {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-left: auto;\n}\n.location-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.location-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 6px 12px;\n background: var(--color-primary-light);\n color: var(--color-primary);\n border-radius: 20px;\n font-size: 13px;\n font-weight: 500;\n}\n.chip-remove {\n background: none;\n border: none;\n color: var(--color-primary);\n cursor: pointer;\n font-size: 16px;\n line-height: 1;\n padding: 0 0 0 2px;\n opacity: 0.6;\n}\n.chip-remove:hover {\n opacity: 1;\n}\n\n/* Demo Chips */\n.demo-group {\n margin-bottom: 16px;\n}\n.demo-group label {\n display: block;\n font-size: 13px;\n font-weight: 600;\n color: var(--color-text-secondary);\n margin-bottom: 8px;\n}\n.chip-row {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.chip {\n padding: 6px 16px;\n border: 1px solid var(--color-border);\n border-radius: 20px;\n background: var(--color-bg-elevated);\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.chip:hover {\n border-color: var(--color-primary);\n color: var(--color-primary);\n}\n.chip.active {\n background: var(--color-primary);\n border-color: var(--color-primary);\n color: white;\n}\n\n/* Segment Blocks */\n.segment-block {\n margin-top: 16px;\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n overflow: hidden;\n}\n.segment-block-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n padding: 12px 16px;\n background: var(--color-bg-subtle);\n border: none;\n cursor: pointer;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text);\n}\n.segment-block-header:hover {\n background: var(--color-bg-muted);\n}\n.expand-icon {\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.segment-block-desc {\n padding: 0 16px 8px;\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.segment-list {\n max-height: 300px;\n overflow-y: auto;\n padding: 0 16px 12px;\n}\n.segment-item-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 6px 0;\n font-size: 13px;\n color: var(--color-text-secondary);\n cursor: pointer;\n}\n.segment-item-row:hover {\n color: var(--color-text);\n}\n.segment-item-row input[type=\"checkbox\"] {\n accent-color: var(--color-primary);\n}\n.selected-count {\n padding: 8px 16px;\n font-size: 12px;\n font-weight: 600;\n color: var(--color-primary);\n background: var(--color-primary-light);\n border-top: 1px solid var(--color-border-light);\n}\n\n/* ── Step 5: Review ── */\n.review-grid {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 14px;\n margin-bottom: 16px;\n}\n.review-grid-col {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n@media (max-width: 768px) {\n .review-grid {\n grid-template-columns: 1fr;\n }\n}\n.review-section {\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n overflow: hidden;\n transition: border-color 0.15s ease;\n}\n.review-section.has-issues {\n border-color: var(--color-border);\n border-width: 1px;\n}\n.review-section-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 10px 16px;\n background: var(--color-bg-subtle);\n border-bottom: 1px solid var(--color-border-light);\n}\n.review-section.has-issues .review-section-header {\n background: var(--color-bg-subtle);\n border-bottom-color: var(--color-border-light);\n}\n.review-section-title {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.review-section-title h3 {\n font-size: 13px;\n font-weight: 600;\n}\n.review-icon {\n font-size: 15px;\n}\n.review-section-actions {\n display: flex;\n align-items: center;\n gap: 6px;\n}\n.btn-fix {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n padding: 4px 10px;\n font-size: 11px;\n font-weight: 600;\n color: white;\n background: var(--color-danger, #DC2626);\n border: none;\n border-radius: 6px;\n cursor: pointer;\n transition: background 0.15s ease;\n}\n.btn-fix:hover {\n background: #b91c1c;\n}\n.btn-fix svg {\n stroke: white;\n}\n.review-section-issues {\n display: flex;\n flex-wrap: wrap;\n gap: 4px;\n padding: 6px 16px 0;\n}\n.review-issue-tag {\n font-size: 11px;\n color: var(--color-danger, #DC2626);\n font-weight: 500;\n}\n.review-section-body {\n padding: 12px 16px;\n}\n.review-row {\n display: flex;\n align-items: flex-start;\n justify-content: space-between;\n padding: 5px 0;\n border-bottom: 1px solid var(--color-border-light);\n}\n.review-row:last-child {\n border-bottom: none;\n}\n.review-label {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n min-width: 60px;\n flex-shrink: 0;\n}\n.review-value {\n font-size: 13px;\n color: var(--color-text);\n text-align: right;\n}\n\n/* Compact creative summary on review */\n.review-creative-summary {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n color: var(--color-text-secondary);\n flex-wrap: wrap;\n}\n.review-dot-sep {\n color: var(--color-text-muted);\n}\n.review-sub-section {\n margin-bottom: 16px;\n}\n.review-sub-section:last-child {\n margin-bottom: 0;\n}\n.review-sub-label {\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n color: var(--color-text-muted);\n display: block;\n margin-bottom: 8px;\n}\n.review-asset-item {\n font-size: 13px;\n color: var(--color-text);\n padding: 6px 12px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-sm);\n margin-bottom: 4px;\n}\n.review-more {\n font-size: 12px;\n color: var(--color-text-muted);\n padding: 4px 0;\n}\n.review-image-row {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.review-thumb {\n width: 56px;\n height: 42px;\n object-fit: cover;\n border-radius: var(--radius-sm);\n border: 1px solid var(--color-border);\n}\n.review-more-images {\n font-size: 12px;\n color: var(--color-text-muted);\n font-weight: 500;\n}\n\n/* Validation */\n.issues-box {\n background: var(--color-warning-bg, #FEF3C7);\n border: 1px solid var(--color-warning-border, #FCD34D);\n border-radius: var(--radius-lg);\n margin-bottom: 20px;\n overflow: hidden;\n}\n.issue-row {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 10px 16px;\n font-size: 13px;\n color: var(--color-warning-text, #92400E);\n cursor: pointer;\n transition: background 0.15s ease;\n border-bottom: 1px solid rgba(252, 211, 77, 0.3);\n}\n.issue-row:last-child {\n border-bottom: none;\n}\n.issue-row:hover {\n background: rgba(252, 211, 77, 0.15);\n}\n.issue-fix {\n margin-left: auto;\n font-weight: 600;\n font-size: 12px;\n color: var(--color-primary);\n}\n\n/* Phase loading spinner */\n.phase-loading {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 60px 24px;\n text-align: center;\n}\n.loading-spinner {\n width: 40px;\n height: 40px;\n border: 3px solid var(--color-border);\n border-top-color: var(--color-primary);\n border-radius: 50%;\n animation: spin 0.8s linear infinite;\n margin-bottom: 16px;\n}\n\n/* Error box */\n.error-box {\n padding: 12px 16px;\n background: var(--color-danger-light, #FEF2F2);\n border: 1px solid #fecaca;\n border-radius: 8px;\n font-size: 13px;\n color: var(--color-danger, #DC2626);\n margin-bottom: 16px;\n}\n\n.validation-box {\n padding: 16px 20px;\n background: var(--color-warning-light);\n border: 1px solid #fcd34d;\n border-radius: var(--radius-lg);\n margin-bottom: 20px;\n font-size: 14px;\n}\n.validation-box strong {\n display: block;\n color: var(--color-warning);\n margin-bottom: 8px;\n}\n.validation-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 6px 0;\n font-size: 13px;\n color: #92400e;\n}\n\n/* Submit */\n.submit-bar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 20px 24px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n margin-top: 24px;\n}\n.submit-bar-info {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n.submit-bar-info strong {\n font-size: 15px;\n color: var(--color-text);\n}\n.submit-bar-info span {\n font-size: 13px;\n color: var(--color-text-muted);\n}\n\n/* Success State */\n.submit-success {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n padding: 48px 24px;\n}\n.success-icon {\n width: 72px;\n height: 72px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-success-light);\n color: var(--color-success);\n border-radius: 50%;\n margin-bottom: 20px;\n}\n.submit-success h2 {\n font-size: 24px;\n font-weight: 700;\n margin-bottom: 12px;\n}\n.submit-success p {\n font-size: 15px;\n color: var(--color-text-secondary);\n max-width: 480px;\n line-height: 1.6;\n margin-bottom: 28px;\n}\n.submit-details {\n width: 100%;\n max-width: 400px;\n background: var(--color-bg-subtle);\n border-radius: var(--radius-lg);\n padding: 16px 20px;\n}\n\n/* ── Draft Campaigns List (in Campaigns view) ── */\n.drafts-section {\n margin-bottom: 28px;\n}\n.drafts-section h3 {\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text-muted);\n text-transform: uppercase;\n letter-spacing: 0.3px;\n margin-bottom: 12px;\n}\n.draft-cards {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));\n gap: 12px;\n}\n.draft-card {\n display: flex;\n align-items: center;\n gap: 14px;\n padding: 14px 16px;\n background: var(--color-bg-elevated);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-lg);\n cursor: pointer;\n transition: all var(--transition-fast);\n}\n.draft-card:hover {\n border-color: var(--color-primary);\n box-shadow: var(--shadow-sm);\n}\n.draft-icon {\n width: 36px;\n height: 36px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: var(--color-warning-light);\n border-radius: var(--radius-md);\n flex-shrink: 0;\n}\n.draft-info {\n flex: 1;\n min-width: 0;\n}\n.draft-name {\n font-size: 14px;\n font-weight: 500;\n color: var(--color-text);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.draft-meta {\n font-size: 12px;\n color: var(--color-text-muted);\n}\n.draft-actions {\n display: flex;\n gap: 4px;\n}\n.draft-actions button {\n width: 28px;\n height: 28px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: none;\n border: none;\n color: var(--color-text-muted);\n cursor: pointer;\n border-radius: var(--radius-sm);\n}\n.draft-actions button:hover {\n background: var(--color-bg-subtle);\n color: var(--color-text);\n}\n.draft-actions button.danger:hover {\n background: var(--color-danger-light);\n color: var(--color-danger);\n}\n\n/* ── Responsive ── */\n@media (max-width: 768px) {\n .wizard-rail {\n padding: 16px;\n overflow-x: auto;\n justify-content: flex-start;\n }\n .rail-step-label {\n display: none;\n }\n .wizard-rail-step:not(:last-child)::after {\n width: 20px;\n }\n .wizard-body {\n padding: 20px;\n }\n .objective-grid,\n .bidding-grid {\n grid-template-columns: 1fr 1fr;\n }\n .wizard-footer {\n padding: 12px 20px;\n }\n .url-input-row {\n flex-direction: column;\n }\n .submit-bar {\n flex-direction: column;\n gap: 16px;\n text-align: center;\n }\n}\n\n/* ═══════════════════════════════════════════════\n Phase 2 Channel, Allocation & Objective Styles\n ═══════════════════════════════════════════════ */\n\n/* ── Category Grid (ObjectiveStep) ── */\n.category-grid {\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 10px;\n}\n.category-card {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 6px;\n padding: 14px 10px;\n border: 2px solid var(--color-border);\n border-radius: 10px;\n background: var(--color-surface);\n cursor: pointer;\n transition: all 0.15s ease;\n font-size: 13px;\n color: var(--color-text-secondary);\n}\n.category-card:hover { border-color: var(--color-text-tertiary); }\n.category-card.selected {\n border-color: var(--color-primary);\n background: var(--color-primary-bg);\n color: var(--color-primary);\n}\n.category-icon { font-size: 22px; }\n.category-label { font-weight: 500; text-align: center; }\n\n/* ── Channel Grid (ChannelStep) ── */\n.channel-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));\n gap: 16px;\n margin-bottom: 20px;\n}\n.channel-card {\n display: flex;\n flex-direction: column;\n padding: 20px;\n border: 2px solid var(--color-border);\n border-radius: 12px;\n background: var(--color-surface);\n cursor: pointer;\n transition: all 0.2s ease;\n text-align: left;\n position: relative;\n}\n.channel-card:hover:not(:disabled) {\n border-color: var(--channel-color, var(--color-primary));\n box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);\n}\n.channel-card.selected {\n border-color: var(--channel-color, var(--color-primary));\n background: var(--color-surface);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--channel-color, var(--color-primary)) 15%, transparent);\n}\n.channel-card.unsupported {\n opacity: 0.45;\n cursor: not-allowed;\n}\n.channel-card-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 12px;\n}\n.channel-icon svg { display: block; }\n.channel-icon-fallback {\n width: 28px;\n height: 28px;\n border-radius: 8px;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-weight: 700;\n font-size: 14px;\n}\n.channel-card-check svg {\n color: var(--channel-color, var(--color-primary));\n}\n.check-empty {\n width: 20px;\n height: 20px;\n border: 2px solid var(--color-border);\n border-radius: 6px;\n}\n.channel-card.selected .check-empty { display: none; }\n.channel-card-body { flex: 1; margin-bottom: 12px; }\n.channel-name {\n font-weight: 600;\n font-size: 15px;\n color: var(--color-text);\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 4px;\n}\n.stub-badge {\n font-size: 10px;\n font-weight: 600;\n padding: 2px 6px;\n border-radius: 4px;\n background: var(--color-warning-bg, #FEF3C7);\n color: var(--color-warning-text, #92400E);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n.channel-desc {\n font-size: 13px;\n color: var(--color-text-secondary);\n line-height: 1.4;\n}\n.channel-card-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-top: 12px;\n border-top: 1px solid var(--color-border);\n}\n.channel-min-budget {\n font-size: 12px;\n color: var(--color-text-tertiary);\n font-weight: 500;\n}\n.channel-unsupported-label {\n font-size: 11px;\n color: var(--color-danger, #DC2626);\n}\n\n/* ── Channel Summary ── */\n.channel-summary {\n padding: 16px;\n background: var(--color-surface);\n border: 1px solid var(--color-border);\n border-radius: 10px;\n margin-bottom: 16px;\n}\n.channel-summary-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 8px;\n}\n.channel-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 4px 12px;\n border: 2px solid;\n border-radius: 20px;\n font-size: 13px;\n font-weight: 500;\n background: var(--color-surface);\n}\n.chip-remove {\n background: none;\n border: none;\n cursor: pointer;\n font-size: 16px;\n line-height: 1;\n padding: 0;\n color: var(--color-text-tertiary);\n}\n.chip-remove:hover { color: var(--color-danger, #DC2626); }\n.channel-summary-info {\n font-size: 13px;\n color: var(--color-text-secondary);\n}\n.channel-summary-note {\n color: var(--color-text-tertiary);\n}\n.channel-empty-hint {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 16px;\n color: var(--color-text-tertiary);\n font-size: 14px;\n}\n\n/* ── Budget Channel Requirements Bar ── */\n.budget-channels-bar {\n padding: 14px 18px;\n background: var(--color-surface, #f8fafc);\n border: 1px solid var(--color-border);\n border-radius: 10px;\n margin-bottom: 24px;\n}\n.budget-channels-label {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.3px;\n color: var(--color-text-muted);\n margin-bottom: 10px;\n}\n.budget-channels-list {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n margin-bottom: 4px;\n}\n.budget-channel-tag {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 5px 12px;\n border: 1.5px solid;\n border-radius: 20px;\n font-size: 13px;\n font-weight: 500;\n background: white;\n color: var(--color-text);\n}\n.budget-ch-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.budget-ch-min {\n font-size: 11px;\n color: var(--color-text-muted);\n padding-left: 4px;\n border-left: 1px solid var(--color-border);\n margin-left: 4px;\n}\n.budget-channels-note {\n font-size: 12px;\n color: var(--color-text-muted);\n margin-top: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--color-border-light, #e2e8f0);\n}\n\n/* ── Budget Period Toggle ── */\n.period-toggle {\n display: inline-flex;\n border: 1px solid var(--color-border);\n border-radius: 8px;\n overflow: hidden;\n}\n.toggle-btn {\n padding: 8px 20px;\n border: none;\n background: var(--color-surface);\n font-size: 13px;\n font-weight: 500;\n color: var(--color-text-secondary);\n cursor: pointer;\n transition: all 0.15s ease;\n}\n.toggle-btn:not(:last-child) {\n border-right: 1px solid var(--color-border);\n}\n.toggle-btn.active {\n background: var(--color-primary);\n color: #fff;\n}\n.toggle-btn:hover:not(.active) {\n background: var(--color-bg);\n}\n\n/* ── Allocation Sliders ── */\n.allocation-sliders {\n display: flex;\n flex-direction: column;\n gap: 16px;\n margin-bottom: 12px;\n}\n.allocation-row {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.allocation-label {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 14px;\n font-weight: 500;\n}\n.alloc-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.alloc-name { color: var(--color-text); }\n.allocation-controls {\n display: flex;\n align-items: center;\n gap: 12px;\n}\n.alloc-slider {\n flex: 1;\n height: 6px;\n -webkit-appearance: none;\n appearance: none;\n border-radius: 3px;\n background: var(--color-border);\n outline: none;\n}\n.alloc-slider::-webkit-slider-thumb {\n -webkit-appearance: none;\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--slider-color, var(--color-primary));\n cursor: pointer;\n border: 2px solid #fff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);\n}\n.alloc-slider::-moz-range-thumb {\n width: 18px;\n height: 18px;\n border-radius: 50%;\n background: var(--slider-color, var(--color-primary));\n cursor: pointer;\n border: 2px solid #fff;\n box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);\n}\n.alloc-values {\n display: flex;\n align-items: center;\n gap: 4px;\n flex-shrink: 0;\n min-width: 160px;\n}\n.alloc-pct-input {\n width: 48px;\n padding: 4px 6px;\n border: 1px solid var(--color-border);\n border-radius: 6px;\n font-size: 13px;\n text-align: center;\n background: var(--color-surface);\n color: var(--color-text);\n}\n.alloc-pct-sign {\n font-size: 13px;\n color: var(--color-text-secondary);\n margin-right: 8px;\n}\n.alloc-amount {\n font-size: 12px;\n color: var(--color-text-tertiary);\n font-weight: 500;\n}\n\n/* ── Allocation Balance Indicator ── */\n.allocation-balance {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n padding: 8px 12px;\n border-radius: 8px;\n margin-bottom: 12px;\n}\n.allocation-balance.balanced {\n background: var(--color-success-bg, #F0FDF4);\n color: var(--color-success-text, #166534);\n}\n.allocation-balance.unbalanced {\n background: var(--color-warning-bg, #FEF3C7);\n color: var(--color-warning-text, #92400E);\n}\n\n/* ── Allocation Bar (visual) ── */\n.allocation-bar {\n display: flex;\n height: 8px;\n border-radius: 4px;\n overflow: hidden;\n background: var(--color-border);\n}\n.alloc-bar-segment {\n transition: width 0.3s ease;\n min-width: 2px;\n}\n.alloc-bar-segment:first-child { border-radius: 4px 0 0 4px; }\n.alloc-bar-segment:last-child { border-radius: 0 4px 4px 0; }\n\n/* ── Recommendation Box ── */\n.recommendation-box {\n padding: 16px;\n background: var(--color-primary-bg, #EEF2FF);\n border: 1px solid color-mix(in srgb, var(--color-primary) 20%, transparent);\n border-radius: 10px;\n margin-bottom: 16px;\n}\n.recommendation-header {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n color: var(--color-primary);\n margin-bottom: 12px;\n}\n.recommendation-channels {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin-bottom: 12px;\n}\n.rec-channel {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 14px;\n}\n.rec-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n}\n.rec-channel strong { margin-left: auto; }\n\n/* ── Warning Box ── */\n.warning-box {\n padding: 12px 16px;\n background: var(--color-warning-bg, #FEF3C7);\n border: 1px solid var(--color-warning-border, #FCD34D);\n border-radius: 8px;\n font-size: 13px;\n color: var(--color-warning-text, #92400E);\n}\n\n/* ── Review: Channel rows ── */\n.review-channels-list {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.review-channel-row {\n display: flex;\n align-items: center;\n gap: 10px;\n font-size: 14px;\n}\n.review-channel-dot {\n width: 10px;\n height: 10px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n.review-channel-name {\n font-weight: 500;\n flex: 1;\n}\n.review-channel-pct {\n font-size: 13px;\n color: var(--color-text-secondary);\n font-weight: 600;\n min-width: 40px;\n text-align: right;\n}\n.review-channel-amt {\n font-size: 13px;\n color: var(--color-text-tertiary);\n min-width: 80px;\n text-align: right;\n}\n.review-empty-note {\n font-size: 12px;\n color: var(--color-text-tertiary);\n font-style: italic;\n padding: 4px 0;\n}\n\n/* Review channel chips */\n.review-channels {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.review-channel-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 4px 10px;\n border: 1.5px solid;\n border-radius: 8px;\n font-size: 12px;\n font-weight: 500;\n background: var(--color-surface, #f8fafc);\n}\n.review-ch-dot {\n width: 7px;\n height: 7px;\n border-radius: 50%;\n flex-shrink: 0;\n}\n\n/* ── Responsive ── */\n@media (max-width: 640px) {\n .category-grid {\n grid-template-columns: repeat(2, 1fr);\n }\n .channel-grid {\n grid-template-columns: 1fr;\n }\n .objective-grid {\n grid-template-columns: 1fr 1fr;\n }\n .alloc-values {\n min-width: auto;\n flex-wrap: wrap;\n }\n .allocation-controls {\n flex-direction: column;\n align-items: stretch;\n }\n}\n\n/* ── Audience Profile Summary ── */\n.audience-profile-summary {\n background: var(--color-surface, #f8fafc);\n border: 1px dashed var(--color-border, #e2e8f0);\n border-radius: 10px;\n padding: 14px 16px;\n margin-top: 20px;\n}\n.audience-profile-header {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-bottom: 10px;\n flex-wrap: wrap;\n color: var(--color-text-muted);\n}\n.audience-profile-title {\n font-size: 12px;\n font-weight: 600;\n text-transform: uppercase;\n letter-spacing: 0.4px;\n color: var(--color-text-muted);\n}\n.audience-profile-hint {\n font-size: 11px;\n color: var(--color-text-tertiary, #94a3b8);\n margin-left: 4px;\n}\n.audience-profile-summary h3 {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 15px;\n font-weight: 600;\n margin: 0 0 4px 0;\n}\n.audience-profile-summary .field-hint {\n margin-bottom: 12px;\n}\n.profile-factors {\n display: flex;\n gap: 10px;\n flex-wrap: wrap;\n}\n.profile-factor {\n display: flex;\n flex-direction: column;\n gap: 2px;\n padding: 8px 14px;\n background: white;\n border: 1px solid var(--color-border, #e2e8f0);\n border-radius: 8px;\n min-width: 120px;\n}\n.factor-label {\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: var(--color-text-secondary, #64748b);\n font-weight: 600;\n}\n.factor-value {\n font-size: 13px;\n font-weight: 600;\n color: var(--color-text-primary, #1e293b);\n}\n.factor-value.neutral {\n color: var(--color-text-secondary, #64748b);\n}\n.factor-value.has-value {\n color: var(--color-accent, #4F46E5);\n}\n\n/* ── Review: Audience Factors ── */\n.review-factors {\n display: flex;\n gap: 8px;\n flex-wrap: wrap;\n margin-top: 6px;\n}\n.review-factor-chip {\n display: inline-flex;\n align-items: center;\n padding: 4px 12px;\n border-radius: 20px;\n font-size: 12px;\n font-weight: 600;\n background: var(--color-surface, #f1f5f9);\n color: var(--color-accent, #4F46E5);\n border: 1px solid var(--color-border, #e2e8f0);\n}\n\n/* ── Market Insight Bar (Census) ── */\n.geo-input-row {\n display: flex;\n gap: 8px;\n align-items: center;\n}\n.geo-input-row .form-input {\n flex: 1;\n}\n.zip-lookup-btn {\n white-space: nowrap;\n padding: 8px 16px;\n font-size: 13px;\n height: 38px;\n}\n.market-insight-bar {\n background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);\n border: 1px solid #bae6fd;\n border-radius: 10px;\n padding: 16px;\n margin: 8px 0 16px;\n}\n.market-insight-bar.loading {\n display: flex;\n align-items: center;\n gap: 10px;\n color: #64748b;\n font-size: 13px;\n padding: 14px 16px;\n}\n.insight-header {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 10px;\n color: #0369a1;\n}\n.insight-title {\n font-weight: 600;\n font-size: 13px;\n}\n.insight-source {\n font-size: 11px;\n color: #7dd3fc;\n margin-left: auto;\n font-weight: 500;\n}\n.insight-chips {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n margin-bottom: 12px;\n}\n.insight-chip {\n display: inline-block;\n padding: 4px 10px;\n border-radius: 16px;\n font-size: 12px;\n font-weight: 500;\n background: rgba(255,255,255,0.7);\n color: #0c4a6e;\n border: 1px solid #bae6fd;\n}\n.insight-details {\n border-top: 1px solid #bae6fd;\n padding-top: 12px;\n}\n.insight-grid {\n display: grid;\n grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));\n gap: 12px;\n}\n.insight-metric {\n display: flex;\n flex-direction: column;\n align-items: center;\n text-align: center;\n}\n.metric-value {\n font-size: 18px;\n font-weight: 700;\n color: #0369a1;\n line-height: 1.2;\n}\n.metric-label {\n font-size: 11px;\n color: #64748b;\n margin-top: 2px;\n}\n\n/* ── Census Badge ── */\n.census-badge {\n display: inline-block;\n font-size: 11px;\n font-weight: 500;\n color: #0369a1;\n background: #e0f2fe;\n padding: 2px 8px;\n border-radius: 10px;\n margin-left: 8px;\n vertical-align: middle;\n}\n.census-badge.small {\n font-size: 10px;\n padding: 1px 6px;\n}\n\n/* ── Census-Suggested Chip (not selected, but recommended) ── */\n.chip.census-suggested {\n border-color: #7dd3fc;\n background: rgba(224, 242, 254, 0.4);\n box-shadow: 0 0 0 1px #bae6fd inset;\n}\n",""]);const s=i},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var a=n.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},848(e,t,n){e.exports=n(20)},877(e,t,n){n.d(t,{A:()=>s});var r=n(601),o=n.n(r),a=n(314),i=n.n(a)()(o());i.push([e.id,"@import url(https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap);"]),i.push([e.id,":root {\n --color-primary: #2563eb;\n --color-primary-dark: #1e40af;\n --color-primary-light: #eff6ff;\n --color-primary-hover: #1d4ed8;\n --color-success: #059669;\n --color-success-light: #ecfdf5;\n --color-warning: #d97706;\n --color-warning-light: #fffbeb;\n --color-danger: #dc2626;\n --color-danger-light: #fef2f2;\n --color-text: #111827;\n --color-text-secondary: #374151;\n --color-text-muted: #9ca3af;\n --color-bg: #f8f9fb;\n --color-bg-elevated: #ffffff;\n --color-bg-subtle: #f3f4f6;\n --color-bg-muted: #e5e7eb;\n --color-border: #e5e7eb;\n --color-border-light: #f3f4f6;\n --sidebar-width: 260px;\n --sidebar-collapsed: 72px;\n --topbar-height: 56px;\n --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;\n --font-mono: 'JetBrains Mono', 'Fira Code', monospace;\n --radius-sm: 6px;\n --radius-md: 8px;\n --radius-lg: 12px;\n --radius-xl: 16px;\n --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);\n --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);\n --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);\n --transition-fast: 0.15s ease;\n --transition-normal: 0.25s ease;\n}\n*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}\nbody{font-family:var(--font-sans);background:var(--color-bg);color:var(--color-text);-webkit-font-smoothing:antialiased;line-height:1.5}\n.mono{font-family:var(--font-mono);font-size:13px}\n\n/* Landing */\n.landing-page{min-height:100vh;display:flex;flex-direction:column;background:linear-gradient(135deg,#f8f9fb 0%,#eff6ff 100%)}\n.landing-header{padding:20px 40px;display:flex;align-items:center;justify-content:space-between}\n.landing-logo{display:flex;align-items:center;gap:12px}\n.landing-logo-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--color-primary),var(--color-primary-dark));border-radius:var(--radius-md);color:white}\n.landing-logo-icon svg{width:22px;height:22px}\n.landing-logo-text{font-size:20px;font-weight:700;color:var(--color-text)}\n.landing-hero{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:60px 40px}\n.landing-hero h1{font-size:42px;font-weight:700;color:var(--color-text);margin-bottom:8px;letter-spacing:-0.5px}\n.landing-hero .landing-subtitle{font-size:24px;font-weight:400;color:var(--color-text-secondary);margin-bottom:16px;letter-spacing:-0.3px}\n.landing-hero p{font-size:18px;color:var(--color-text-secondary);max-width:520px;margin-bottom:40px}\n.landing-features{display:flex;gap:24px;margin-top:60px;max-width:800px}\n.feature-card{flex:1;padding:24px;background:var(--color-bg-elevated);border-radius:var(--radius-lg);border:1px solid var(--color-border);box-shadow:var(--shadow-sm)}\n.feature-card-icon{width:44px;height:44px;display:flex;align-items:center;justify-content:center;background:var(--color-primary-light);border-radius:var(--radius-md);color:var(--color-primary);margin-bottom:16px}\n.feature-card-icon svg{width:22px;height:22px}\n.feature-card h3{font-size:16px;font-weight:600;margin-bottom:8px}\n.feature-card p{font-size:14px;color:var(--color-text-muted);line-height:1.6}\n\n/* Status Pages */\n.status-page{min-height:100vh;display:flex;align-items:center;justify-content:center;background:var(--color-bg);padding:20px}\n.status-card{max-width:440px;width:100%;padding:48px 40px;background:var(--color-bg-elevated);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);text-align:center}\n.status-icon{font-size:48px;margin-bottom:20px}\n.status-icon.error{color:var(--color-danger)}\n.status-card h2{font-size:22px;font-weight:700;margin-bottom:12px}\n.status-card p{font-size:14px;color:var(--color-text-secondary);margin-bottom:8px;line-height:1.6}\n.error-text{color:var(--color-danger);background:var(--color-danger-light);padding:12px 16px;border-radius:var(--radius-md);margin:16px 0;font-size:13px}\n.status-actions{display:flex;flex-direction:column;gap:10px;margin-top:24px}\n\n/* Loading */\n.loading-screen{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;color:var(--color-text-muted);font-size:14px}\n.loading-spinner{width:36px;height:36px;border:3px solid var(--color-bg-muted);border-top-color:var(--color-primary);border-radius:50%;animation:spin 0.8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n\n/* Platform Layout */\n.platform{display:flex;height:100vh;overflow:hidden}\n.platform.sidebar-collapsed .main-area{margin-left:var(--sidebar-collapsed)}\n\n/* Sidebar */\n.sidebar{position:fixed;left:0;top:0;bottom:0;width:var(--sidebar-width);background:var(--color-bg-elevated);border-right:1px solid var(--color-border);display:flex;flex-direction:column;transition:width var(--transition-normal);z-index:100}\n.sidebar.collapsed{width:var(--sidebar-collapsed)}\n.sidebar-header{padding:20px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--color-border-light)}\n.logo{display:flex;align-items:center;gap:12px}\n.logo-icon{width:40px;height:40px;display:flex;align-items:center;justify-content:center;background:linear-gradient(135deg,var(--color-primary) 0%,#1e40af 100%);border-radius:var(--radius-md);color:white;flex-shrink:0}\n.logo-icon svg{width:22px;height:22px}\n.logo-text{font-size:18px;font-weight:600;color:var(--color-text);letter-spacing:-0.3px}\n.collapse-btn{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:none;border:none;color:var(--color-text-muted);cursor:pointer;border-radius:var(--radius-sm);transition:all var(--transition-fast)}\n.collapse-btn:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.collapse-btn svg{width:18px;height:18px}\n.sidebar-nav{flex:1;padding:16px 12px;overflow-y:auto}\n.nav-section{margin-bottom:24px}\n.nav-label{display:block;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;color:var(--color-text-muted);padding:0 12px;margin-bottom:8px}\n.nav-list{list-style:none}\n.nav-item{width:100%;display:flex;align-items:center;gap:12px;padding:10px 12px;background:none;border:none;border-radius:var(--radius-md);color:var(--color-text-secondary);font-size:14px;font-weight:500;cursor:pointer;transition:all var(--transition-fast);text-align:left}\n.nav-item:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.nav-item.active{background:var(--color-primary-light);color:var(--color-primary)}\n.nav-icon{width:22px;height:22px;display:flex;align-items:center;justify-content:center;flex-shrink:0}\n.nav-icon svg{width:20px;height:20px}\n.sidebar-footer{padding:16px 12px;border-top:1px solid var(--color-border-light)}\n.sidebar-brand{display:flex;align-items:center;justify-content:center;gap:6px;font-size:12px;color:var(--color-text-muted)}\n.sidebar-brand strong{color:var(--color-text-secondary)}\n\n/* Main Area */\n.main-area{flex:1;margin-left:var(--sidebar-width);min-height:0;display:flex;flex-direction:column;transition:margin-left var(--transition-normal)}\n\n/* Top Bar */\n.top-bar{height:var(--topbar-height);padding:0 32px;display:flex;align-items:center;justify-content:space-between;background:var(--color-bg-elevated);border-bottom:1px solid var(--color-border);position:sticky;top:0;z-index:50}\n.breadcrumb{display:flex;align-items:center;gap:8px;font-size:14px}\n.breadcrumb-item{color:var(--color-text-muted)}\n.breadcrumb-separator{color:var(--color-border)}\n.breadcrumb-current{color:var(--color-text);font-weight:600}\n.top-bar-actions{display:flex;align-items:center;gap:16px}\n.client-badge{padding:4px 12px;background:var(--color-primary-light);color:var(--color-primary);border-radius:20px;font-size:12px;font-weight:600}\n.user-menu{position:relative}\n.user-menu-trigger{display:flex;align-items:center;gap:10px;padding:6px 10px;background:none;border:1px solid transparent;border-radius:var(--radius-md);cursor:pointer;transition:all var(--transition-fast)}\n.user-menu-trigger:hover{background:var(--color-bg-subtle);border-color:var(--color-border)}\n.user-avatar{width:32px;height:32px;display:flex;align-items:center;justify-content:center;background:var(--color-primary);color:white;border-radius:50%;font-size:13px;font-weight:600}\n.user-name{font-size:13px;font-weight:500;color:var(--color-text)}\n.user-dropdown{position:absolute;right:0;top:100%;margin-top:8px;width:220px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);padding:8px;z-index:200}\n.user-dropdown-item{width:100%;display:flex;align-items:center;gap:10px;padding:8px 12px;background:none;border:none;border-radius:var(--radius-sm);font-size:13px;color:var(--color-text-secondary);cursor:pointer;transition:all var(--transition-fast);text-align:left}\n.user-dropdown-item:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.user-dropdown-item.danger{color:var(--color-danger)}\n.user-dropdown-item.danger:hover{background:var(--color-danger-light)}\n.user-dropdown-divider{height:1px;background:var(--color-border-light);margin:6px 0}\n\n/* Content Area */\n.content-area{flex:1;padding:32px;display:flex;flex-direction:column;min-height:0;overflow:auto}\n.view-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:28px}\n.view-header h1{font-size:28px;font-weight:700;letter-spacing:-0.3px}\n.view-subtitle{font-size:14px;color:var(--color-text-muted);margin-top:4px}\n\n/* Stats Grid */\n.stats-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:20px;margin-bottom:28px}\n.stat-card{padding:24px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg)}\n.stat-label{font-size:13px;font-weight:500;color:var(--color-text-muted);text-transform:uppercase;letter-spacing:0.3px;margin-bottom:8px}\n.stat-value{font-size:28px;font-weight:700;color:var(--color-text)}\n.stat-value.text-green{color:var(--color-success)}\n.stat-value.text-red{color:var(--color-danger)}\n.stat-value.text-blue{color:var(--color-primary)}\n\n/* Content Cards */\n.content-card{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);overflow:hidden}\n.content-card-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--color-border-light)}\n.content-card-header h3{font-size:16px;font-weight:600}\n.content-card-body{padding:0}\n.content-card-body.padded{padding:24px}\n\n/* Data Table */\n.data-table{width:100%;border-collapse:collapse}\n.data-table th{text-align:left;padding:12px 20px;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;color:var(--color-text-muted);background:var(--color-bg-subtle);border-bottom:1px solid var(--color-border)}\n.data-table td{padding:14px 20px;font-size:14px;border-bottom:1px solid var(--color-border-light)}\n.data-table tr:last-child td{border-bottom:none}\n.data-table tr:hover td{background:var(--color-bg-subtle);cursor:pointer}\n\n/* Campaign Rows */\n.campaign-row{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--color-border-light);cursor:pointer;transition:background var(--transition-fast)}\n.campaign-row:hover{background:var(--color-bg-subtle)}\n.campaign-row:last-child{border-bottom:none}\n.campaign-info{display:flex;flex-direction:column;gap:2px}\n.campaign-name{font-size:14px;font-weight:500;color:var(--color-text)}\n.campaign-type{font-size:12px;color:var(--color-text-muted)}\n\n/* Status Badges */\n.status-badge{display:inline-flex;align-items:center;padding:3px 10px;border-radius:20px;font-size:12px;font-weight:600;text-transform:capitalize}\n.status-badge.status-enabled,.status-badge.status-active{background:var(--color-success-light);color:var(--color-success)}\n.status-badge.status-paused{background:var(--color-warning-light);color:var(--color-warning)}\n.status-badge.status-removed,.status-badge.status-disabled,.status-badge.status-cancelled{background:var(--color-danger-light);color:var(--color-danger)}\n.status-badge.status-draft{background:var(--color-bg-subtle);color:var(--color-text-muted)}\n.status-badge.status-in-review,.status-badge.status-scheduled,.status-badge.status-staged{background:var(--color-primary-light);color:var(--color-primary)}\n.status-badge.status-completed{background:var(--color-bg-subtle);color:var(--color-text-secondary)}\n.status-badge.status-action-needed,.status-badge.status-error{background:var(--color-danger-light);color:var(--color-danger)}\n.status-badge.status-pending{background:var(--color-primary-light);color:var(--color-primary)}\n\n/* Campaign Cards */\n.campaign-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:16px}\n.campaign-card{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:20px;cursor:pointer;transition:border-color 0.15s,box-shadow 0.15s}\n.campaign-card:hover{border-color:var(--color-primary);box-shadow:0 0 0 1px var(--color-primary)}\n.campaign-card-header{display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:12px}\n.campaign-card-title{font-size:15px;font-weight:600;color:var(--color-text);line-height:1.3;flex:1;margin-right:12px}\n.campaign-card-body{display:flex;flex-direction:column;gap:10px}\n.campaign-card-meta{display:flex;flex-wrap:wrap;gap:12px;font-size:13px;color:var(--color-text-muted)}\n.campaign-card-meta span{display:inline-flex;align-items:center;gap:4px}\n.campaign-card-meta svg{opacity:0.6}\n.campaign-card-channels{display:flex;gap:6px;flex-wrap:wrap}\n.channel-pill{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:12px;font-size:11px;font-weight:600;background:var(--color-bg-subtle);color:var(--color-text-secondary);text-transform:capitalize}\n.campaign-card-actions{display:flex;gap:8px;margin-top:12px;padding-top:12px;border-top:1px solid var(--color-border-light)}\n.campaign-card-actions .btn{font-size:12px;padding:5px 12px}\n\n/* Filter Tabs */\n.filter-tabs{display:flex;gap:2px;padding:3px;background:var(--color-bg-subtle);border-radius:var(--radius-md);width:fit-content;border:1px solid var(--color-border-light)}\n.filter-tab{padding:7px 14px;border-radius:calc(var(--radius-md) - 2px);font-size:13px;font-weight:500;color:var(--color-text-muted);background:none;border:none;cursor:pointer;transition:all 0.15s;white-space:nowrap}\n.filter-tab:hover{color:var(--color-text-secondary);background:rgba(0,0,0,0.03)}\n.filter-tab.active{background:var(--color-bg-elevated);color:var(--color-text);box-shadow:0 1px 3px rgba(0,0,0,0.08),0 1px 2px rgba(0,0,0,0.04);font-weight:600}\n.filter-tab .tab-count{display:inline-flex;align-items:center;justify-content:center;margin-left:6px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;font-size:11px;font-weight:600;background:var(--color-bg-muted);color:var(--color-text-muted)}\n.filter-tab.active .tab-count{background:var(--color-primary);color:white}\n\n/* Search Box */\n.search-box{position:relative;margin-left:auto}\n.search-icon{position:absolute;left:12px;top:50%;transform:translateY(-50%);color:var(--color-text-muted);pointer-events:none;display:flex}\n.search-input{width:240px;padding:8px 12px 8px 36px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:13px;font-family:var(--font-sans);color:var(--color-text);transition:border-color var(--transition-fast),box-shadow var(--transition-fast),width var(--transition-normal)}\n.search-input:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(37,99,235,0.1);width:300px}\n.search-input::placeholder{color:var(--color-text-muted)}\n.search-clear{position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:var(--color-text-muted);padding:2px;display:flex;align-items:center;border-radius:var(--radius-sm)}\n.search-clear:hover{color:var(--color-text-secondary);background:var(--color-bg-subtle)}\n\n/* Draft Section */\n.drafts-section{margin-bottom:24px}\n.drafts-section h3{font-size:14px;font-weight:600;color:var(--color-text-secondary);margin-bottom:12px}\n.draft-cards{display:flex;gap:12px;overflow-x:auto;padding-bottom:4px}\n.draft-card{display:flex;align-items:center;gap:12px;padding:12px 16px;background:var(--color-bg-elevated);border:1px dashed var(--color-warning);border-radius:var(--radius-md);cursor:pointer;white-space:nowrap;min-width:220px;transition:border-color 0.15s,background 0.15s}\n.draft-card:hover{background:var(--color-warning-light);border-color:var(--color-warning)}\n.draft-icon{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--radius-sm);background:var(--color-warning-light);flex-shrink:0}\n.draft-info{flex:1;min-width:0}\n.draft-name{font-size:13px;font-weight:600;color:var(--color-text);overflow:hidden;text-overflow:ellipsis}\n.draft-meta{font-size:11px;color:var(--color-text-muted);margin-top:2px}\n.draft-actions{display:flex;gap:4px;flex-shrink:0}\n.draft-actions button{background:none;border:none;padding:4px;cursor:pointer;color:var(--color-text-muted);border-radius:var(--radius-sm);transition:background 0.15s,color 0.15s}\n.draft-actions button:hover{background:var(--color-bg-subtle);color:var(--color-text-secondary)}\n.draft-actions button.danger:hover{background:var(--color-danger-light);color:var(--color-danger)}\n\n/* Campaigns Toolbar */\n.campaigns-toolbar{display:flex;align-items:center;gap:16px;margin-bottom:20px;flex-wrap:wrap}\n.campaigns-toolbar .filter-tabs{margin-bottom:0}\n\n/* Detail Panel */\n.detail-panel{position:fixed;right:0;top:0;bottom:0;width:420px;background:var(--color-bg-elevated);border-left:1px solid var(--color-border);box-shadow:var(--shadow-lg);z-index:150;display:flex;flex-direction:column;animation:slideIn 0.25s ease}\n@keyframes slideIn{from{transform:translateX(100%)}to{transform:translateX(0)}}\n.detail-panel-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--color-border)}\n.detail-panel-header h3{font-size:18px;font-weight:600}\n.detail-panel-body{flex:1;overflow-y:auto;padding:24px}\n.detail-section{margin-bottom:28px}\n.detail-section h4{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:0.5px;color:var(--color-text-muted);margin-bottom:16px}\n.detail-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}\n.detail-item{display:flex;flex-direction:column;gap:4px}\n.detail-label{font-size:12px;color:var(--color-text-muted)}\n.detail-value{font-size:14px;font-weight:500;color:var(--color-text)}\n.detail-panel-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.3);z-index:140;animation:fadeIn 0.2s ease}\n.detail-actions{display:flex;gap:8px;flex-wrap:wrap}\n.detail-actions .btn{gap:6px}\n.channel-allocation-list{display:flex;flex-direction:column;gap:12px}\n.channel-alloc-row{display:flex;align-items:center;gap:10px}\n.channel-alloc-info{display:flex;flex-direction:column;min-width:100px}\n.channel-alloc-name{font-size:13px;font-weight:600;color:var(--color-text)}\n.channel-alloc-budget{font-size:11px;color:var(--color-text-muted)}\n.channel-alloc-bar-track{flex:1;height:8px;background:var(--color-bg-subtle);border-radius:4px;overflow:hidden}\n.channel-alloc-bar{height:100%;background:var(--color-primary);border-radius:4px;transition:width 0.3s ease}\n.channel-alloc-pct{font-size:12px;font-weight:600;color:var(--color-text-muted);min-width:36px;text-align:right}\n.detail-timeline{display:flex;flex-direction:column;gap:12px;padding-left:8px;border-left:2px solid var(--color-border-light)}\n.timeline-item{display:flex;align-items:center;gap:10px;font-size:13px;color:var(--color-text-secondary);position:relative;margin-left:-9px}\n.timeline-dot{width:10px;height:10px;border-radius:50%;flex-shrink:0}\n.timeline-dot.created{background:var(--color-text-muted)}\n.timeline-dot.launched{background:var(--color-primary)}\n.timeline-dot.completed{background:var(--color-success)}\n\n/* Modal */\n.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.4);display:flex;align-items:center;justify-content:center;z-index:200;animation:fadeIn 0.15s ease}\n.modal-content{background:var(--color-bg-elevated);border-radius:var(--radius-xl);box-shadow:0 20px 60px rgba(0,0,0,0.15);max-width:420px;width:90%;animation:scaleIn 0.2s ease}\n@keyframes scaleIn{from{opacity:0;transform:scale(0.95)}to{opacity:1;transform:scale(1)}}\n\n/* Launch Modal */\n.launch-modal{padding:0;overflow:hidden}\n.launch-modal-header{padding:28px 28px 20px;text-align:center}\n.launch-modal-icon{display:inline-flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:50%;background:var(--color-primary-light);color:var(--color-primary);margin-bottom:12px}\n.launch-modal-icon svg{width:22px;height:22px}\n.launch-modal-header h3{font-size:18px;font-weight:700;color:var(--color-text);margin-bottom:4px}\n.launch-modal-header p{font-size:14px;color:var(--color-text-muted);line-height:1.4}\n.launch-modal-header p strong{color:var(--color-text)}\n\n.launch-modal-billing{padding:0 28px 20px;display:flex;flex-direction:column;gap:10px}\n.billing-row{display:flex;justify-content:space-between;align-items:center;font-size:14px;color:var(--color-text-secondary);padding:6px 0}\n.billing-row span:last-child{font-weight:600;font-family:var(--font-mono);font-size:13px}\n.billing-total{border-top:1px solid var(--color-border);padding-top:12px;margin-top:4px;font-weight:600;color:var(--color-text);font-size:15px}\n.billing-total span:last-child{color:var(--color-primary);font-size:15px}\n\n.launch-modal-actions{display:flex;justify-content:flex-end;gap:10px;padding:16px 28px;background:var(--color-bg-subtle);border-top:1px solid var(--color-border-light)}\n.btn-launch{gap:6px}\n@keyframes fadeIn{from{opacity:0}to{opacity:1}}\n.modal{width:520px;max-height:90vh;background:var(--color-bg-elevated);border-radius:var(--radius-xl);box-shadow:var(--shadow-lg);display:flex;flex-direction:column;animation:scaleIn 0.2s ease}\n@keyframes scaleIn{from{transform:scale(0.95);opacity:0}to{transform:scale(1);opacity:1}}\n.modal-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--color-border)}\n.modal-header h3{font-size:18px;font-weight:600}\n.modal-close{width:32px;height:32px;display:flex;align-items:center;justify-content:center;background:none;border:none;color:var(--color-text-muted);cursor:pointer;border-radius:var(--radius-sm)}\n.modal-close:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.modal-body{padding:24px;overflow-y:auto}\n.modal-footer{display:flex;justify-content:flex-end;gap:12px;padding:16px 24px;border-top:1px solid var(--color-border);background:var(--color-bg-subtle);border-radius:0 0 var(--radius-xl) var(--radius-xl)}\n\n/* Forms */\n.form-group{margin-bottom:20px}\n.form-group label{display:block;font-size:13px;font-weight:600;color:var(--color-text-secondary);margin-bottom:6px}\n.form-input,.form-select,.form-textarea{width:100%;padding:10px 14px;background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:14px;font-family:var(--font-sans);color:var(--color-text);transition:border-color var(--transition-fast),box-shadow var(--transition-fast)}\n.form-input:focus,.form-select:focus,.form-textarea:focus{outline:none;border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(37,99,235,0.1)}\n.form-input::placeholder{color:var(--color-text-muted)}\n.form-row{display:flex;gap:16px}\n.form-row .form-group{flex:1}\n.input-row{display:flex;gap:12px;align-items:flex-end;margin-bottom:20px}\n.input-row .form-input{flex:1}\n\n/* Buttons */\n.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 20px;border:1px solid transparent;border-radius:var(--radius-md);font-size:14px;font-weight:600;font-family:var(--font-sans);cursor:pointer;transition:all var(--transition-fast);text-decoration:none}\n.btn:disabled{opacity:0.6;cursor:not-allowed}\n.btn-primary{background:var(--color-primary);color:white;border-color:var(--color-primary)}\n.btn-primary:hover:not(:disabled){background:var(--color-primary-hover)}\n.btn-outline{background:var(--color-bg-elevated);color:var(--color-text-secondary);border-color:var(--color-border)}\n.btn-outline:hover:not(:disabled){background:var(--color-bg-subtle);border-color:var(--color-text-muted)}\n.btn-danger{background:var(--color-danger);color:white;border-color:var(--color-danger)}\n.btn-danger:hover:not(:disabled){background:#b91c1c}\n.btn-sm{padding:6px 14px;font-size:13px}\n.btn-ghost{background:none;border:none;color:var(--color-text-muted);cursor:pointer;padding:6px 12px;border-radius:var(--radius-sm);transition:all 0.15s}\n.btn-ghost:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.btn-lg{padding:14px 28px;font-size:16px}\n.btn-icon{padding:8px}\n.btn-spinner{display:inline-block;width:14px;height:14px;border:2px solid rgba(255,255,255,0.3);border-top-color:white;border-radius:50%;animation:spin 0.6s linear infinite}\n\n/* Info/Error Boxes */\n.info-box{padding:14px 20px;background:var(--color-primary-light);border:1px solid #bfdbfe;border-radius:var(--radius-md);font-size:14px;color:var(--color-primary-dark);margin-bottom:20px}\n.error-box{padding:14px 20px;background:var(--color-danger-light);border:1px solid #fca5a5;border-radius:var(--radius-md);font-size:14px;color:var(--color-danger);margin-bottom:20px}\n\n/* Empty States */\n.empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 24px;text-align:center;color:var(--color-text-muted)}\n.empty-state svg{margin-bottom:16px;opacity:0.5}\n.empty-state h3{font-size:16px;font-weight:600;color:var(--color-text-secondary);margin-bottom:8px}\n.empty-state p{font-size:14px;margin-bottom:20px}\n\n/* Settings */\n.settings-layout{display:flex;gap:32px}\n.settings-nav{width:200px;flex-shrink:0}\n.settings-nav-item{width:100%;display:block;padding:10px 16px;background:none;border:none;border-radius:var(--radius-md);font-size:14px;font-weight:500;color:var(--color-text-secondary);cursor:pointer;text-align:left;transition:all var(--transition-fast);margin-bottom:4px}\n.settings-nav-item:hover{background:var(--color-bg-subtle)}\n.settings-nav-item.active{background:var(--color-primary-light);color:var(--color-primary)}\n.settings-content{flex:1}\n.settings-section{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:28px;margin-bottom:24px}\n.settings-section h3{font-size:16px;font-weight:600;margin-bottom:20px;padding-bottom:16px;border-bottom:1px solid var(--color-border-light)}\n.setting-row{display:flex;align-items:center;justify-content:space-between;padding:14px 0;border-bottom:1px solid var(--color-border-light)}\n.setting-row:last-child{border-bottom:none}\n.setting-info{flex:1}\n.setting-label{font-size:14px;font-weight:500;color:var(--color-text)}\n.setting-desc{font-size:13px;color:var(--color-text-muted);margin-top:2px}\n.setting-value{font-size:13px;color:var(--color-text-secondary);font-family:var(--font-mono)}\n.session-info-detailed{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}\n\n/* Developer */\n.preset-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:20px}\n.dev-form{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:24px;margin-bottom:24px}\n.dev-response{background:var(--color-bg-elevated);border:1px solid var(--color-border);border-radius:var(--radius-lg);overflow:hidden}\n.response-header{display:flex;align-items:center;gap:12px;padding:14px 20px;background:var(--color-bg-subtle);border-bottom:1px solid var(--color-border);font-size:13px;font-weight:500}\n.status-dot{width:10px;height:10px;border-radius:50%}\n.status-dot.green{background:var(--color-success)}\n.status-dot.red{background:var(--color-danger)}\n.elapsed{color:var(--color-text-muted);margin-left:auto}\n.request-id{color:var(--color-text-muted);font-family:var(--font-mono);font-size:12px}\n.response-body{padding:20px;font-family:var(--font-mono);font-size:13px;line-height:1.6;overflow-x:auto;max-height:500px;overflow-y:auto;white-space:pre-wrap;word-break:break-word}\n\n/* Skeletons */\n.skeleton{background:linear-gradient(90deg,var(--color-bg-subtle) 25%,var(--color-bg-muted) 50%,var(--color-bg-subtle) 75%);background-size:200% 100%;animation:skeleton-shimmer 1.5s infinite;border-radius:var(--radius-sm)}\n@keyframes skeleton-shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}\n.skeleton-row{height:16px;margin-bottom:12px}\n.loading-placeholder{padding:16px 0}\n.loading-placeholder.padded{padding:20px}\n\n/* Detail panel notices */\n.detail-notice{display:flex;gap:12px;padding:14px 16px;border-radius:var(--radius-md);margin-bottom:16px;font-size:13px;line-height:1.5}\n.detail-notice.notice-info{background:var(--color-primary-light);border:1px solid rgba(37,99,235,0.15)}\n.detail-notice .notice-icon{flex-shrink:0;margin-top:1px;color:var(--color-primary)}\n.detail-notice strong{display:block;font-weight:600;color:var(--color-text);margin-bottom:2px}\n.detail-notice p{color:var(--color-text-secondary);margin:0}\n\n/* Small status badge (for channel rows) */\n.status-badge-sm{display:inline-flex;align-items:center;padding:1px 8px;border-radius:10px;font-size:11px;font-weight:600}\n.status-badge-sm.status-active,.status-badge-sm.status-enabled{background:var(--color-success-light);color:var(--color-success)}\n.status-badge-sm.status-in-review,.status-badge-sm.status-pending,.status-badge-sm.status-staged{background:var(--color-primary-light);color:var(--color-primary)}\n.status-badge-sm.status-paused{background:var(--color-warning-light);color:var(--color-warning)}\n.status-badge-sm.status-error,.status-badge-sm.status-cancelled{background:var(--color-danger-light);color:var(--color-danger)}\n\n/* Danger outline button */\n.btn-danger-outline{color:var(--color-danger);border-color:var(--color-danger)}\n.btn-danger-outline:hover{background:var(--color-danger-light)}\n\n/* Timeline dot: submitted */\n.timeline-dot.submitted{background:var(--color-primary)}\n\n/* Responsive */\n@media(max-width:900px){.settings-layout{flex-direction:column}.settings-nav{width:100%;display:flex;gap:8px;overflow-x:auto}.landing-features{flex-direction:column}}\n@media(max-width:768px){.content-area{padding:20px}.view-header{flex-direction:column;gap:16px}.detail-panel{width:100%}.sidebar{transform:translateX(-100%)}.sidebar.open{transform:translateX(0)}.main-area{margin-left:0}}\n/* ============================================================\n Contextual Help System\n Append to: admin/src/styles/app.css\n client/src/styles/app.css (update --accent vars as needed)\n ============================================================ */\n\n/* ── Help Trigger (floating icon + label) ────────────────────*/\n\n.help-trigger {\n display: inline-flex;\n align-items: center;\n gap: 5px;\n background: none;\n border: 1px solid transparent;\n border-radius: 20px;\n padding: 3px 8px 3px 4px;\n cursor: pointer;\n color: var(--accent, #3b82f6);\n font-size: 12px;\n font-family: inherit;\n font-weight: 500;\n transition: background 0.15s, border-color 0.15s, color 0.15s;\n white-space: nowrap;\n line-height: 1;\n}\n\n.help-trigger:hover {\n background: var(--accent-light, rgba(59,130,246,0.08));\n border-color: var(--accent, #3b82f6);\n color: var(--accent-hover, #2563eb);\n}\n\n.help-trigger-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n background: var(--accent-light, rgba(59,130,246,0.1));\n border-radius: 50%;\n flex-shrink: 0;\n color: var(--accent, #3b82f6);\n}\n\n.help-trigger-label {\n color: var(--accent, #3b82f6);\n font-size: 12px;\n}\n\n\n/* ── Help Modal ───────────────────────────────────────────────*/\n\n.help-overlay {\n position: fixed;\n inset: 0;\n background: rgba(0, 0, 0, 0.35);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 9999;\n padding: 20px;\n animation: helpFadeIn 0.15s ease;\n}\n\n@keyframes helpFadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.help-modal {\n background: var(--surface, #fff);\n border-radius: 12px;\n box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 12px rgba(0,0,0,0.1);\n width: 100%;\n max-width: 520px;\n max-height: 80vh;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n animation: helpSlideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);\n}\n\n@keyframes helpSlideUp {\n from { transform: translateY(16px) scale(0.97); opacity: 0; }\n to { transform: translateY(0) scale(1); opacity: 1; }\n}\n\n.help-modal-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 16px 20px 14px;\n border-bottom: 1px solid var(--border, rgba(0,0,0,0.09));\n flex-shrink: 0;\n}\n\n.help-modal-title-row {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.help-modal-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 30px;\n height: 30px;\n background: var(--accent-light, rgba(59,130,246,0.1));\n border-radius: 8px;\n color: var(--accent, #3b82f6);\n flex-shrink: 0;\n}\n\n.help-modal-title {\n font-size: 15px;\n font-weight: 600;\n color: var(--text, #1a1d23);\n margin: 0;\n}\n\n.help-modal-close {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n background: none;\n border: none;\n border-radius: 6px;\n cursor: pointer;\n color: var(--text-dim, #9099a4);\n transition: background 0.12s, color 0.12s;\n flex-shrink: 0;\n}\n.help-modal-close:hover {\n background: var(--bg, #f4f5f7);\n color: var(--text, #1a1d23);\n}\n\n.help-modal-body {\n flex: 1;\n overflow-y: auto;\n padding: 20px;\n}\n\n.help-loading {\n display: flex;\n align-items: center;\n gap: 10px;\n color: var(--text-dim, #9099a4);\n font-size: 14px;\n padding: 8px 0;\n}\n\n.help-spinner {\n width: 18px;\n height: 18px;\n border: 2px solid var(--border, #e5e7eb);\n border-top-color: var(--accent, #3b82f6);\n border-radius: 50%;\n animation: spin 0.7s linear infinite;\n}\n\n.help-error {\n color: var(--danger, #dc2626);\n font-size: 14px;\n background: var(--danger-bg, #fef2f2);\n padding: 10px 14px;\n border-radius: 8px;\n margin: 0;\n}\n\n/* Rendered HTML help content */\n.help-content {\n font-size: 14px;\n line-height: 1.65;\n color: var(--text, #1a1d23);\n}\n.help-content p { margin: 0 0 12px; }\n.help-content p:last-child { margin-bottom: 0; }\n.help-content h4 { font-size: 13px; font-weight: 600; margin: 16px 0 6px; color: var(--text-secondary, #374151); text-transform: uppercase; letter-spacing: 0.3px; }\n.help-content ul, .help-content ol { margin: 0 0 12px 20px; }\n.help-content li { margin-bottom: 5px; }\n.help-content strong { font-weight: 600; }\n.help-content a { color: var(--accent, #3b82f6); text-decoration: none; }\n.help-content a:hover { text-decoration: underline; }\n\n.help-modal-footer {\n padding: 10px 20px;\n border-top: 1px solid var(--border, rgba(0,0,0,0.06));\n flex-shrink: 0;\n background: var(--bg, #f4f5f7);\n}\n\n.help-key-badge {\n font-family: var(--font-mono, monospace);\n font-size: 11px;\n color: var(--text-dim, #9099a4);\n}\n\n\n/* ── HelpPanel (Admin) ────────────────────────────────────────*/\n\n.help-panel {\n padding: 24px;\n max-width: 1000px;\n position: relative;\n}\n\n.help-panel-toast {\n position: fixed;\n bottom: 24px;\n right: 24px;\n background: var(--success, #16a34a);\n color: #fff;\n padding: 10px 18px;\n border-radius: 8px;\n font-size: 13px;\n font-weight: 500;\n box-shadow: 0 4px 12px rgba(0,0,0,0.15);\n z-index: 1000;\n animation: helpFadeIn 0.2s ease;\n}\n.help-panel-toast.help-panel-toast-error {\n background: var(--danger, #dc2626);\n}\n\n.help-edit-card {\n background: var(--surface, #fff);\n border: 1px solid var(--accent, #3b82f6);\n border-radius: 10px;\n padding: 20px;\n margin-bottom: 24px;\n box-shadow: 0 0 0 4px var(--accent-light, rgba(59,130,246,0.08));\n}\n\n.help-edit-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 18px;\n}\n.help-edit-header h3 {\n font-size: 14px;\n font-weight: 600;\n color: var(--text, #1a1d23);\n margin: 0;\n}\n\n.help-form-row {\n margin-bottom: 14px;\n}\n.help-form-row-inline {\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.help-form-label {\n display: flex;\n align-items: baseline;\n gap: 8px;\n font-size: 12px;\n font-weight: 600;\n color: var(--text-secondary, #5f6672);\n text-transform: uppercase;\n letter-spacing: 0.3px;\n margin-bottom: 6px;\n}\n\n.help-form-hint {\n font-weight: 400;\n font-size: 11px;\n color: var(--text-dim, #9099a4);\n text-transform: none;\n letter-spacing: 0;\n}\n\n.help-key-suggestions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 6px;\n margin-top: 6px;\n}\n\n.help-key-chip {\n background: var(--accent-light, rgba(59,130,246,0.08));\n border: 1px solid var(--accent, #3b82f6);\n color: var(--accent, #3b82f6);\n border-radius: 4px;\n padding: 2px 8px;\n font-size: 11px;\n font-family: var(--font-mono, monospace);\n cursor: pointer;\n transition: background 0.12s;\n}\n.help-key-chip:hover {\n background: var(--accent-light, rgba(59,130,246,0.16));\n}\n\n.help-key-display {\n font-family: var(--font-mono, monospace);\n font-size: 13px;\n color: var(--text, #1a1d23);\n background: var(--bg, #f4f5f7);\n border: 1px solid var(--border, rgba(0,0,0,0.09));\n border-radius: 6px;\n padding: 7px 10px;\n}\n\n.help-body-textarea {\n resize: vertical;\n min-height: 160px;\n}\n\n/* Table extras */\n.help-table-wrap {\n background: var(--surface, #fff);\n border: 1px solid var(--border, rgba(0,0,0,0.09));\n border-radius: 10px;\n overflow: hidden;\n}\n\n.help-row-inactive {\n opacity: 0.5;\n}\n\n.help-key-code {\n font-family: var(--font-mono, monospace);\n font-size: 12px;\n background: var(--bg, #f4f5f7);\n padding: 2px 6px;\n border-radius: 4px;\n color: var(--text, #1a1d23);\n}\n\n.toggle-label {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n color: var(--text-secondary, #5f6672);\n cursor: pointer;\n user-select: none;\n}\n\n/* ── Step intro header with HelpIcon aligned right ── */\n.step-intro-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n margin-bottom: 4px;\n}\n.step-intro-header h2 {\n margin: 0;\n}\n\n/* ── Client portal additions (new panels/layout) ── */\n\n/* Layout */\n.dashboard-layout{display:flex;height:100vh;overflow:hidden}\n.dashboard-main{flex:1;margin-left:var(--sidebar-width);min-height:0;display:flex;flex-direction:column;transition:margin-left 0.25s ease;overflow:hidden}\n.sidebar-collapsed .dashboard-main{margin-left:72px}\n.sidebar-collapsed .sidebar{width:72px}\n.dashboard-header{padding:20px 32px 0;background:var(--color-bg-elevated);border-bottom:1px solid var(--color-border);flex-shrink:0}\n.dashboard-header-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}\n.dashboard-title{font-size:22px;font-weight:700;color:var(--color-text)}\n.dashboard-tabs{display:flex;gap:4px;padding-bottom:0}\n.dashboard-meta{display:flex;gap:16px;font-size:13px;color:var(--color-text-muted)}\n.dashboard-meta span{display:flex;gap:4px;align-items:center}\n.dashboard-content{flex:1;overflow-y:auto;padding:28px 32px}\n.dashboard-header-right{display:flex;align-items:center;gap:12px}\n\n/* Tab buttons */\n.tab-btn{padding:8px 16px;border:none;background:none;font-size:14px;font-weight:500;color:var(--color-text-muted);cursor:pointer;border-bottom:2px solid transparent;transition:all 0.15s;white-space:nowrap}\n.tab-btn:hover{color:var(--color-text)}\n.tab-btn.active{color:var(--color-primary);border-bottom-color:var(--color-primary)}\n\n/* Sidebar additions */\n.sidebar-logo{display:flex;align-items:center;gap:10px;padding:20px;border-bottom:1px solid var(--color-border-light)}\n.sidebar-logo-icon{font-size:20px;color:var(--color-primary)}\n.sidebar-logo-text{font-size:16px;font-weight:700;color:var(--color-text)}\n.sidebar-logo-badge{font-size:10px;font-weight:600;background:var(--color-primary-light);color:var(--color-primary);padding:2px 6px;border-radius:4px;text-transform:uppercase;letter-spacing:0.5px}\n.sidebar-item{display:flex;align-items:center;gap:12px;width:100%;padding:10px 12px;border:none;background:none;cursor:pointer;border-radius:var(--radius-md);font-size:14px;font-weight:500;color:var(--color-text-secondary);text-align:left;transition:all 0.15s;margin-bottom:2px}\n.sidebar-item:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.sidebar-item-active{background:var(--color-primary-light)!important;color:var(--color-primary)!important}\n.sidebar-item-disabled{opacity:0.4;cursor:not-allowed}\n.sidebar-item-icon{display:flex;align-items:center;justify-content:center;flex-shrink:0;width:22px;color:inherit}\n.sidebar-item-label{flex:1}\n.sidebar-soon{font-size:10px;font-weight:600;background:#f1f5f9;color:#94a3b8;padding:2px 6px;border-radius:10px}\n.sidebar-divider{height:1px;background:var(--color-border-light);margin:8px 12px}\n.sidebar-footer{padding:16px 12px;border-top:1px solid var(--color-border-light);margin-top:auto}\n.sidebar-user{display:flex;align-items:center;gap:10px;padding:8px 4px;margin-bottom:8px}\n.sidebar-user-avatar{width:32px;height:32px;border-radius:50%;background:var(--color-primary);color:#fff;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex-shrink:0}\n.sidebar-user-info{flex:1;min-width:0}\n.sidebar-user-name{display:block;font-size:13px;font-weight:500;color:var(--color-text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}\n.sidebar-user-signout{background:none;border:none;font-size:12px;color:var(--color-text-muted);cursor:pointer;padding:0}\n.sidebar-user-signout:hover{color:var(--color-danger)}\n.sidebar-user-collapsed{display:flex;justify-content:center;margin-bottom:8px}\n.sidebar-collapse-btn{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:none;cursor:pointer;border-radius:var(--radius-md);font-size:13px;color:var(--color-text-muted);transition:all 0.15s}\n.sidebar-collapse-btn:hover{background:var(--color-bg-subtle);color:var(--color-text)}\n.sidebar-collapse-icon{display:flex;transition:transform 0.2s}\n.sidebar-collapse-icon-flip{transform:rotate(180deg)}\n.sidebar-badge{font-size:11px;font-weight:600;background:var(--color-primary);color:#fff;padding:2px 7px;border-radius:10px;min-width:18px;text-align:center}\n\n/* Buttons */\n.btn-action{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;background:var(--color-primary);color:#fff;border:none;border-radius:var(--radius-md);font-size:14px;font-weight:500;cursor:pointer;transition:background 0.15s;white-space:nowrap}\n.btn-action:hover{background:var(--color-primary-hover)}\n.btn-action:disabled{opacity:0.5;cursor:not-allowed}\n.btn-cancel{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;background:#fff;color:var(--color-text-secondary);border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:14px;font-weight:500;cursor:pointer;transition:all 0.15s}\n.btn-cancel:hover{background:var(--color-bg-subtle)}\n.btn-cancel:disabled{opacity:0.5;cursor:not-allowed}\n.btn-icon{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border:1px solid var(--color-border);background:#fff;border-radius:var(--radius-sm);font-size:14px;cursor:pointer;transition:all 0.15s;color:var(--color-text-secondary)}\n.btn-icon:hover{background:var(--color-bg-subtle)}\n.btn-icon:disabled{opacity:0.4;cursor:not-allowed}\n.btn-icon-danger:hover{background:var(--color-danger-light);border-color:#fca5a5;color:var(--color-danger)}\n.btn-signin{width:100%;padding:12px 20px;background:var(--color-primary);color:#fff;border:none;border-radius:var(--radius-md);font-size:15px;font-weight:600;cursor:pointer;transition:background 0.15s}\n.btn-signin:hover{background:var(--color-primary-dark)}\n.btn-signout{padding:6px 12px;border:1px solid var(--color-border);background:#fff;border-radius:var(--radius-md);font-size:13px;cursor:pointer;color:var(--color-text-secondary);transition:all 0.15s}\n.btn-signout:hover{background:var(--color-danger-light);border-color:var(--color-danger);color:var(--color-danger)}\n\n/* Form elements */\n.form-group{margin-bottom:16px}\n.form-label{display:block;font-size:13px;font-weight:600;color:var(--color-text-secondary);margin-bottom:6px}\n.form-input{width:100%;padding:9px 12px;border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:14px;font-family:inherit;color:var(--color-text);background:#fff;transition:border-color 0.15s;outline:none}\n.form-input:focus{border-color:var(--color-primary);box-shadow:0 0 0 3px rgba(37,99,235,0.1)}\n.form-select{width:100%;padding:9px 12px;border:1px solid var(--color-border);border-radius:var(--radius-md);font-size:14px;font-family:inherit;color:var(--color-text);background:#fff;cursor:pointer;outline:none}\n.form-select:focus{border-color:var(--color-primary)}\n.form-title{font-size:15px;font-weight:600;color:var(--color-text);margin-bottom:16px}\n.form-buttons{display:flex;gap:10px;margin-top:16px}\n.admin-form{background:#f8fafc;border:1px solid var(--color-border);border-radius:var(--radius-lg);padding:20px}\n\n/* Data panel */\n.data-panel{background:transparent}\n.panel-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}\n.panel-title{font-size:18px;font-weight:700;color:var(--color-text);margin:0}\n.panel-subtitle{font-size:13px;color:var(--color-text-muted);margin:4px 0 0}\n\n/* Messages */\n.loading-message{padding:40px;text-align:center;color:var(--color-text-muted);font-size:14px}\n.error-message{padding:12px 16px;background:var(--color-danger-light);border:1px solid #fca5a5;border-radius:var(--radius-md);color:var(--color-danger);font-size:14px}\n.loading-container{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:60px;gap:16px;color:var(--color-text-muted)}\n\n/* Spinner */\n.spinner{width:28px;height:28px;border:3px solid var(--color-border);border-top-color:var(--color-primary);border-radius:50%;animation:spin 0.8s linear infinite}\n@keyframes spin{to{transform:rotate(360deg)}}\n\n/* Modals */\n.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.4);z-index:200;display:flex;align-items:center;justify-content:center;padding:20px}\n.modal-box{background:#fff;border-radius:var(--radius-xl);padding:28px;max-width:440px;width:100%;box-shadow:var(--shadow-lg)}\n.modal-title{font-size:17px;font-weight:700;color:var(--color-text);margin:0 0 10px}\n.modal-body{font-size:14px;color:var(--color-text-secondary);line-height:1.6;margin:0 0 20px}\n.modal-buttons{display:flex;gap:10px;justify-content:flex-end}\n\n/* Placeholders */\n.placeholder-panel{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:80px 40px;text-align:center;color:var(--color-text-muted)}\n.placeholder-icon{font-size:48px;margin-bottom:16px}\n.placeholder-panel h3{font-size:18px;font-weight:600;color:var(--color-text-secondary);margin-bottom:8px}\n.placeholder-panel p{font-size:14px}\n\n/* Shell (pre-auth) */\n.shell{min-height:100vh;display:flex;flex-direction:column}\n.shell-header{padding:14px 24px;background:#fff;border-bottom:1px solid var(--color-border);display:flex;align-items:center;justify-content:space-between}\n.shell-logo{display:flex;align-items:center;gap:10px}\n.shell-logo .logo-icon{font-size:20px;color:var(--color-primary)}\n.shell-logo .logo-text{font-size:17px;font-weight:700;color:var(--color-text)}\n.shell-content{flex:1;display:flex;align-items:center;justify-content:center;padding:40px 20px}\n.shell-user{display:flex;align-items:center;gap:12px}\n.user-name{font-size:14px;color:var(--color-text-secondary)}\n\n/* Sign-in */\n.signin-overlay{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:40px}\n.signin-card{background:#fff;border-radius:var(--radius-xl);padding:40px;max-width:400px;width:100%;text-align:center;box-shadow:var(--shadow-lg)}\n.signin-icon{font-size:36px;color:var(--color-primary);margin-bottom:16px}\n.signin-card h1{font-size:24px;font-weight:700;color:var(--color-text);margin-bottom:8px}\n.signin-subtitle{font-size:15px;color:var(--color-text-muted);margin-bottom:28px}\n.btn-secondary{background:#fff;color:var(--color-primary);border:1px solid var(--color-primary)}\n\n/* Sidebar collapsed width — component sets sidebar-collapsed on the aside itself */\naside.sidebar-collapsed { width: 72px; }\naside.sidebar-collapsed .sidebar-logo-text,\naside.sidebar-collapsed .sidebar-item-label,\naside.sidebar-collapsed .sidebar-soon,\naside.sidebar-collapsed .sidebar-footer > .sidebar-user,\naside.sidebar-collapsed .sidebar-collapse-btn > span:last-child { display: none; }\naside.sidebar-collapsed .sidebar-item { justify-content: center; padding: 10px; }\naside.sidebar-collapsed .sidebar-logo { justify-content: center; }\n",""]);const s=i},961(e,t,n){!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(551)},982(e,t,n){e.exports=n(463)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={id:r,exports:{}};return e[r](a,a.exports,n),a.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.nc=void 0;var r=n(540),o=n(338);const a={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",CACHE_PREFIX:"msal",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_RESPONSE_TYPE:"code",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",FRAGMENT_RESPONSE_MODE:"fragment",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],TOKEN_RESPONSE_TYPE:"token",ID_TOKEN_RESPONSE_TYPE:"id_token",SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},i=[a.OPENID_SCOPE,a.PROFILE_SCOPE,a.OFFLINE_ACCESS_SCOPE],s=[...i,a.EMAIL_SCOPE],c="Content-Type",l="Retry-After",d="X-AnchorMailbox",u="x-ms-request-id",h="x-ms-httpver",p="idtoken",f="client.info",g="adal.idtoken",m="error",v="error.description",b="active-account",y="active-account-filters",x="common",w="organizations",k="consumers",C="access_token",S={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},j={PLAIN:"plain",S256:"S256"},T={QUERY:"query",FRAGMENT:"fragment"},I={...T,FORM_POST:"form_post"},A="Generic",N="-",E={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},_="appmetadata",P="1",O="authority-metadata",R="config",M="cache",z="network",L="hardcoded_values",D={SCHEMA_VERSION:5,MAX_CUR_HEADER_BYTES:80,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},F={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},q="throttling";var B;!function(e){e[e.Error=0]="Error",e[e.Warning=1]="Warning",e[e.Info=2]="Info",e[e.Verbose=3]="Verbose",e[e.Trace=4]="Trace"}(B||(B={}));class U{constructor(e,t,n){this.level=B.Info;const r=e||U.createDefaultLoggerOptions();this.localCallback=r.loggerCallback||(()=>{}),this.piiLoggingEnabled=r.piiLoggingEnabled||!1,this.level="number"==typeof r.logLevel?r.logLevel:B.Info,this.correlationId=r.correlationId||a.EMPTY_STRING,this.packageName=t||a.EMPTY_STRING,this.packageVersion=n||a.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:B.Info}}clone(e,t,n){return new U({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:n||this.correlationId},e,t)}logMessage(e,t){if(t.logLevel>this.level||!this.piiLoggingEnabled&&t.containsPii)return;const n=`[${(new Date).toUTCString()}] : [${t.correlationId||this.correlationId||""}] : ${this.packageName}@${this.packageVersion} : ${B[t.logLevel]} - ${e}`;this.executeCallback(t.logLevel,n,t.containsPii||!1)}executeCallback(e,t,n){this.localCallback&&this.localCallback(e,t,n)}error(e,t){this.logMessage(e,{logLevel:B.Error,containsPii:!1,correlationId:t||a.EMPTY_STRING})}errorPii(e,t){this.logMessage(e,{logLevel:B.Error,containsPii:!0,correlationId:t||a.EMPTY_STRING})}warning(e,t){this.logMessage(e,{logLevel:B.Warning,containsPii:!1,correlationId:t||a.EMPTY_STRING})}warningPii(e,t){this.logMessage(e,{logLevel:B.Warning,containsPii:!0,correlationId:t||a.EMPTY_STRING})}info(e,t){this.logMessage(e,{logLevel:B.Info,containsPii:!1,correlationId:t||a.EMPTY_STRING})}infoPii(e,t){this.logMessage(e,{logLevel:B.Info,containsPii:!0,correlationId:t||a.EMPTY_STRING})}verbose(e,t){this.logMessage(e,{logLevel:B.Verbose,containsPii:!1,correlationId:t||a.EMPTY_STRING})}verbosePii(e,t){this.logMessage(e,{logLevel:B.Verbose,containsPii:!0,correlationId:t||a.EMPTY_STRING})}trace(e,t){this.logMessage(e,{logLevel:B.Trace,containsPii:!1,correlationId:t||a.EMPTY_STRING})}tracePii(e,t){this.logMessage(e,{logLevel:B.Trace,containsPii:!0,correlationId:t||a.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}const H="AAD",K="OIDC",$="none",G="unexpected_error",W="post_request_failed",V={[G]:"Unexpected error in authentication.",[W]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class Q extends Error{constructor(e,t,n){super(t?`${e}: ${t}`:e),Object.setPrototypeOf(this,Q.prototype),this.errorCode=e||a.EMPTY_STRING,this.errorMessage=t||a.EMPTY_STRING,this.subError=n||a.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function Y(e,t){return new Q(e,t?`${V[e]} ${t}`:V[e])}const J="client_info_decoding_error",X="client_info_empty_error",Z="token_parsing_error",ee="null_or_empty_token",te="endpoints_resolution_error",ne="network_error",re="openid_config_error",oe="hash_not_deserialized",ae="invalid_state",ie="state_mismatch",se="state_not_found",ce="nonce_mismatch",le="auth_time_not_found",de="max_age_transpired",ue="multiple_matching_tokens",he="multiple_matching_accounts",pe="multiple_matching_appMetadata",fe="request_cannot_be_made",ge="cannot_remove_empty_scope",me="cannot_append_scopeset",ve="empty_input_scopeset",be="device_code_polling_cancelled",ye="device_code_expired",xe="device_code_unknown_error",we="no_account_in_silent_request",ke="invalid_cache_record",Ce="invalid_cache_environment",Se="no_account_found",je="no_crypto_object",Te="unexpected_credential_type",Ie="invalid_assertion",Ae="invalid_client_credential",Ne="token_refresh_required",Ee="user_timeout_reached",_e="token_claims_cnf_required_for_signedjwt",Pe="authorization_code_missing_from_server_response",Oe="binding_key_not_removed",Re="end_session_endpoint_not_supported",Me="key_id_missing",ze="no_network_connectivity",Le="user_canceled",De="missing_tenant_id_error",Fe="method_not_implemented",qe="nested_app_auth_bridge_disabled",Be={[J]:"The client info could not be parsed/decoded correctly",[X]:"The client info was empty",[Z]:"Token cannot be parsed",[ee]:"The token is null or empty",[te]:"Endpoints cannot be resolved",[ne]:"Network request failed",[re]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[oe]:"The hash parameters could not be deserialized",[ae]:"State was not the expected format",[ie]:"State mismatch error",[se]:"State not found",[ce]:"Nonce mismatch error",[le]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[de]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[ue]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[he]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[pe]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[fe]:"Token request cannot be made without authorization code or refresh token.",[ge]:"Cannot remove null or empty scope from ScopeSet",[me]:"Cannot append ScopeSet",[ve]:"Empty input ScopeSet cannot be processed",[be]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[ye]:"Device code is expired.",[xe]:"Device code stopped polling for unknown reasons.",[we]:"Please pass an account object, silent flow is not supported without account information",[ke]:"Cache record object was null or undefined.",[Ce]:"Invalid environment when attempting to create cache entry",[Se]:"No account found in cache for given key.",[je]:"No crypto object detected.",[Te]:"Unexpected credential type.",[Ie]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[Ae]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Ne]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[Ee]:"User defined timeout for device code polling reached",[_e]:"Cannot generate a POP jwt if the token_claims are not populated",[Pe]:"Server response does not contain an authorization code to proceed",[Oe]:"Could not remove the credential's binding key from storage.",[Re]:"The provided authority does not support logout",[Me]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ze]:"No network connectivity. Check your internet connection.",[Le]:"User cancelled the flow.",[De]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Fe]:"This method has not been implemented",[qe]:"The nested app auth bridge is disabled"};class Ue extends Q{constructor(e,t){super(e,t?`${Be[e]}: ${t}`:Be[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,Ue.prototype)}}function He(e,t){return new Ue(e,t)}const Ke={createNewGuid:()=>{throw He(Fe)},base64Decode:()=>{throw He(Fe)},base64Encode:()=>{throw He(Fe)},base64UrlEncode:()=>{throw He(Fe)},encodeKid:()=>{throw He(Fe)},async getPublicKeyThumbprint(){throw He(Fe)},async removeTokenBindingKey(){throw He(Fe)},async clearKeystore(){throw He(Fe)},async signJwt(){throw He(Fe)},async hashString(){throw He(Fe)}},$e="@azure/msal-common",Ge="14.16.1";function We(e,t){const n=function(e){if(!e)throw He(ee);const t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(e);if(!t||t.length<4)throw He(Z);return t[2]}(e);try{const e=t(n);return JSON.parse(e)}catch(e){throw He(Z)}}function Ve(e,t){if(0===t||Date.now()-3e5>e+t)throw He(de)}function Qe(){return Math.round((new Date).getTime()/1e3)}function Ye(e,t){const n=Number(e)||0;return Qe()+t>n}function Je(e){return[at(e),it(e),st(e),ct(e),lt(e)].join(N).toLowerCase()}function Xe(e,t,n,r,o){return{credentialType:E.ID_TOKEN,homeAccountId:e,environment:t,clientId:r,secret:n,realm:o}}function Ze(e,t,n,r,o,a,i,s,c,l,d,u,h,p,f){const g={homeAccountId:e,credentialType:E.ACCESS_TOKEN,secret:n,cachedAt:Qe().toString(),expiresOn:i.toString(),extendedExpiresOn:s.toString(),environment:t,clientId:r,realm:o,target:a,tokenType:d||F.BEARER};if(u&&(g.userAssertionHash=u),l&&(g.refreshOn=l.toString()),p&&(g.requestedClaims=p,g.requestedClaimsHash=f),g.tokenType?.toLowerCase()!==F.BEARER.toLowerCase())switch(g.credentialType=E.ACCESS_TOKEN_WITH_AUTH_SCHEME,g.tokenType){case F.POP:const e=We(n,c);if(!e?.cnf?.kid)throw He(_e);g.keyId=e.cnf.kid;break;case F.SSH:g.keyId=h}return g}function et(e,t,n,r,o,a,i){const s={credentialType:E.REFRESH_TOKEN,homeAccountId:e,environment:t,clientId:r,secret:n};return a&&(s.userAssertionHash=a),o&&(s.familyId=o),i&&(s.expiresOn=i.toString()),s}function tt(e){return e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("credentialType")&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("secret")}function nt(e){return!!e&&tt(e)&&e.hasOwnProperty("realm")&&e.hasOwnProperty("target")&&(e.credentialType===E.ACCESS_TOKEN||e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME)}function rt(e){return!!e&&tt(e)&&e.hasOwnProperty("realm")&&e.credentialType===E.ID_TOKEN}function ot(e){return!!e&&tt(e)&&e.credentialType===E.REFRESH_TOKEN}function at(e){return[e.homeAccountId,e.environment].join(N).toLowerCase()}function it(e){const t=e.credentialType===E.REFRESH_TOKEN&&e.familyId||e.clientId;return[e.credentialType,t,e.realm||""].join(N).toLowerCase()}function st(e){return(e.target||"").toLowerCase()}function ct(e){return(e.requestedClaimsHash||"").toLowerCase()}function lt(e){return e.tokenType&&e.tokenType.toLowerCase()!==F.BEARER.toLowerCase()?e.tokenType.toLowerCase():""}function dt(){return Qe()+86400}function ut(e,t,n){e.authorization_endpoint=t.authorization_endpoint,e.token_endpoint=t.token_endpoint,e.end_session_endpoint=t.end_session_endpoint,e.issuer=t.issuer,e.endpointsFromNetwork=n,e.jwks_uri=t.jwks_uri}function ht(e,t,n){e.aliases=t.aliases,e.preferred_cache=t.preferred_cache,e.preferred_network=t.preferred_network,e.aliasesFromNetwork=n}function pt(e){return e.expiresAt<=Qe()}const ft="redirect_uri_empty",gt="claims_request_parsing_error",mt="authority_uri_insecure",vt="url_parse_error",bt="empty_url_error",yt="empty_input_scopes_error",xt="invalid_prompt_value",wt="invalid_claims",kt="token_request_empty",Ct="logout_request_empty",St="invalid_code_challenge_method",jt="pkce_params_missing",Tt="invalid_cloud_discovery_metadata",It="invalid_authority_metadata",At="untrusted_authority",Nt="missing_ssh_jwk",Et="missing_ssh_kid",_t="missing_nonce_authentication_header",Pt="invalid_authentication_header",Ot="cannot_set_OIDCOptions",Rt="cannot_allow_native_broker",Mt="authority_mismatch",zt={[ft]:"A redirect URI is required for all calls, and none has been set.",[gt]:"Could not parse the given claims request object.",[mt]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[vt]:"URL could not be parsed into appropriate segments.",[bt]:"URL was empty or null.",[yt]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[xt]:"Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",[wt]:"Given claims parameter must be a stringified JSON object.",[kt]:"Token request was empty and not found in cache.",[Ct]:"The logout request was null or undefined.",[St]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[jt]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[Tt]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[It]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[At]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[Nt]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[Et]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[_t]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[Pt]:"Invalid authentication header provided",[Ot]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[Rt]:"Cannot set allowNativeBroker parameter to true when not in AAD protocol mode.",[Mt]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."};class Lt extends Q{constructor(e){super(e,zt[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,Lt.prototype)}}function Dt(e){return new Lt(e)}class Ft{static isEmptyObj(e){if(e)try{const t=JSON.parse(e);return 0===Object.keys(t).length}catch(e){}return!0}static startsWith(e,t){return 0===e.indexOf(t)}static endsWith(e,t){return e.length>=t.length&&e.lastIndexOf(t)===e.length-t.length}static queryStringToObject(e){const t={},n=e.split("&"),r=e=>decodeURIComponent(e.replace(/\+/g," "));return n.forEach(e=>{if(e.trim()){const[n,o]=e.split(/=(.+)/g,2);n&&o&&(t[r(n)]=r(o))}}),t}static trimArrayEntries(e){return e.map(e=>e.trim())}static removeEmptyStringsFromArray(e){return e.filter(e=>!!e)}static jsonParseHelper(e){try{return JSON.parse(e)}catch(e){return null}}static matchPattern(e,t){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(t)}}class qt{constructor(e){const t=e?Ft.trimArrayEntries([...e]):[],n=t?Ft.removeEmptyStringsFromArray(t):[];this.validateInputScopes(n),this.scopes=new Set,n.forEach(e=>this.scopes.add(e))}static fromString(e){const t=(e||a.EMPTY_STRING).split(" ");return new qt(t)}static createSearchScopes(e){const t=new qt(e);return t.containsOnlyOIDCScopes()?t.removeScope(a.OFFLINE_ACCESS_SCOPE):t.removeOIDCScopes(),t}validateInputScopes(e){if(!e||e.length<1)throw Dt(yt)}containsScope(e){const t=this.printScopesLowerCase().split(" "),n=new qt(t);return!!e&&n.scopes.has(e.toLowerCase())}containsScopeSet(e){return!(!e||e.scopes.size<=0)&&this.scopes.size>=e.scopes.size&&e.asArray().every(e=>this.containsScope(e))}containsOnlyOIDCScopes(){let e=0;return s.forEach(t=>{this.containsScope(t)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(e=>this.appendScope(e))}catch(e){throw He(me)}}removeScope(e){if(!e)throw He(ge);this.scopes.delete(e.trim())}removeOIDCScopes(){s.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw He(ve);const t=new Set;return e.scopes.forEach(e=>t.add(e.toLowerCase())),this.scopes.forEach(e=>t.add(e.toLowerCase())),t}intersectingScopeSets(e){if(!e)throw He(ve);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const t=this.unionScopeSets(e),n=e.getScopeCount(),r=this.getScopeCount();return t.size<r+n}getScopeCount(){return this.scopes.size}asArray(){const e=[];return this.scopes.forEach(t=>e.push(t)),e}printScopes(){return this.scopes?this.asArray().join(" "):a.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}function Bt(e,t){if(!e)throw He(X);try{const n=t(e);return JSON.parse(n)}catch(e){throw He(J)}}function Ut(e){if(!e)throw He(J);const t=e.split(".",2);return{uid:t[0],utid:t.length<2?a.EMPTY_STRING:t[1]}}function Ht(e,t){return!!e&&!!t&&e===t.split(".")[1]}function Kt(e,t,n,r){if(r){const{oid:t,sub:n,tid:o,name:a,tfp:i,acr:s}=r,c=o||i||s||"";return{tenantId:c,localAccountId:t||n||"",name:a,isHomeTenant:Ht(c,e)}}return{tenantId:n,localAccountId:t,isHomeTenant:Ht(n,e)}}function $t(e,t,n,r){let o=e;if(t){const{isHomeTenant:n,...r}=t;o={...e,...r}}if(n){const{isHomeTenant:t,...a}=Kt(e.homeAccountId,e.localAccountId,e.tenantId,n);return o={...o,...a,idTokenClaims:n,idToken:r},o}return o}function Gt(e){return e&&(e.tid||e.tfp||e.acr)||null}class Wt{generateAccountId(){return[this.homeAccountId,this.environment].join(N).toLowerCase()}generateAccountKey(){return Wt.generateAccountCacheKey({homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId})}getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static generateAccountCacheKey(e){const t=e.homeAccountId.split(".")[1];return[e.homeAccountId,e.environment||"",t||e.tenantId||""].join(N).toLowerCase()}static createAccount(e,t,n){const r=new Wt;let o;1===t.authorityType?r.authorityType="ADFS":t.protocolMode===H?r.authorityType="MSSTS":r.authorityType=A,e.clientInfo&&n&&(o=Bt(e.clientInfo,n)),r.clientInfo=e.clientInfo,r.homeAccountId=e.homeAccountId,r.nativeAccountId=e.nativeAccountId;const a=e.environment||t&&t.getPreferredCache();if(!a)throw He(Ce);r.environment=a,r.realm=o?.utid||Gt(e.idTokenClaims)||"",r.localAccountId=o?.uid||e.idTokenClaims?.oid||e.idTokenClaims?.sub||"";const i=e.idTokenClaims?.preferred_username||e.idTokenClaims?.upn,s=e.idTokenClaims?.emails?e.idTokenClaims.emails[0]:null;if(r.username=i||s||"",r.name=e.idTokenClaims?.name||"",r.cloudGraphHostName=e.cloudGraphHostName,r.msGraphHost=e.msGraphHost,e.tenantProfiles)r.tenantProfiles=e.tenantProfiles;else{const t=Kt(e.homeAccountId,r.localAccountId,r.realm,e.idTokenClaims);r.tenantProfiles=[t]}return r}static createFromAccountInfo(e,t,n){const r=new Wt;return r.authorityType=e.authorityType||A,r.homeAccountId=e.homeAccountId,r.localAccountId=e.localAccountId,r.nativeAccountId=e.nativeAccountId,r.realm=e.tenantId,r.environment=e.environment,r.username=e.username,r.name=e.name,r.cloudGraphHostName=t,r.msGraphHost=n,r.tenantProfiles=Array.from(e.tenantProfiles?.values()||[]),r}static generateHomeAccountId(e,t,n,r,o){if(1!==t&&2!==t){if(e)try{const t=Bt(e,r.base64Decode);if(t.uid&&t.utid)return`${t.uid}.${t.utid}`}catch(e){}n.warning("No client info in response")}return o?.sub||""}static isAccountEntity(e){return!!e&&e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType")}static accountInfoIsEqual(e,t,n){if(!e||!t)return!1;let r=!0;if(n){const n=e.idTokenClaims||{},o=t.idTokenClaims||{};r=n.iat===o.iat&&n.nonce===o.nonce}return e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username&&e.tenantId===t.tenantId&&e.environment===t.environment&&e.nativeAccountId===t.nativeAccountId&&r}}function Vt(e){return e.startsWith("#/")?e.substring(2):e.startsWith("#")||e.startsWith("?")?e.substring(1):e}function Qt(e){if(!e||e.indexOf("=")<0)return null;try{const t=Vt(e),n=Object.fromEntries(new URLSearchParams(t));if(n.code||n.error||n.error_description||n.state)return n}catch(e){throw He(oe)}return null}class Yt{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw Dt(bt);e.includes("#")||(this._urlString=Yt.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let t=e.toLowerCase();return Ft.endsWith(t,"?")?t=t.slice(0,-1):Ft.endsWith(t,"?/")&&(t=t.slice(0,-2)),Ft.endsWith(t,"/")||(t+="/"),t}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch(e){throw Dt(vt)}if(!e.HostNameAndPort||!e.PathSegments)throw Dt(vt);if(!e.Protocol||"https:"!==e.Protocol.toLowerCase())throw Dt(mt)}static appendQueryString(e,t){return t?e.indexOf("?")<0?`${e}?${t}`:`${e}&${t}`:e}static removeHashFromUrl(e){return Yt.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const t=this.getUrlComponents(),n=t.PathSegments;return!e||0===n.length||n[0]!==x&&n[0]!==w||(n[0]=e),Yt.constructAuthorityUriFromObject(t)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),t=this.urlString.match(e);if(!t)throw Dt(vt);const n={Protocol:t[1],HostNameAndPort:t[4],AbsolutePath:t[5],QueryString:t[7]};let r=n.AbsolutePath.split("/");return r=r.filter(e=>e&&e.length>0),n.PathSegments=r,n.QueryString&&n.QueryString.endsWith("/")&&(n.QueryString=n.QueryString.substring(0,n.QueryString.length-1)),n}static getDomainFromUrl(e){const t=RegExp("^([^:/?#]+://)?([^/?#]*)"),n=e.match(t);if(!n)throw Dt(vt);return n[2]}static getAbsoluteUrl(e,t){if(e[0]===a.FORWARD_SLASH){const n=new Yt(t).getUrlComponents();return n.Protocol+"//"+n.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new Yt(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Qt(e)}}const Jt={"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},Xt={tenant_discovery_endpoint:"https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]},Zt=new Set;function en(e,t,n,r){if(r?.trace(`getAliasesFromMetadata called with source: ${n}`),e&&t){const o=tn(t,e);if(o)return r?.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),o.aliases;r?.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function tn(e,t){for(let n=0;n<e.length;n++){const r=e[n];if(r.aliases.includes(t))return r}return null}Xt.metadata.forEach(e=>{e.aliases.forEach(e=>{Zt.add(e)})});const nn="cache_quota_exceeded",rn="cache_error_unknown",on={[nn]:"Exceeded cache storage capacity.",[rn]:"Unexpected error occurred when using cache storage."};class an extends Error{constructor(e,t){const n=t||(on[e]?on[e]:on[rn]);super(`${e}: ${n}`),Object.setPrototypeOf(this,an.prototype),this.name="CacheError",this.errorCode=e,this.errorMessage=n}}function sn(e){return e instanceof Error?"QuotaExceededError"===e.name||"NS_ERROR_DOM_QUOTA_REACHED"===e.name||e.message.includes("exceeded the quota")?new an(nn):new an(e.name,e.message):new an(rn)}class cn{constructor(e,t,n,r){this.clientId=e,this.cryptoImpl=t,this.commonLogger=n.clone($e,Ge),this.staticAuthorityOptions=r}getAllAccounts(e,t){return this.buildTenantProfiles(this.getAccountsFilteredBy(t||{},e),e,t)}getAccountInfoFilteredBy(e,t){const n=this.getAllAccounts(t,e);return n.length>1?n.sort(e=>e.idTokenClaims?-1:1)[0]:1===n.length?n[0]:null}getBaseAccountInfo(e,t){const n=this.getAccountsFilteredBy(e,t);return n.length>0?n[0].getAccountInfo():null}buildTenantProfiles(e,t,n){return e.flatMap(e=>this.getTenantProfilesFromAccountEntity(e,t,n?.tenantId,n))}getTenantedAccountInfoByFilter(e,t,n,r,o){let a,i=null;if(o&&!this.tenantProfileMatchesFilter(n,o))return null;const s=this.getIdToken(e,r,t,n.tenantId);return s&&(a=We(s.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(a,o))?null:(i=$t(e,n,a,s?.secret),i)}getTenantProfilesFromAccountEntity(e,t,n,r){const o=e.getAccountInfo();let a=o.tenantProfiles||new Map;const i=this.getTokenKeys();if(n){const e=a.get(n);if(!e)return[];a=new Map([[n,e]])}const s=[];return a.forEach(e=>{const n=this.getTenantedAccountInfoByFilter(o,i,e,t,r);n&&s.push(n)}),s}tenantProfileMatchesFilter(e,t){return!(t.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,t.localAccountId)||t.name&&e.name!==t.name||void 0!==t.isHomeTenant&&e.isHomeTenant!==t.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,t){if(t){if(t.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,t.localAccountId))return!1;if(t.loginHint&&!this.matchLoginHintFromTokenClaims(e,t.loginHint))return!1;if(t.username&&!this.matchUsername(e.preferred_username,t.username))return!1;if(t.name&&!this.matchName(e,t.name))return!1;if(t.sid&&!this.matchSid(e,t.sid))return!1}return!0}async saveCacheRecord(e,t,n){if(!e)throw He(ke);try{e.account&&this.setAccount(e.account,t),e.idToken&&!1!==n?.idToken&&this.setIdTokenCredential(e.idToken,t),e.accessToken&&!1!==n?.accessToken&&await this.saveAccessToken(e.accessToken,t),e.refreshToken&&!1!==n?.refreshToken&&this.setRefreshTokenCredential(e.refreshToken,t),e.appMetadata&&this.setAppMetadata(e.appMetadata,t)}catch(e){throw this.commonLogger?.error("CacheManager.saveCacheRecord: failed"),e instanceof Q?e:sn(e)}}async saveAccessToken(e,t){const n={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},r=this.getTokenKeys(),o=qt.fromString(e.target);r.accessToken.forEach(e=>{if(!this.accessTokenKeyMatchesFilter(e,n,!1))return;const r=this.getAccessTokenCredential(e,t);r&&this.credentialMatchesFilter(r,n)&&qt.fromString(r.target).intersectingScopeSets(o)&&this.removeAccessToken(e,t)}),this.setAccessTokenCredential(e,t)}getAccountsFilteredBy(e,t){const n=this.getAccountKeys(),r=[];return n.forEach(n=>{if(!this.isAccountKey(n,e.homeAccountId))return;const o=this.getAccount(n,t,this.commonLogger);if(!o)return;if(e.homeAccountId&&!this.matchHomeAccountId(o,e.homeAccountId))return;if(e.username&&!this.matchUsername(o.username,e.username))return;if(e.environment&&!this.matchEnvironment(o,e.environment))return;if(e.realm&&!this.matchRealm(o,e.realm))return;if(e.nativeAccountId&&!this.matchNativeAccountId(o,e.nativeAccountId))return;if(e.authorityType&&!this.matchAuthorityType(o,e.authorityType))return;const a={localAccountId:e?.localAccountId,name:e?.name},i=o.tenantProfiles?.filter(e=>this.tenantProfileMatchesFilter(e,a));i&&0===i.length||r.push(o)}),r}isAccountKey(e,t,n){return!(e.split(N).length<3||t&&!e.toLowerCase().includes(t.toLowerCase())||n&&!e.toLowerCase().includes(n.toLowerCase()))}isCredentialKey(e){if(e.split(N).length<6)return!1;const t=e.toLowerCase();if(-1===t.indexOf(E.ID_TOKEN.toLowerCase())&&-1===t.indexOf(E.ACCESS_TOKEN.toLowerCase())&&-1===t.indexOf(E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())&&-1===t.indexOf(E.REFRESH_TOKEN.toLowerCase()))return!1;if(t.indexOf(E.REFRESH_TOKEN.toLowerCase())>-1){const e=`${E.REFRESH_TOKEN}${N}${this.clientId}${N}`,n=`${E.REFRESH_TOKEN}${N}${P}${N}`;if(-1===t.indexOf(e.toLowerCase())&&-1===t.indexOf(n.toLowerCase()))return!1}else if(-1===t.indexOf(this.clientId.toLowerCase()))return!1;return!0}credentialMatchesFilter(e,t){if(t.clientId&&!this.matchClientId(e,t.clientId))return!1;if(t.userAssertionHash&&!this.matchUserAssertionHash(e,t.userAssertionHash))return!1;if("string"==typeof t.homeAccountId&&!this.matchHomeAccountId(e,t.homeAccountId))return!1;if(t.environment&&!this.matchEnvironment(e,t.environment))return!1;if(t.realm&&!this.matchRealm(e,t.realm))return!1;if(t.credentialType&&!this.matchCredentialType(e,t.credentialType))return!1;if(t.familyId&&!this.matchFamilyId(e,t.familyId))return!1;if(t.target&&!this.matchTarget(e,t.target))return!1;if((t.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==t.requestedClaimsHash)return!1;if(e.credentialType===E.ACCESS_TOKEN_WITH_AUTH_SCHEME){if(t.tokenType&&!this.matchTokenType(e,t.tokenType))return!1;if(t.tokenType===F.SSH&&t.keyId&&!this.matchKeyId(e,t.keyId))return!1}return!0}getAppMetadataFilteredBy(e){const t=this.getKeys(),n={};return t.forEach(t=>{if(!this.isAppMetadata(t))return;const r=this.getAppMetadata(t);r&&(e.environment&&!this.matchEnvironment(r,e.environment)||e.clientId&&!this.matchClientId(r,e.clientId)||(n[t]=r))}),n}getAuthorityMetadataByAlias(e){const t=this.getAuthorityMetadataKeys();let n=null;return t.forEach(t=>{if(!this.isAuthorityMetadata(t)||-1===t.indexOf(this.clientId))return;const r=this.getAuthorityMetadata(t);r&&-1!==r.aliases.indexOf(e)&&(n=r)}),n}async removeAllAccounts(e){const t=this.getAccountKeys(),n=[];t.forEach(t=>{n.push(this.removeAccount(t,e))}),await Promise.all(n)}async removeAccount(e,t){const n=this.getAccount(e,t,this.commonLogger);n&&(await this.removeAccountContext(n,t),this.removeItem(e,t))}async removeAccountContext(e,t){const n=this.getTokenKeys(),r=e.generateAccountId();n.idToken.forEach(e=>{0===e.indexOf(r)&&this.removeIdToken(e,t)}),n.accessToken.forEach(e=>{0===e.indexOf(r)&&this.removeAccessToken(e,t)}),n.refreshToken.forEach(e=>{0===e.indexOf(r)&&this.removeRefreshToken(e,t)}),this.getKeys().forEach(e=>{e.includes(r)&&this.removeItem(e,t)})}updateOutdatedCachedAccount(e,t,n,r){if(t&&t.isSingleTenant()){this.commonLogger?.verbose("updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity");const o=this.getAccountKeys().filter(e=>e.startsWith(t.homeAccountId)),a=[];o.forEach(e=>{const t=this.getCachedAccountEntity(e,n);t&&a.push(t)});const i=a.find(e=>Ht(e.realm,e.homeAccountId))||a[0];i.tenantProfiles=a.map(e=>({tenantId:e.realm,localAccountId:e.localAccountId,name:e.name,isHomeTenant:Ht(e.realm,e.homeAccountId)}));const s=cn.toObject(new Wt,{...i}),c=s.generateAccountKey();return o.forEach(t=>{t!==c&&this.removeOutdatedAccount(e,n)}),this.setAccount(s,n),r?.verbose("Updated an outdated account entity in the cache"),s}return t}removeAccessToken(e,t){const n=this.getAccessTokenCredential(e,t);if(this.removeItem(e,t),!n||n.credentialType.toLowerCase()!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||n.tokenType!==F.POP)return;const r=n.keyId;r&&this.cryptoImpl.removeTokenBindingKey(r).catch(()=>{this.commonLogger.error("Binding key could not be removed")})}removeAppMetadata(e){return this.getKeys().forEach(t=>{this.isAppMetadata(t)&&this.removeItem(t,e)}),!0}readAccountFromCache(e,t){const n=Wt.generateAccountCacheKey(e);return this.getAccount(n,t,this.commonLogger)}getIdToken(e,t,n,r,o){this.commonLogger.trace("CacheManager - getIdToken called");const a={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.ID_TOKEN,clientId:this.clientId,realm:r},i=this.getIdTokensByFilter(a,t,n),s=i.size;if(s<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(s>1){let n=i;if(!r){const t=new Map;i.forEach((n,r)=>{n.realm===e.tenantId&&t.set(r,n)});const r=t.size;if(r<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),i.values().next().value;if(1===r)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),t.values().next().value;n=t}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),n.forEach((e,n)=>{this.removeIdToken(n,t)}),o&&t&&o.addFields({multiMatchedID:i.size},t),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),i.values().next().value}getIdTokensByFilter(e,t,n){const r=n&&n.idToken||this.getTokenKeys().idToken,o=new Map;return r.forEach(n=>{if(!this.idTokenKeyMatchesFilter(n,{clientId:this.clientId,...e}))return;const r=this.getIdTokenCredential(n,t);r&&this.credentialMatchesFilter(r,e)&&o.set(n,r)}),o}idTokenKeyMatchesFilter(e,t){const n=e.toLowerCase();return!(t.clientId&&-1===n.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===n.indexOf(t.homeAccountId.toLowerCase()))}removeIdToken(e,t){this.removeItem(e,t)}removeRefreshToken(e,t){this.removeItem(e,t)}getAccessToken(e,t,n,r,o){this.commonLogger.trace("CacheManager - getAccessToken called");const a=qt.createSearchScopes(t.scopes),i=t.authenticationScheme||F.BEARER,s=i&&i.toLowerCase()!==F.BEARER.toLowerCase()?E.ACCESS_TOKEN_WITH_AUTH_SCHEME:E.ACCESS_TOKEN,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:s,clientId:this.clientId,realm:r||e.tenantId,target:a,tokenType:i,keyId:t.sshKid,requestedClaimsHash:t.requestedClaimsHash},l=n&&n.accessToken||this.getTokenKeys().accessToken,d=[];l.forEach(e=>{if(this.accessTokenKeyMatchesFilter(e,c,!0)){const n=this.getAccessTokenCredential(e,t.correlationId);n&&this.credentialMatchesFilter(n,c)&&d.push(n)}});const u=d.length;return u<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found"),null):u>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them"),d.forEach(e=>{this.removeAccessToken(Je(e),t.correlationId)}),o&&t.correlationId&&o.addFields({multiMatchedAT:d.length},t.correlationId),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token"),d[0])}accessTokenKeyMatchesFilter(e,t,n){const r=e.toLowerCase();if(t.clientId&&-1===r.indexOf(t.clientId.toLowerCase()))return!1;if(t.homeAccountId&&-1===r.indexOf(t.homeAccountId.toLowerCase()))return!1;if(t.realm&&-1===r.indexOf(t.realm.toLowerCase()))return!1;if(t.requestedClaimsHash&&-1===r.indexOf(t.requestedClaimsHash.toLowerCase()))return!1;if(t.target){const e=t.target.asArray();for(let t=0;t<e.length;t++){if(n&&!r.includes(e[t].toLowerCase()))return!1;if(!n&&r.includes(e[t].toLowerCase()))return!0}}return!0}getAccessTokensByFilter(e,t){const n=this.getTokenKeys(),r=[];return n.accessToken.forEach(n=>{if(!this.accessTokenKeyMatchesFilter(n,e,!0))return;const o=this.getAccessTokenCredential(n,t);o&&this.credentialMatchesFilter(o,e)&&r.push(o)}),r}getRefreshToken(e,t,n,r,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const a=t?P:void 0,i={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:E.REFRESH_TOKEN,clientId:this.clientId,familyId:a},s=r&&r.refreshToken||this.getTokenKeys().refreshToken,c=[];s.forEach(e=>{if(this.refreshTokenKeyMatchesFilter(e,i)){const t=this.getRefreshTokenCredential(e,n);t&&this.credentialMatchesFilter(t,i)&&c.push(t)}});const l=c.length;return l<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(l>1&&o&&n&&o.addFields({multiMatchedRT:l},n),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),c[0])}refreshTokenKeyMatchesFilter(e,t){const n=e.toLowerCase();return!(t.familyId&&-1===n.indexOf(t.familyId.toLowerCase())||!t.familyId&&t.clientId&&-1===n.indexOf(t.clientId.toLowerCase())||t.homeAccountId&&-1===n.indexOf(t.homeAccountId.toLowerCase()))}readAppMetadataFromCache(e){const t={environment:e,clientId:this.clientId},n=this.getAppMetadataFilteredBy(t),r=Object.keys(n).map(e=>n[e]),o=r.length;if(o<1)return null;if(o>1)throw He(pe);return r[0]}isAppMetadataFOCI(e){const t=this.readAppMetadataFromCache(e);return!(!t||t.familyId!==P)}matchHomeAccountId(e,t){return!("string"!=typeof e.homeAccountId||t!==e.homeAccountId)}matchLocalAccountIdFromTokenClaims(e,t){return t===(e.oid||e.sub)}matchLocalAccountIdFromTenantProfile(e,t){return e.localAccountId===t}matchName(e,t){return!(t.toLowerCase()!==e.name?.toLowerCase())}matchUsername(e,t){return!(!e||"string"!=typeof e||t?.toLowerCase()!==e.toLowerCase())}matchUserAssertionHash(e,t){return!(!e.userAssertionHash||t!==e.userAssertionHash)}matchEnvironment(e,t){if(this.staticAuthorityOptions){const n=function(e,t){let n;const r=e.canonicalAuthority;if(r){const o=new Yt(r).getUrlComponents().HostNameAndPort;n=en(o,e.cloudDiscoveryMetadata?.metadata,R,t)||en(o,Xt.metadata,L,t)||e.knownAuthorities}return n||[]}(this.staticAuthorityOptions,this.commonLogger);if(n.includes(t)&&n.includes(e.environment))return!0}const n=this.getAuthorityMetadataByAlias(t);return!!(n&&n.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,t){return e.credentialType&&t.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,t){return!(!e.clientId||t!==e.clientId)}matchFamilyId(e,t){return!(!e.familyId||t!==e.familyId)}matchRealm(e,t){return!(e.realm?.toLowerCase()!==t.toLowerCase())}matchNativeAccountId(e,t){return!(!e.nativeAccountId||t!==e.nativeAccountId)}matchLoginHintFromTokenClaims(e,t){return e.login_hint===t||e.preferred_username===t||e.upn===t}matchSid(e,t){return e.sid===t}matchAuthorityType(e,t){return!(!e.authorityType||t.toLowerCase()!==e.authorityType.toLowerCase())}matchTarget(e,t){return!(e.credentialType!==E.ACCESS_TOKEN&&e.credentialType!==E.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target)&&qt.fromString(e.target).containsScopeSet(t)}matchTokenType(e,t){return!(!e.tokenType||e.tokenType!==t)}matchKeyId(e,t){return!(!e.keyId||e.keyId!==t)}isAppMetadata(e){return-1!==e.indexOf(_)}isAuthorityMetadata(e){return-1!==e.indexOf(O)}generateAuthorityMetadataCacheKey(e){return`${O}-${this.clientId}-${e}`}static toObject(e,t){for(const n in t)e[n]=t[n];return e}}class ln extends cn{setAccount(){throw He(Fe)}getAccount(){throw He(Fe)}getCachedAccountEntity(){throw He(Fe)}setIdTokenCredential(){throw He(Fe)}getIdTokenCredential(){throw He(Fe)}setAccessTokenCredential(){throw He(Fe)}getAccessTokenCredential(){throw He(Fe)}setRefreshTokenCredential(){throw He(Fe)}getRefreshTokenCredential(){throw He(Fe)}setAppMetadata(){throw He(Fe)}getAppMetadata(){throw He(Fe)}setServerTelemetry(){throw He(Fe)}getServerTelemetry(){throw He(Fe)}setAuthorityMetadata(){throw He(Fe)}getAuthorityMetadata(){throw He(Fe)}getAuthorityMetadataKeys(){throw He(Fe)}setThrottlingCache(){throw He(Fe)}getThrottlingCache(){throw He(Fe)}removeItem(){throw He(Fe)}getKeys(){throw He(Fe)}getAccountKeys(){throw He(Fe)}getTokenKeys(){throw He(Fe)}updateCredentialCacheKey(){throw He(Fe)}removeOutdatedAccount(){throw He(Fe)}}const dn={tokenRenewalOffsetSeconds:300,preventCorsPreflight:!1},un={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:B.Info,correlationId:a.EMPTY_STRING},hn={claimsBasedCachingEnabled:!1},pn={async sendGetRequestAsync(){throw He(Fe)},async sendPostRequestAsync(){throw He(Fe)}},fn={sku:a.SKU,version:Ge,cpu:a.EMPTY_STRING,os:a.EMPTY_STRING},gn={clientSecret:a.EMPTY_STRING,clientAssertion:void 0},mn={azureCloudInstance:$,tenant:`${a.DEFAULT_COMMON_TENANT}`},vn={application:{appName:"",appVersion:""}};function bn(e){return e.authOptions.authority.options.protocolMode===K}const yn={sendGetRequestAsync:()=>Promise.reject(He(Fe)),sendPostRequestAsync:()=>Promise.reject(He(Fe))},xn="acquireTokenByCode",wn="acquireTokenByRefreshToken",kn="acquireTokenSilent",Cn="acquireTokenSilentAsync",Sn="acquireTokenPopup",jn="acquireTokenRedirect",Tn="cryptoOptsGetPublicKeyThumbprint",In="cryptoOptsSignJwt",An="silentCacheClientAcquireToken",Nn="silentIframeClientAcquireToken",En="silentRefreshClientAcquireToken",_n="ssoSilent",Pn="standardInteractionClientGetDiscoveredAuthority",On="fetchAccountIdWithNativeBroker",Rn="nativeInteractionClientAcquireToken",Mn="networkClientSendPostRequestAsync",zn="refreshTokenClientExecutePostToTokenEndpoint",Ln="authorizationCodeClientExecutePostToTokenEndpoint",Dn="refreshTokenClientExecuteTokenRequest",Fn="refreshTokenClientAcquireToken",qn="refreshTokenClientAcquireTokenWithCachedRefreshToken",Bn="refreshTokenClientAcquireTokenByRefreshToken",Un="refreshTokenClientCreateTokenRequestBody",Hn="acquireTokenFromCache",Kn="silentFlowClientAcquireCachedToken",$n="silentFlowClientGenerateResultFromCacheRecord",Gn="acquireTokenBySilentIframe",Wn="initializeBaseRequest",Vn="initializeSilentRequest",Qn="initializeClientApplication",Yn="silentIframeClientTokenHelper",Jn="silentHandlerInitiateAuthRequest",Xn="silentHandlerMonitorIframeForHash",Zn="silentHandlerLoadFrame",er="silentHandlerLoadFrameSync",tr="standardInteractionClientCreateAuthCodeClient",nr="standardInteractionClientGetClientConfiguration",rr="standardInteractionClientInitializeAuthorizationRequest",or="standardInteractionClientInitializeAuthorizationCodeRequest",ar="getAuthCodeUrl",ir="handleCodeResponseFromServer",sr="handleCodeResponse",cr="updateTokenEndpointAuthority",lr="authClientAcquireToken",dr="authClientExecuteTokenRequest",ur="authClientCreateTokenRequestBody",hr="authClientCreateQueryString",pr="popTokenGenerateCnf",fr="popTokenGenerateKid",gr="handleServerTokenResponse",mr="deserializeResponse",vr="authorityFactoryCreateDiscoveredInstance",br="authorityResolveEndpointsAsync",yr="authorityGetCloudDiscoveryMetadataFromNetwork",xr="authorityUpdateCloudDiscoveryMetadata",wr="authorityGetEndpointMetadataFromNetwork",kr="authorityUpdateEndpointMetadata",Cr="authorityUpdateMetadataWithRegionalInformation",Sr="regionDiscoveryDetectRegion",jr="regionDiscoveryGetRegionFromIMDS",Tr="regionDiscoveryGetCurrentVersion",Ir="acquireTokenByCodeAsync",Ar="handleRedirectPromise",Nr="handleNativeRedirectPromise",Er="nativeMessageHandlerHandshake",_r="removeHiddenIframe",Pr="clearTokensAndKeysWithClaims",Or="cacheManagerGetRefreshToken",Rr="generatePkceCodes",Mr="generateCodeVerifier",zr="generateCodeChallengeFromVerifier",Lr="sha256Digest",Dr="getRandomValues",Fr=(new Map([[xn,"ATByCode"],[wn,"ATByRT"],[kn,"ATS"],[Cn,"ATSAsync"],[Sn,"ATPopup"],[jn,"ATRedirect"],[Tn,"CryptoGetPKThumb"],[In,"CryptoSignJwt"],[An,"SltCacheClientAT"],[Nn,"SltIframeClientAT"],[En,"SltRClientAT"],[_n,"SsoSlt"],[Pn,"StdIntClientGetDiscAuth"],[On,"FetchAccIdWithNtvBroker"],[Rn,"NtvIntClientAT"],["baseClientCreateTokenRequestHeaders","BaseClientCreateTReqHead"],[Mn,"NetClientSendPost"],[zn,"RTClientExecPost"],[Ln,"AuthCodeClientExecPost"],["brokerHandshake","BrokerHandshake"],["acquireTokenByRefreshTokenInBroker","ATByRTInBroker"],["acquireTokenByBroker","ATByBroker"],[Dn,"RTClientExecTReq"],[Fn,"RTClientAT"],[qn,"RTClientATWithCachedRT"],[Bn,"RTClientATByRT"],[Un,"RTClientCreateTReqBody"],[Hn,"ATFromCache"],[Kn,"SltFlowClientATCached"],[$n,"SltFlowClientGenResFromCache"],[Gn,"ATBySltIframe"],[Wn,"InitBaseReq"],[Vn,"InitSltReq"],[Qn,"InitClientApplication"],[Yn,"SIClientTHelper"],[Jn,"SHandlerInitAuthReq"],[Xn,"SltHandlerMonitorIframeForHash"],[Zn,"SHandlerLoadFrame"],[er,"SHandlerLoadFrameSync"],[tr,"StdIntClientCreateAuthCodeClient"],[nr,"StdIntClientGetClientConf"],[rr,"StdIntClientInitAuthReq"],[or,"StdIntClientInitAuthCodeReq"],[ar,"GetAuthCodeUrl"],[ir,"HandleCodeResFromServer"],[sr,"HandleCodeResp"],[cr,"UpdTEndpointAuth"],[lr,"AuthClientAT"],[dr,"AuthClientExecTReq"],[ur,"AuthClientCreateTReqBody"],[hr,"AuthClientCreateQueryStr"],[pr,"PopTGenCnf"],[fr,"PopTGenKid"],[gr,"HandleServerTRes"],[mr,"DeserializeRes"],[vr,"AuthFactCreateDiscInst"],[br,"AuthResolveEndpointsAsync"],["authorityResolveEndpointsFromLocalSources","AuthResolveEndpointsFromLocal"],[yr,"AuthGetCDMetaFromNet"],[xr,"AuthUpdCDMeta"],[wr,"AuthUpdCDMetaFromNet"],[kr,"AuthUpdEndpointMeta"],[Cr,"AuthUpdMetaWithRegInfo"],[Sr,"RegDiscDetectReg"],[jr,"RegDiscGetRegFromIMDS"],[Tr,"RegDiscGetCurrentVer"],[Ir,"ATByCodeAsync"],["getEndpointMetadataFromNetwork","GetEndpointMetaFromNet"],["getCloudDiscoveryMetadataFromNetworkMeasurement","GetCDMetaFromNet"],[Ar,"HandleRedirectPromise"],[Nr,"HandleNtvRedirectPromise"],["updateCloudDiscoveryMetadataMeasurement","UpdateCDMeta"],["usernamePasswordClientAcquireToken","UserPassClientAT"],[Er,"NtvMsgHandlerHandshake"],["nativeGenerateAuthResult","NtvGenAuthRes"],[_r,"RemoveHiddenIframe"],[Pr,"ClearTAndKeysWithClaims"],[Or,"CacheManagerGetRT"],[Rr,"GenPkceCodes"],[Mr,"GenCodeVerifier"],[zr,"GenCodeChallengeFromVerifier"],[Lr,"Sha256Digest"],[Dr,"GetRandomValues"]]),1);new Set(["accessTokenSize","durationMs","idTokenSize","matsSilentStatus","matsHttpStatus","refreshTokenSize","queuedTimeMs","startTimeMs","status","multiMatchedAT","multiMatchedID","multiMatchedRT"]);class qr{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class Br{generateId(){return"callback-id"}startMeasurement(e,t){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:Fr,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:t||""},measurement:new qr}}startPerformanceMeasurement(){return new qr}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}const Ur="invalid_grant",Hr="msal",Kr="msal.js.browser",$r="53ee284d-920a-4b59-9d30-a60315b26836",Gr="ppnbnpeolgkicgegkbkbjmhlideopiji",Wr="Handshake",Vr="GetToken",Qr="localStorage",Yr="sessionStorage",Jr="memoryStorage",Xr="request.state",Zr="request.origin",eo="urlHash",to="request.params",no="interaction.status",ro="ccs.credential",oo="request.correlationId",ao="request.native",io="msal.account.keys",so="msal.token.keys",co="msal.version",lo="wrapper.sku",uo="wrapper.version",ho=861,po=862;var fo,go;(go=fo||(fo={})).Redirect="redirect",go.Popup="popup",go.Silent="silent",go.None="none";const mo="startup",vo="login",bo="logout",yo="acquireToken",xo="ssoSilent",wo="handleRedirect",ko="none",Co={scopes:i},So="msal.db",jo=`${So}.keys`,To=[0,5,4];class Io{navigateInternal(e,t){return Io.defaultNavigateWindow(e,t)}navigateExternal(e,t){return Io.defaultNavigateWindow(e,t)}static defaultNavigateWindow(e,t){return t.noHistory?window.location.replace(e):window.location.assign(e),new Promise(e=>{setTimeout(()=>{e(!0)},t.timeout)})}}class Ao extends Q{constructor(e,t,n){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,Ao.prototype),this.name="NetworkError",this.error=e,this.httpStatus=t,this.responseHeaders=n}}function No(e,t,n){return new Ao(e,t,n)}const Eo="pkce_not_created",_o="crypto_nonexistent",Po="empty_navigate_uri",Oo="hash_empty_error",Ro="no_state_in_hash",Mo="hash_does_not_contain_known_properties",zo="unable_to_parse_state",Lo="state_interaction_type_mismatch",Do="interaction_in_progress",Fo="popup_window_error",qo="empty_window_error",Bo="user_cancelled",Uo="monitor_popup_timeout",Ho="monitor_window_timeout",Ko="redirect_in_iframe",$o="block_iframe_reload",Go="block_nested_popups",Wo="iframe_closed_prematurely",Vo="silent_logout_unsupported",Qo="no_account_error",Yo="silent_prompt_value_error",Jo="no_token_request_cache_error",Xo="unable_to_parse_token_request_cache_error",Zo="no_cached_authority_error",ea="auth_request_not_set_error",ta="invalid_cache_type",na="non_browser_environment",ra="database_not_open",oa="no_network_connectivity",aa="post_request_failed",ia="get_request_failed",sa="failed_to_parse_response",ca="unable_to_load_token",la="crypto_key_not_found",da="auth_code_required",ua="auth_code_or_nativeAccountId_required",ha="spa_code_and_nativeAccountId_present",pa="database_unavailable",fa="unable_to_acquire_token_from_native_platform",ga="native_handshake_timeout",ma="native_extension_not_installed",va="native_connection_not_established",ba="uninitialized_public_client_application",ya="native_prompt_not_supported",xa="invalid_base64_string",wa="invalid_pop_token_request",ka="failed_to_build_headers",Ca="failed_to_parse_headers",Sa="For more visit: aka.ms/msaljs/browser-errors",ja={[Eo]:"The PKCE code challenge and verifier could not be generated.",[_o]:"The crypto object or function is not available.",[Po]:"Navigation URI is empty. Please check stack trace for more info.",[Oo]:`Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. ${Sa}`,[Ro]:"Hash does not contain state. Please verify that the request originated from msal.",[Mo]:`Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. ${Sa}`,[zo]:"Unable to parse state. Please verify that the request originated from msal.",[Lo]:"Hash contains state but the interaction type does not match the caller.",[Do]:`Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API. ${Sa}`,[Fo]:"Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.",[qo]:"window.open returned null or undefined window object.",[Bo]:"User cancelled the flow.",[Uo]:`Token acquisition in popup failed due to timeout. ${Sa}`,[Ho]:`Token acquisition in iframe failed due to timeout. ${Sa}`,[Ko]:"Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs.",[$o]:`Request was blocked inside an iframe because MSAL detected an authentication response. ${Sa}`,[Go]:"Request was blocked inside a popup because MSAL detected it was running in a popup.",[Wo]:"The iframe being monitored was closed prematurely.",[Vo]:"Silent logout not supported. Please call logoutRedirect or logoutPopup instead.",[Qo]:"No account object provided to acquireTokenSilent and no active account has been set. Please call setActiveAccount or provide an account on the request.",[Yo]:"The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'.",[Jo]:"No token request found in cache.",[Xo]:"The cached token request could not be parsed.",[Zo]:"No cached authority found.",[ea]:"Auth Request not set. Please ensure initiateAuthRequest was called from the InteractionHandler",[ta]:"Invalid cache type",[na]:"Login and token requests are not supported in non-browser environments.",[ra]:"Database is not open!",[oa]:"No network connectivity. Check your internet connection.",[aa]:"Network request failed: If the browser threw a CORS error, check that the redirectUri is registered in the Azure App Portal as type 'SPA'",[ia]:"Network request failed. Please check the network trace to determine root cause.",[sa]:"Failed to parse network response. Check network trace.",[ca]:"Error loading token to cache.",[la]:"Cryptographic Key or Keypair not found in browser storage.",[da]:"An authorization code must be provided (as the `code` property on the request) to this flow.",[ua]:"An authorization code or nativeAccountId must be provided to this flow.",[ha]:"Request cannot contain both spa code and native account id.",[pa]:"IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts.",[fa]:`Unable to acquire token from native platform. ${Sa}`,[ga]:"Timed out while attempting to establish connection to browser extension",[ma]:"Native extension is not installed. If you think this is a mistake call the initialize function.",[va]:`Connection to native platform has not been established. Please install a compatible browser extension and run initialize(). ${Sa}`,[ba]:`You must call and await the initialize function before attempting to call any other MSAL API. ${Sa}`,[ya]:"The provided prompt is not supported by the native platform. This request should be routed to the web based flow.",[xa]:"Invalid base64 encoded string.",[wa]:"Invalid PoP token request. The request should not have both a popKid value and signPopToken set to true.",[ka]:"Failed to build request headers object.",[Ca]:"Failed to parse response headers"};class Ta extends Q{constructor(e,t){super(e,ja[e],t),Object.setPrototypeOf(this,Ta.prototype),this.name="BrowserAuthError"}}function Ia(e,t){return new Ta(e,t)}class Aa{async sendGetRequestAsync(e,t){let n,r={},o=0;const a=Na(t);try{n=await fetch(e,{method:"GET",headers:a})}catch(e){throw Ia(window.navigator.onLine?ia:oa)}r=Ea(n.headers);try{return o=n.status,{headers:r,body:await n.json(),status:o}}catch(e){throw No(Ia(sa),o,r)}}async sendPostRequestAsync(e,t){const n=t&&t.body||"",r=Na(t);let o,a=0,i={};try{o=await fetch(e,{method:"POST",headers:r,body:n})}catch(e){throw Ia(window.navigator.onLine?aa:oa)}i=Ea(o.headers);try{return a=o.status,{headers:i,body:await o.json(),status:a}}catch(e){throw No(Ia(sa),a,i)}}}function Na(e){try{const t=new Headers;if(!e||!e.headers)return t;const n=e.headers;return Object.entries(n).forEach(([e,n])=>{t.append(e,n)}),t}catch(e){throw Ia(ka)}}function Ea(e){try{const t={};return e.forEach((e,n)=>{t[n]=e}),t}catch(e){throw Ia(Ca)}}function _a(e){return encodeURIComponent(Oa(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"))}function Pa(e){return Ra(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Oa(e){return Ra((new TextEncoder).encode(e))}function Ra(e){const t=Array.from(e,e=>String.fromCodePoint(e)).join("");return btoa(t)}const Ma="SHA-256",za=new Uint8Array([1,0,1]),La="0123456789abcdef",Da=new Uint32Array(1),Fa={name:"RSASSA-PKCS1-v1_5",hash:Ma,modulusLength:2048,publicExponent:za};async function qa(e,t,n){t?.addQueueMeasurement(Lr,n);const r=(new TextEncoder).encode(e);return window.crypto.subtle.digest(Ma,r)}function Ba(e){return window.crypto.getRandomValues(e)}function Ua(){return window.crypto.getRandomValues(Da),Da[0]}function Ha(){const e=Date.now(),t=1024*Ua()+(1023&Ua()),n=new Uint8Array(16),r=Math.trunc(t/2**30),o=t&2**30-1,a=Ua();n[0]=e/2**40,n[1]=e/2**32,n[2]=e/2**24,n[3]=e/65536,n[4]=e/256,n[5]=e,n[6]=112|r>>>8,n[7]=r,n[8]=128|o>>>24,n[9]=o>>>16,n[10]=o>>>8,n[11]=o,n[12]=a>>>24,n[13]=a>>>16,n[14]=a>>>8,n[15]=a;let i="";for(let e=0;e<n.length;e++)i+=La.charAt(n[e]>>>4),i+=La.charAt(15&n[e]),3!==e&&5!==e&&7!==e&&9!==e||(i+="-");return i}async function Ka(e){return window.crypto.subtle.exportKey("jwk",e)}async function $a(e){const t=await qa(e);return Pa(new Uint8Array(t))}const Ga="storage_not_supported",Wa="stubbed_public_client_application_called",Va="in_mem_redirect_unavailable",Qa={[Ga]:"Given storage configuration option was not supported.",[Wa]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[Va]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};class Ya extends Q{constructor(e,t){super(e,t),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,Ya.prototype)}}function Ja(e){return new Ya(e,Qa[e])}function Xa(){return window.parent!==window}function Za(){return"undefined"!=typeof window&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function ei(){if("undefined"==typeof window)throw Ia(na)}function ti(e){if(!e)throw Ia(ba)}function ni(e){ei(),function(){if(Yt.hashContainsKnownProperties(window.location.hash)&&Xa())throw Ia($o)}(),function(){if("undefined"!=typeof window&&window.opener&&window.opener!==window&&"string"==typeof window.name&&0===window.name.indexOf(`${Hr}.`))throw Ia(Go)}(),ti(e)}function ri(e,t){if(ni(e),function(e){if(Xa()&&!e)throw Ia(Ko)}(t.system.allowRedirectInIframe),t.cache.cacheLocation===Jr&&!t.cache.storeAuthStateInCookie)throw Ja(Va)}function oi(e){const t=document.createElement("link");t.rel="preconnect",t.href=new URL(e).origin,t.crossOrigin="anonymous",document.head.appendChild(t),window.setTimeout(()=>{try{document.head.removeChild(t)}catch{}},1e4)}const ai="3.30.0";class ii{static loggerCallback(e,t){switch(e){case B.Error:return void console.error(t);case B.Info:return void console.info(t);case B.Verbose:return void console.debug(t);case B.Warning:return void console.warn(t);default:return void console.log(t)}}constructor(e){let t;this.browserEnvironment="undefined"!=typeof window,this.config=function({auth:e,cache:t,system:n,telemetry:r},o){const i={clientId:a.EMPTY_STRING,authority:`${a.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:a.EMPTY_STRING,authorityMetadata:a.EMPTY_STRING,redirectUri:"undefined"!=typeof window?Za():"",postLogoutRedirectUri:a.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:H,OIDCOptions:{serverResponseType:T.FRAGMENT,defaultScopes:[a.OPENID_SCOPE,a.PROFILE_SCOPE,a.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:$,tenant:a.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1},s={cacheLocation:Yr,temporaryCacheLocation:Yr,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!(!t||t.cacheLocation!==Qr),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:B.Info,piiLoggingEnabled:!1},l={...{...dn,loggerOptions:c,networkClient:o?new Aa:yn,navigationClient:new Io,loadFrameTimeout:0,windowHashTimeout:n?.loadFrameTimeout||6e4,iframeHashTimeout:n?.loadFrameTimeout||1e4,navigateFrameWait:0,redirectNavigationTimeout:3e4,asyncPopups:!1,allowRedirectInIframe:!1,allowNativeBroker:!1,nativeBrokerHandshakeTimeout:n?.nativeBrokerHandshakeTimeout||2e3,pollIntervalMilliseconds:30},...n,loggerOptions:n?.loggerOptions||c},d={application:{appName:a.EMPTY_STRING,appVersion:a.EMPTY_STRING},client:new Br};if(e?.protocolMode!==K&&e?.OIDCOptions&&new U(l.loggerOptions).warning(JSON.stringify(Dt(Ot))),e?.protocolMode&&e.protocolMode!==H&&l?.allowNativeBroker)throw Dt(Rt);return{auth:{...i,...e,OIDCOptions:{...i.OIDCOptions,...e?.OIDCOptions}},cache:{...s,...t},system:l,telemetry:{...d,...r}}}(e,this.browserEnvironment);try{t=window[Yr]}catch(e){}const n=t?.getItem("msal.browser.log.level"),r=t?.getItem("msal.browser.log.pii")?.toLowerCase(),o="true"===r||"false"!==r&&void 0,i={...this.config.system.loggerOptions},s=n&&Object.keys(B).includes(n)?B[n]:void 0;s&&(i.loggerCallback=ii.loggerCallback,i.logLevel=s),void 0!==o&&(i.piiLoggingEnabled=o),this.logger=new U(i,"@azure/msal-browser",ai),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}class si extends ii{getModuleName(){return si.MODULE_NAME}getId(){return si.ID}async initialize(){return this.available="undefined"!=typeof window,this.available}}si.MODULE_NAME="",si.ID="StandardOperatingContext";const ci="missing_kid_error",li="missing_alg_error",di={[ci]:"The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",[li]:"The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."};class ui extends Q{constructor(e,t){super(e,t),this.name="JoseHeaderError",Object.setPrototypeOf(this,ui.prototype)}}function hi(e){return new ui(e,di[e])}class pi{constructor(e){this.typ=e.typ,this.alg=e.alg,this.kid=e.kid}static getShrHeaderString(e){if(!e.kid)throw hi(ci);if(!e.alg)throw hi(li);const t=new pi({typ:e.typ||"pop",kid:e.kid,alg:e.alg});return JSON.stringify(t)}}function fi(e){return(new TextDecoder).decode(function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Ia(xa)}const n=atob(t);return Uint8Array.from(n,e=>e.codePointAt(0)||0)}(e))}class gi{constructor(){this.dbName=So,this.version=1,this.tableName=jo,this.dbOpen=!1}async open(){return new Promise((e,t)=>{const n=window.indexedDB.open(this.dbName,this.version);n.addEventListener("upgradeneeded",e=>{e.target.result.createObjectStore(this.tableName)}),n.addEventListener("success",t=>{const n=t;this.db=n.target.result,this.dbOpen=!0,e()}),n.addEventListener("error",()=>t(Ia(pa)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(Ia(ra));const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);r.addEventListener("success",e=>{const n=e;this.closeConnection(),t(n.target.result)}),r.addEventListener("error",e=>{this.closeConnection(),n(e)})})}async setItem(e,t){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ia(ra));const o=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(t,e);o.addEventListener("success",()=>{this.closeConnection(),n()}),o.addEventListener("error",e=>{this.closeConnection(),r(e)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(Ia(ra));const r=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);r.addEventListener("success",()=>{this.closeConnection(),t()}),r.addEventListener("error",e=>{this.closeConnection(),n(e)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,t)=>{if(!this.db)return t(Ia(ra));const n=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();n.addEventListener("success",t=>{const n=t;this.closeConnection(),e(n.target.result)}),n.addEventListener("error",e=>{this.closeConnection(),t(e)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((t,n)=>{if(!this.db)return n(Ia(ra));const r=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);r.addEventListener("success",e=>{const n=e;this.closeConnection(),t(1===n.target.result)}),r.addEventListener("error",e=>{this.closeConnection(),n(e)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,t)=>{const n=window.indexedDB.deleteDatabase(So),r=setTimeout(()=>t(!1),200);n.addEventListener("success",()=>(clearTimeout(r),e(!0))),n.addEventListener("blocked",()=>(clearTimeout(r),e(!0))),n.addEventListener("error",()=>(clearTimeout(r),t(!1)))})}}class mi{constructor(){this.cache=new Map}getItem(e){return this.cache.get(e)||null}setItem(e,t){this.cache.set(e,t)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((t,n)=>{e.push(n)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}}class vi{constructor(e){this.inMemoryCache=new mi,this.indexedDBCache=new gi,this.logger=e}handleDatabaseAccessError(e){if(!(e instanceof Ta&&e.errorCode===pa))throw e;this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.")}async getItem(e){const t=this.inMemoryCache.getItem(e);if(!t)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(e){this.handleDatabaseAccessError(e)}return t}async setItem(e,t){this.inMemoryCache.setItem(e,t);try{await this.indexedDBCache.setItem(e,t)}catch(e){this.handleDatabaseAccessError(e)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(e){this.handleDatabaseAccessError(e)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(0===e.length)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(e){this.handleDatabaseAccessError(e)}return e}async containsKey(e){const t=this.inMemoryCache.containsKey(e);if(!t)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(e){this.handleDatabaseAccessError(e)}return t}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}class bi{constructor(e,t,n){this.logger=e,function(e){if(!window)throw Ia(na);if(!window.crypto)throw Ia(_o);if(!e&&!window.crypto.subtle)throw Ia(_o,"crypto_subtle_undefined")}(n??!1),this.cache=new vi(this.logger),this.performanceClient=t}createNewGuid(){return Ha()}base64Encode(e){return Oa(e)}base64Decode(e){return fi(e)}base64UrlEncode(e){return _a(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){const t=this.performanceClient?.startMeasurement(Tn,e.correlationId),n=await async function(e,t){return window.crypto.subtle.generateKey(Fa,e,t)}(bi.EXTRACTABLE,bi.POP_KEY_USAGES),r=await Ka(n.publicKey),o=yi({e:r.e,kty:r.kty,n:r.n}),a=await this.hashString(o),i=await Ka(n.privateKey),s=await async function(e){return window.crypto.subtle.importKey("jwk",e,Fa,!1,["sign"])}(i);return await this.cache.setItem(a,{privateKey:s,publicKey:n.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),t&&t.end({success:!0}),a}async removeTokenBindingKey(e){return await this.cache.removeItem(e),!await this.cache.containsKey(e)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,t,n,r){const o=this.performanceClient?.startMeasurement(In,r),a=await this.cache.getItem(t);if(!a)throw Ia(la);const i=await Ka(a.publicKey),s=yi(i),c=_a(JSON.stringify({kid:t})),l=_a(pi.getShrHeaderString({...n?.header,alg:i.alg,kid:c}));e.cnf={jwk:JSON.parse(s)};const d=`${l}.${_a(JSON.stringify(e))}`,u=(new TextEncoder).encode(d),h=await async function(e,t){return window.crypto.subtle.sign(Fa,e,t)}(a.privateKey,u),p=`${d}.${Pa(new Uint8Array(h))}`;return o&&o.end({success:!0}),p}async hashString(e){return $a(e)}}function yi(e){return JSON.stringify(e,Object.keys(e).sort())}bi.POP_KEY_USAGES=["sign","verify"],bi.EXTRACTABLE=!0;const xi=(e,t,n,r,o)=>(...a)=>{n.trace(`Executing function ${t}`);const i=r?.startMeasurement(t,o);if(o){const e=t+"CallCount";r?.incrementFields({[e]:1},o)}try{const r=e(...a);return i?.end({success:!0}),n.trace(`Returning result from ${t}`),r}catch(e){n.trace(`Error occurred in ${t}`);try{n.trace(JSON.stringify(e))}catch(e){n.trace("Unable to print error message.")}throw i?.end({success:!1},e),e}},wi=(e,t,n,r,o)=>(...a)=>{n.trace(`Executing function ${t}`);const i=r?.startMeasurement(t,o);if(o){const e=t+"CallCount";r?.incrementFields({[e]:1},o)}return r?.setPreQueueTime(t,o),e(...a).then(e=>(n.trace(`Returning result from ${t}`),i?.end({success:!0}),e)).catch(e=>{n.trace(`Error occurred in ${t}`);try{n.trace(JSON.stringify(e))}catch(e){n.trace("Unable to print error message.")}throw i?.end({success:!1},e),e})};class ki{constructor(e,t,n,r){this.networkInterface=e,this.logger=t,this.performanceClient=n,this.correlationId=r}async detectRegion(e,t){this.performanceClient?.addQueueMeasurement(Sr,this.correlationId);let n=e;if(n)t.region_source="3";else{const e=ki.IMDS_OPTIONS;try{const r=await wi(this.getRegionFromIMDS.bind(this),jr,this.logger,this.performanceClient,this.correlationId)(a.IMDS_VERSION,e);if(200===r.status&&(n=r.body,t.region_source="4"),400===r.status){const r=await wi(this.getCurrentVersion.bind(this),Tr,this.logger,this.performanceClient,this.correlationId)(e);if(!r)return t.region_source="1",null;const o=await wi(this.getRegionFromIMDS.bind(this),jr,this.logger,this.performanceClient,this.correlationId)(r,e);200===o.status&&(n=o.body,t.region_source="4")}}catch(e){return t.region_source="1",null}}return n||(t.region_source="1"),n||null}async getRegionFromIMDS(e,t){return this.performanceClient?.addQueueMeasurement(jr,this.correlationId),this.networkInterface.sendGetRequestAsync(`${a.IMDS_ENDPOINT}?api-version=${e}&format=text`,t,a.IMDS_TIMEOUT)}async getCurrentVersion(e){this.performanceClient?.addQueueMeasurement(Tr,this.correlationId);try{const t=await this.networkInterface.sendGetRequestAsync(`${a.IMDS_ENDPOINT}?format=json`,e);return 400===t.status&&t.body&&t.body["newest-versions"]&&t.body["newest-versions"].length>0?t.body["newest-versions"][0]:null}catch(e){return null}}}ki.IMDS_OPTIONS={headers:{Metadata:"true"}};class Ci{constructor(e,t,n,r,o,a,i,s){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=t,this.cacheManager=n,this.authorityOptions=r,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=i,this.correlationId=a,this.managedIdentity=s||!1,this.regionDiscovery=new ki(t,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(a.CIAM_AUTH_URL))return 3;const t=e.PathSegments;if(t.length)switch(t[0].toLowerCase()){case a.ADFS:return 1;case a.DSTS:return 2}return 0}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new Yt(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw He(te)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw He(te)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw He(te)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw He(Re);return this.replacePath(this.metadata.end_session_endpoint)}throw He(te)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw He(te)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw He(te)}canReplaceTenant(e){return 1===e.PathSegments.length&&!Ci.reservedTenantDomains.has(e.PathSegments[0])&&0===this.getAuthorityType(e)&&this.protocolMode===H}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let t=e;const n=new Yt(this.metadata.canonical_authority).getUrlComponents(),r=n.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((e,o)=>{let a=r[o];if(0===o&&this.canReplaceTenant(n)){const e=new Yt(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];a!==e&&(this.logger.verbose(`Replacing tenant domain name ${a} with id ${e}`),a=e)}e!==a&&(t=t.replace(`/${a}/`,`/${e}/`))}),this.replaceTenant(t)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||1===this.authorityType||this.protocolMode!==H&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){this.performanceClient?.addQueueMeasurement(br,this.correlationId);const e=this.getCurrentMetadataEntity(),t=await wi(this.updateCloudDiscoveryMetadata.bind(this),xr,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const n=await wi(this.updateEndpointMetadata.bind(this),kr,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,t,{source:n}),this.performanceClient?.addFields({cloudDiscoverySource:t,authorityEndpointSource:n},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:dt(),jwks_uri:""}),e}updateCachedMetadata(e,t,n){t!==M&&n?.source!==M&&(e.expiresAt=dt(),e.canonical_authority=this.canonicalAuthority);const r=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(r,e),this.metadata=e}async updateEndpointMetadata(e){this.performanceClient?.addQueueMeasurement(kr,this.correlationId);const t=this.updateEndpointMetadataFromLocalSources(e);if(t)return t.source===L&&this.authorityOptions.azureRegionConfiguration?.azureRegion&&t.metadata&&(ut(e,await wi(this.updateMetadataWithRegionalInformation.bind(this),Cr,this.logger,this.performanceClient,this.correlationId)(t.metadata),!1),e.canonical_authority=this.canonicalAuthority),t.source;let n=await wi(this.getEndpointMetadataFromNetwork.bind(this),wr,this.logger,this.performanceClient,this.correlationId)();if(n)return this.authorityOptions.azureRegionConfiguration?.azureRegion&&(n=await wi(this.updateMetadataWithRegionalInformation.bind(this),Cr,this.logger,this.performanceClient,this.correlationId)(n)),ut(e,n,!0),z;throw He(re,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const t=this.getEndpointMetadataFromConfig();if(t)return this.logger.verbose("Found endpoint metadata in authority configuration"),ut(e,t,!1),{source:R};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const t=this.getEndpointMetadataFromHardcodedValues();if(t)return ut(e,t,!1),{source:L,metadata:t};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const n=pt(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!n?(this.logger.verbose("Found endpoint metadata in the cache."),{source:M}):(n&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new Yt(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch(e){throw Dt(It)}return null}async getEndpointMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(wr,this.correlationId);const e={},t=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${t}`);try{const n=await this.networkInterface.sendGetRequestAsync(t,e),r=function(e){return e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("jwks_uri")}(n.body);return r?n.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(e){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${e}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in Jt?Jt[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){this.performanceClient?.addQueueMeasurement(Cr,this.correlationId);const t=this.authorityOptions.azureRegionConfiguration?.azureRegion;if(t){if(t!==a.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome="2",this.regionDiscoveryMetadata.region_used=t,Ci.replaceWithRegionalInformation(e,t);const n=await wi(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),Sr,this.logger,this.performanceClient,this.correlationId)(this.authorityOptions.azureRegionConfiguration?.environmentRegion,this.regionDiscoveryMetadata);if(n)return this.regionDiscoveryMetadata.region_outcome="4",this.regionDiscoveryMetadata.region_used=n,Ci.replaceWithRegionalInformation(e,n);this.regionDiscoveryMetadata.region_outcome="5"}return e}async updateCloudDiscoveryMetadata(e){this.performanceClient?.addQueueMeasurement(xr,this.correlationId);const t=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(t)return t;const n=await wi(this.getCloudDiscoveryMetadataFromNetwork.bind(this),yr,this.logger,this.performanceClient,this.correlationId)();if(n)return ht(e,n,!0),z;throw Dt(At)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||a.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||a.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||a.NOT_APPLICABLE}`);const t=this.getCloudDiscoveryMetadataFromConfig();if(t)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),ht(e,t,!1),R;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const t=(n=this.hostnameAndPort,tn(Xt.metadata,n));if(t)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),ht(e,t,!1),L;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}var n;const r=pt(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),M):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(3===this.authorityType)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Ci.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=tn(JSON.parse(this.authorityOptions.cloudDiscoveryMetadata).metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),e)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),e;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch(e){throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),Dt(Tt)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Ci.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){this.performanceClient?.addQueueMeasurement(yr,this.correlationId);const e=`${a.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,t={};let n=null;try{const r=await this.networkInterface.sendGetRequestAsync(e,t);let o,i;if(function(e){return e.hasOwnProperty("tenant_discovery_endpoint")&&e.hasOwnProperty("metadata")}(r.body))o=r.body,i=o.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${o.tenant_discovery_endpoint}`);else{if(!function(e){return e.hasOwnProperty("error")&&e.hasOwnProperty("error_description")}(r.body))return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${r.status}`),o=r.body,o.error===a.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${o.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${o.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),i=[]}this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),n=tn(i,this.hostnameAndPort)}catch(e){if(e instanceof Q)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata.\nError: ${e.errorCode}\nError Description: ${e.errorMessage}`);else{const t=e;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata.\nError: ${t.name}\nError Description: ${t.message}`)}return null}return n||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),n=Ci.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),n}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(e=>e&&Yt.getDomainFromUrl(e).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,t){let n;if(t&&t.azureCloudInstance!==$){const e=t.tenant?t.tenant:a.DEFAULT_COMMON_TENANT;n=`${t.azureCloudInstance}/${e}/`}return n||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return a.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw He(te)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return Zt.has(e)}static isPublicCloudAuthority(e){return a.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,t,n){const r=new Yt(e);r.validateAsUri();const o=r.getUrlComponents();let i=`${t}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(i=`${t}.${a.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const s=Yt.constructAuthorityUriFromObject({...r.getUrlComponents(),HostNameAndPort:i}).urlString;return n?`${s}?${n}`:s}static replaceWithRegionalInformation(e,t){const n={...e};return n.authorization_endpoint=Ci.buildRegionalAuthorityString(n.authorization_endpoint,t),n.token_endpoint=Ci.buildRegionalAuthorityString(n.token_endpoint,t),n.end_session_endpoint&&(n.end_session_endpoint=Ci.buildRegionalAuthorityString(n.end_session_endpoint,t)),n}static transformCIAMAuthority(e){let t=e;const n=new Yt(e).getUrlComponents();return 0===n.PathSegments.length&&n.HostNameAndPort.endsWith(a.CIAM_AUTH_URL)&&(t=`${t}${n.HostNameAndPort.split(".")[0]}${a.AAD_TENANT_DOMAIN_SUFFIX}`),t}}function Si(e){return e.endsWith(a.FORWARD_SLASH)?e:`${e}${a.FORWARD_SLASH}`}Ci.reservedTenantDomains=new Set(["{tenant}","{tenantid}",x,k,w]);const ji="no_tokens_found",Ti="native_account_unavailable",Ii="refresh_token_expired",Ai="bad_token",Ni=["interaction_required","consent_required","login_required",Ai],Ei=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],_i={[ji]:"No refresh token found in the cache. Please sign-in.",[Ti]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[Ii]:"Refresh token has expired.",[Ai]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve."};class Pi extends Q{constructor(e,t,n,r,o,i,s,c){super(e,t,n),Object.setPrototypeOf(this,Pi.prototype),this.timestamp=r||a.EMPTY_STRING,this.traceId=o||a.EMPTY_STRING,this.correlationId=i||a.EMPTY_STRING,this.claims=s||a.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=c}}function Oi(e,t,n){const r=!!e&&Ni.indexOf(e)>-1,o=!!n&&Ei.indexOf(n)>-1,a=!!t&&Ni.some(e=>t.indexOf(e)>-1);return r||a||o}function Ri(e){return new Pi(e,_i[e])}class Mi{static setRequestState(e,t,n){const r=Mi.generateLibraryState(e,n);return t?`${r}${a.RESOURCE_DELIM}${t}`:r}static generateLibraryState(e,t){if(!e)throw He(je);const n={id:e.createNewGuid()};t&&(n.meta=t);const r=JSON.stringify(n);return e.base64Encode(r)}static parseRequestState(e,t){if(!e)throw He(je);if(!t)throw He(ae);try{const n=t.split(a.RESOURCE_DELIM),r=n[0],o=n.length>1?n.slice(1).join(a.RESOURCE_DELIM):a.EMPTY_STRING,i=e.base64Decode(r),s=JSON.parse(i);return{userRequestState:o||a.EMPTY_STRING,libraryState:s}}catch(e){throw He(ae)}}}const zi="home_account_id",Li="UPN";class Di{constructor(){if(!window.localStorage)throw Ja(Ga)}getItem(e){return window.localStorage.getItem(e)}setItem(e,t){window.localStorage.setItem(e,t)}removeItem(e){window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}}class Fi{constructor(){if(!window.sessionStorage)throw Ja(Ga)}getItem(e){return window.sessionStorage.getItem(e)}setItem(e,t){window.sessionStorage.setItem(e,t)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}}function qi(e,t){if(!t)return null;try{return Mi.parseRequestState(e,t).libraryState.meta}catch(e){throw He(ae)}}class Bi{getItem(e){const t=`${encodeURIComponent(e)}`,n=document.cookie.split(";");for(let e=0;e<n.length;e++){const r=n[e],[o,...a]=decodeURIComponent(r).trim().split("="),i=a.join("=");if(o===t)return i}return""}setItem(e,t,n,r=!0){let o=`${encodeURIComponent(e)}=${encodeURIComponent(t)};path=/;SameSite=Lax;`;if(n){const e=function(e){const t=new Date;return new Date(t.getTime()+864e5*e).toUTCString()}(n);o+=`expires=${e};`}r&&(o+="Secure;"),document.cookie=o}removeItem(e){this.setItem(e,"",-1)}getKeys(){const e=document.cookie.split(";"),t=[];return e.forEach(e=>{const n=decodeURIComponent(e).trim().split("=");t.push(n[0])}),t}containsKey(e){return this.getKeys().includes(e)}}class Ui extends cn{constructor(e,t,n,r,o,a){super(e,n,r,o),this.cacheConfig=t,this.logger=r,this.internalStorage=new mi,this.browserStorage=this.setupBrowserStorage(this.cacheConfig.cacheLocation),this.temporaryCacheStorage=this.setupBrowserStorage(this.cacheConfig.temporaryCacheLocation),this.cookieStorage=new Bi,t.cacheMigrationEnabled&&(this.migrateCacheEntries(),this.createKeyMaps()),this.performanceClient=a}setupBrowserStorage(e){try{switch(e){case Qr:return new Di;case Yr:return new Fi}}catch(e){this.logger.error(e)}return this.cacheConfig.cacheLocation=Jr,new mi}migrateCacheEntries(){const e=this.browserStorage.getItem(co);e&&this.logger.info(`MSAL.js was last initialized with version ${e}`),e!==ai&&this.browserStorage.setItem(co,ai);const t=`${a.CACHE_PREFIX}.${p}`,n=`${a.CACHE_PREFIX}.${f}`,r=`${a.CACHE_PREFIX}.${m}`,o=`${a.CACHE_PREFIX}.${v}`,i=[this.browserStorage.getItem(t),this.browserStorage.getItem(n),this.browserStorage.getItem(r),this.browserStorage.getItem(o)];[p,f,m,v].forEach((e,t)=>{const n=i[t];n&&this.setTemporaryCache(e,n,!0)})}createKeyMaps(){this.logger.trace("BrowserCacheManager - createKeyMaps called.");const e=this.cryptoImpl.createNewGuid(),t=this.getItem(io),n=this.getItem(`${so}.${this.clientId}`);t&&n?this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration."):this.browserStorage.getKeys().forEach(t=>{if(this.isCredentialKey(t)){const n=this.getItem(t);if(n){const r=this.validateAndParseJson(n);if(r&&r.hasOwnProperty("credentialType"))switch(r.credentialType){case E.ID_TOKEN:if(rt(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${t} found, saving key to token key map`);const n=r,o=this.updateCredentialCacheKey(t,n,e);return void this.addTokenKey(o,E.ID_TOKEN,e)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${t}`);break;case E.ACCESS_TOKEN:case E.ACCESS_TOKEN_WITH_AUTH_SCHEME:if(nt(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${t} found, saving key to token key map`);const n=r,o=this.updateCredentialCacheKey(t,n,e);return void this.addTokenKey(o,E.ACCESS_TOKEN,e)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${t}`);break;case E.REFRESH_TOKEN:if(ot(r)){this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${t} found, saving key to token key map`);const n=r,o=this.updateCredentialCacheKey(t,n,e);return void this.addTokenKey(o,E.REFRESH_TOKEN,e)}this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping."),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${t}`)}}}if(this.isAccountKey(t)){const n=this.getItem(t);if(n){const r=this.validateAndParseJson(n);r&&Wt.isAccountEntity(r)&&(this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map"),this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${t} found, saving key to account key map`),this.addAccountKeyToMap(t,e))}}})}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}getItem(e){return this.browserStorage.getItem(e)}setItem(e,t,n){let r=[];for(let o=0;o<=20;o++)try{this.browserStorage.setItem(e,t),o>0&&this.removeAccessTokenKeys(r.slice(0,o),n);break}catch(a){const i=sn(a);if(!(i.errorCode===nn&&o<20))throw i;if(r.length||(r=e===`${so}.${this.clientId}`?JSON.parse(t).accessToken:this.getTokenKeys().accessToken),r.length<=o)throw i;this.removeAccessToken(r[o],n,!1)}}getAccount(e,t,n){this.logger.trace("BrowserCacheManager.getAccount called");const r=this.getCachedAccountEntity(e,t);return this.updateOutdatedCachedAccount(e,r,t,n)}getCachedAccountEntity(e,t){const n=this.getItem(e);if(!n)return this.removeAccountKeyFromMap(e,t),null;const r=this.validateAndParseJson(n);return r&&Wt.isAccountEntity(r)?cn.toObject(new Wt,r):null}setAccount(e,t){this.logger.trace("BrowserCacheManager.setAccount called");const n=e.generateAccountKey();e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addAccountKeyToMap(n,t)}getAccountKeys(){this.logger.trace("BrowserCacheManager.getAccountKeys called");const e=this.getItem(io);return e?JSON.parse(e):(this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found"),[])}addAccountKeyToMap(e,t){this.logger.trace("BrowserCacheManager.addAccountKeyToMap called"),this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${e}`);const n=this.getAccountKeys();-1===n.indexOf(e)?(n.push(e),this.setItem(io,JSON.stringify(n),t),this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added")):this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map")}removeAccountKeyFromMap(e,t){this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called"),this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${e}`);const n=this.getAccountKeys(),r=n.indexOf(e);if(r>-1){if(n.splice(r,1),0===n.length)return void this.removeItem(io);this.setItem(io,JSON.stringify(n),t),this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}async removeAccount(e,t){super.removeAccount(e,t),this.removeAccountKeyFromMap(e,t)}removeOutdatedAccount(e,t){this.removeItem(e),this.removeAccountKeyFromMap(e,t)}removeIdToken(e,t){super.removeIdToken(e,t),this.removeTokenKey(e,E.ID_TOKEN,t)}removeAccessToken(e,t,n=!0){super.removeAccessToken(e,t),this.performanceClient?.incrementFields({accessTokensRemoved:1},t),n&&this.removeTokenKey(e,E.ACCESS_TOKEN,t)}removeAccessTokenKeys(e,t){this.logger.trace("removeAccessTokenKey called");const n=this.getTokenKeys();let r=0;if(e.forEach(e=>{const t=n.accessToken.indexOf(e);t>-1&&(n.accessToken.splice(t,1),r++)}),r>0)return this.logger.info(`removed ${r} accessToken keys from tokenKeys map`),void this.setTokenKeys(n,t)}removeRefreshToken(e,t){super.removeRefreshToken(e,t),this.removeTokenKey(e,E.REFRESH_TOKEN,t)}getTokenKeys(){this.logger.trace("BrowserCacheManager.getTokenKeys called");const e=this.getItem(`${so}.${this.clientId}`);if(e){const t=this.validateAndParseJson(e);if(t&&t.hasOwnProperty("idToken")&&t.hasOwnProperty("accessToken")&&t.hasOwnProperty("refreshToken"))return t;this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.")}else this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");return{idToken:[],accessToken:[],refreshToken:[]}}setTokenKeys(e,t){0!==e.idToken.length||0!==e.accessToken.length||0!==e.refreshToken.length?this.setItem(`${so}.${this.clientId}`,JSON.stringify(e),t):this.removeItem(`${so}.${this.clientId}`)}addTokenKey(e,t,n){this.logger.trace("BrowserCacheManager addTokenKey called");const r=this.getTokenKeys();switch(t){case E.ID_TOKEN:-1===r.idToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),r.idToken.push(e));break;case E.ACCESS_TOKEN:const n=r.accessToken.indexOf(e);-1!==n&&r.accessToken.splice(n,1),this.logger.trace(`access token ${-1===n?"added to":"updated in"} map`),r.accessToken.push(e);break;case E.REFRESH_TOKEN:-1===r.refreshToken.indexOf(e)&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),r.refreshToken.push(e));break;default:throw this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${t}`),He(Te)}this.setTokenKeys(r,n)}removeTokenKey(e,t,n,r=this.getTokenKeys()){switch(this.logger.trace("BrowserCacheManager removeTokenKey called"),t){case E.ID_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${e} from map`);const n=r.idToken.indexOf(e);n>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map"),r.idToken.splice(n,1)):this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");break;case E.ACCESS_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${e} from map`);const o=r.accessToken.indexOf(e);o>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map"),r.accessToken.splice(o,1)):this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");break;case E.REFRESH_TOKEN:this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${e} from map`);const a=r.refreshToken.indexOf(e);a>-1?(this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map"),r.refreshToken.splice(a,1)):this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");break;default:throw this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${t}`),He(Te)}this.setTokenKeys(r,n)}getIdTokenCredential(e,t){const n=this.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,t),null;const r=this.validateAndParseJson(n);return r&&rt(r)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),r):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null)}setIdTokenCredential(e,t){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const n=Je(e);e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addTokenKey(n,E.ID_TOKEN,t)}getAccessTokenCredential(e,t){const n=this.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.ACCESS_TOKEN,t),null;const r=this.validateAndParseJson(n);return r&&nt(r)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),r):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null)}setAccessTokenCredential(e,t){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const n=Je(e);e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addTokenKey(n,E.ACCESS_TOKEN,t)}getRefreshTokenCredential(e,t){const n=this.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeTokenKey(e,E.REFRESH_TOKEN,t),null;const r=this.validateAndParseJson(n);return r&&ot(r)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),r):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null)}setRefreshTokenCredential(e,t){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const n=Je(e);e.lastUpdatedAt=Date.now().toString(),this.setItem(n,JSON.stringify(e),t),this.addTokenKey(n,E.REFRESH_TOKEN,t)}getAppMetadata(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&((r=n)&&0===e.indexOf(_)&&r.hasOwnProperty("clientId")&&r.hasOwnProperty("environment"))?(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),n):(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null);var r}setAppMetadata(e,t){this.logger.trace("BrowserCacheManager.setAppMetadata called");const n=function({environment:e,clientId:t}){return[_,e,t].join(N).toLowerCase()}(e);this.setItem(n,JSON.stringify(e),t)}getServerTelemetry(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&function(e,t){const n=0===e.indexOf(D.CACHE_KEY);let r=!0;return t&&(r=t.hasOwnProperty("failedRequests")&&t.hasOwnProperty("errors")&&t.hasOwnProperty("cacheHits")),n&&r}(e,n)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),n):(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null)}setServerTelemetry(e,t,n){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(t),n)}getAuthorityMetadata(e){const t=this.internalStorage.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&function(e,t){return!!t&&0===e.indexOf(O)&&t.hasOwnProperty("aliases")&&t.hasOwnProperty("preferred_cache")&&t.hasOwnProperty("preferred_network")&&t.hasOwnProperty("canonical_authority")&&t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("aliasesFromNetwork")&&t.hasOwnProperty("endpointsFromNetwork")&&t.hasOwnProperty("expiresAt")&&t.hasOwnProperty("jwks_uri")}(e,n)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),n):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(e=>this.isAuthorityMetadata(e))}setWrapperMetadata(e,t){this.internalStorage.setItem(lo,e),this.internalStorage.setItem(uo,t)}getWrapperMetadata(){return[this.internalStorage.getItem(lo)||a.EMPTY_STRING,this.internalStorage.getItem(uo)||a.EMPTY_STRING]}setAuthorityMetadata(e,t){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(t))}getActiveAccount(e){const t=this.generateCacheKey(y),n=this.getItem(t);if(!n){this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");const t=this.generateCacheKey(b),n=this.getItem(t);if(!n)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null;const r=this.getAccountInfoFilteredBy({localAccountId:n},e);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"),this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema"),this.setActiveAccount(r,e),r):null}const r=this.validateAndParseJson(n);return r?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:r.homeAccountId,localAccountId:r.localAccountId,tenantId:r.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,t){const n=this.generateCacheKey(y),r=this.generateCacheKey(b);if(e){this.logger.verbose("setActiveAccount: Active account set");const o={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:Date.now().toString()};this.setItem(n,JSON.stringify(o),t),this.setItem(r,e.localAccountId,t)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(n),this.browserStorage.removeItem(r)}getThrottlingCache(e){const t=this.getItem(e);if(!t)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const n=this.validateAndParseJson(t);return n&&function(e,t){let n=!1;e&&(n=0===e.indexOf(q));let r=!0;return t&&(r=t.hasOwnProperty("throttleTime")),n&&r}(e,n)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),n):(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null)}setThrottlingCache(e,t,n){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(t),n)}getTemporaryCache(e,t){const n=t?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const e=this.cookieStorage.getItem(n);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),e}const r=this.temporaryCacheStorage.getItem(n);if(!r){if(this.cacheConfig.cacheLocation===Qr){const e=this.browserStorage.getItem(n);if(e)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),e}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),r}setTemporaryCache(e,t,n){const r=n?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(r,t),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(r,t,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}async clear(e){await this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(e=>{-1===e.indexOf(a.CACHE_PREFIX)&&-1===e.indexOf(this.clientId)||this.removeTemporaryItem(e)}),this.browserStorage.getKeys().forEach(e=>{-1===e.indexOf(a.CACHE_PREFIX)&&-1===e.indexOf(this.clientId)||this.browserStorage.removeItem(e)}),this.internalStorage.clear()}async clearTokensAndKeysWithClaims(e,t){e.addQueueMeasurement(Pr,t);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(e=>{const n=this.getAccessTokenCredential(e,t);n?.requestedClaimsHash&&e.includes(n.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(e,t),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return this.validateAndParseJson(e)?JSON.stringify(e):Ft.startsWith(e,a.CACHE_PREFIX)||Ft.startsWith(e,g)?e:`${a.CACHE_PREFIX}.${this.clientId}.${e}`}generateAuthorityKey(e){const{libraryState:{id:t}}=Mi.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`authority.${t}`)}generateNonceKey(e){const{libraryState:{id:t}}=Mi.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`nonce.id_token.${t}`)}generateStateKey(e){const{libraryState:{id:t}}=Mi.parseRequestState(this.cryptoImpl,e);return this.generateCacheKey(`${Xr}.${t}`)}getCachedAuthority(e){const t=this.generateStateKey(e),n=this.getTemporaryCache(t);if(!n)return null;const r=this.generateAuthorityKey(n);return this.getTemporaryCache(r)}updateCacheEntries(e,t,n,r,o){this.logger.trace("BrowserCacheManager.updateCacheEntries called");const a=this.generateStateKey(e);this.setTemporaryCache(a,e,!1);const i=this.generateNonceKey(e);this.setTemporaryCache(i,t,!1);const s=this.generateAuthorityKey(e);if(this.setTemporaryCache(s,n,!1),o){const e={credential:o.homeAccountId,type:zi};this.setTemporaryCache(ro,JSON.stringify(e),!0)}else if(r){const e={credential:r,type:Li};this.setTemporaryCache(ro,JSON.stringify(e),!0)}}resetRequestCache(e){this.logger.trace("BrowserCacheManager.resetRequestCache called"),e&&(this.temporaryCacheStorage.getKeys().forEach(t=>{-1!==t.indexOf(e)&&this.removeTemporaryItem(t)}),this.removeTemporaryItem(this.generateStateKey(e)),this.removeTemporaryItem(this.generateNonceKey(e)),this.removeTemporaryItem(this.generateAuthorityKey(e))),this.removeTemporaryItem(this.generateCacheKey(to)),this.removeTemporaryItem(this.generateCacheKey(Zr)),this.removeTemporaryItem(this.generateCacheKey(eo)),this.removeTemporaryItem(this.generateCacheKey(oo)),this.removeTemporaryItem(this.generateCacheKey(ro)),this.removeTemporaryItem(this.generateCacheKey(ao)),this.setInteractionInProgress(!1)}cleanRequestByState(e){if(this.logger.trace("BrowserCacheManager.cleanRequestByState called"),e){const t=this.generateStateKey(e),n=this.temporaryCacheStorage.getItem(t);this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n||a.EMPTY_STRING)}}cleanRequestByInteractionType(e){this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called"),this.temporaryCacheStorage.getKeys().forEach(t=>{if(-1===t.indexOf(Xr))return;const n=this.temporaryCacheStorage.getItem(t);if(!n)return;const r=qi(this.cryptoImpl,n);r&&r.interactionType===e&&(this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${n}`),this.resetRequestCache(n))}),this.setInteractionInProgress(!1)}cacheCodeRequest(e){this.logger.trace("BrowserCacheManager.cacheCodeRequest called");const t=Oa(JSON.stringify(e));this.setTemporaryCache(to,t,!0)}getCachedRequest(e){this.logger.trace("BrowserCacheManager.getCachedRequest called");const t=this.getTemporaryCache(to,!0);if(!t)throw Ia(Jo);let n;try{n=JSON.parse(fi(t))}catch(e){throw this.logger.errorPii(`Attempted to parse: ${t}`),this.logger.error(`Parsing cached token request threw with error: ${e}`),Ia(Xo)}if(this.removeTemporaryItem(this.generateCacheKey(to)),!n.authority){const t=this.generateAuthorityKey(e),r=this.getTemporaryCache(t);if(!r)throw Ia(Zo);n.authority=r}return n}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(ao,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;return this.validateAndParseJson(e)||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){const t=this.getInteractionInProgress();return e?t===this.clientId:!!t}getInteractionInProgress(){const e=`${a.CACHE_PREFIX}.${no}`;return this.getTemporaryCache(e,!1)}setInteractionInProgress(e){const t=`${a.CACHE_PREFIX}.${no}`;if(e){if(this.getInteractionInProgress())throw Ia(Do);this.setTemporaryCache(t,this.clientId,!1)}else e||this.getInteractionInProgress()!==this.clientId||this.removeTemporaryItem(t)}getLegacyLoginHint(){const e=this.getTemporaryCache(g);e&&(this.browserStorage.removeItem(g),this.logger.verbose("Cached ADAL id token retrieved."));const t=this.getTemporaryCache(p,!0);t&&(this.browserStorage.removeItem(this.generateCacheKey(p)),this.logger.verbose("Cached MSAL.js v1 id token retrieved"));const n=t||e;if(n){const e=We(n,fi);if(e.preferred_username)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint"),e.preferred_username;if(e.upn)return this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 upn as loginHint"),e.upn;this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, however, no account hint claim found. Enable preferred_username or upn id token claim to get SSO.")}return null}updateCredentialCacheKey(e,t,n){const r=Je(t);if(e!==r){const o=this.getItem(e);if(o)return this.browserStorage.removeItem(e),this.setItem(r,o,n),this.logger.verbose(`Updated an outdated ${t.credentialType} cache key`),r;this.logger.error(`Attempted to update an outdated ${t.credentialType} cache key but no item matching the outdated key was found in storage`)}return e}async hydrateCache(e,t){const n=Xe(e.account?.homeAccountId,e.account?.environment,e.idToken,this.clientId,e.tenantId);let r;t.claims&&(r=await this.cryptoImpl.hashString(t.claims));const o={idToken:n,accessToken:Ze(e.account?.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?e.expiresOn.getTime()/1e3:0,e.extExpiresOn?e.extExpiresOn.getTime()/1e3:0,fi,void 0,e.tokenType,void 0,t.sshKid,t.claims,r)};return this.saveCacheRecord(o,e.correlationId)}async saveCacheRecord(e,t,n){try{await super.saveCacheRecord(e,t,n)}catch(e){if(e instanceof an&&this.performanceClient&&t)try{const e=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:e.refreshToken.length,cacheIdCount:e.idToken.length,cacheAtCount:e.accessToken.length},t)}catch(e){}throw e}}}const Hi="msal:initializeEnd",Ki="msal:loginStart",$i="msal:loginSuccess",Gi="msal:loginFailure",Wi="msal:acquireTokenStart",Vi="msal:acquireTokenSuccess",Qi="msal:acquireTokenFailure",Yi="msal:ssoSilentStart",Ji="msal:ssoSilentSuccess",Xi="msal:ssoSilentFailure",Zi="msal:acquireTokenByCodeFailure",es="msal:handleRedirectStart",ts="msal:handleRedirectEnd",ns="msal:popupOpened",rs="msal:logoutStart",os="msal:logoutSuccess",as="msal:logoutFailure",is="msal:logoutEnd",ss="msal:restoreFromBFCache";class cs{constructor(e){this.eventCallbacks=new Map,this.logger=e||new U({})}addEventCallback(e,t,n){if("undefined"!=typeof window){const r=n||Ha();return this.eventCallbacks.has(r)?(this.logger.error(`Event callback with id: ${r} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(r,[e,t||[]]),this.logger.verbose(`Event callback registered with id: ${r}`),r)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,t,n,r){if("undefined"!=typeof window){const o={eventType:e,interactionType:t||null,payload:n||null,error:r||null,timestamp:Date.now()};this.eventCallbacks.forEach(([t,n],r)=>{(0===n.length||n.includes(e))&&(this.logger.verbose(`Emitting event to callback ${r}: ${e}`),t.apply(null,[o]))})}}}class ls extends Q{constructor(e,t,n,r,o){super(e,t,n),this.name="ServerError",this.errorNo=r,this.status=o,Object.setPrototypeOf(this,ls.prototype)}}class ds{static generateThrottlingStorageKey(e){return`${q}.${JSON.stringify(e)}`}static preProcess(e,t,n){const r=ds.generateThrottlingStorageKey(t),o=e.getThrottlingCache(r);if(o){if(o.throttleTime<Date.now())return void e.removeItem(r,n);throw new ls(o.errorCodes?.join(" ")||a.EMPTY_STRING,o.errorMessage,o.subError)}}static postProcess(e,t,n,r){if(ds.checkResponseStatus(n)||ds.checkResponseForRetryAfter(n)){const o={throttleTime:ds.calculateThrottleTime(parseInt(n.headers[l])),error:n.body.error,errorCodes:n.body.error_codes,errorMessage:n.body.error_description,subError:n.body.suberror};e.setThrottlingCache(ds.generateThrottlingStorageKey(t),o,r)}}static checkResponseStatus(e){return 429===e.status||e.status>=500&&e.status<600}static checkResponseForRetryAfter(e){return!!e.headers&&e.headers.hasOwnProperty(l)&&(e.status<200||e.status>=300)}static calculateThrottleTime(e){const t=e<=0?0:e,n=Date.now()/1e3;return Math.floor(1e3*Math.min(n+(t||60),n+3600))}static removeThrottle(e,t,n,r){const o={clientId:t,authority:n.authority,scopes:n.scopes,homeAccountIdentifier:r,claims:n.claims,authenticationScheme:n.authenticationScheme,resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,sshKid:n.sshKid},a=this.generateThrottlingStorageKey(o);e.removeItem(a,n.correlationId)}}const us="client_id",hs="redirect_uri",ps="response_type",fs="token_type",gs="req_cnf",ms="return_spa_code",vs="x-client-xtra-sku",bs="brk_client_id",ys="brk_redirect_uri";class xs{static validateRedirectUri(e){if(!e)throw Dt(ft)}static validatePrompt(e){const t=[];for(const e in S)t.push(S[e]);if(t.indexOf(e)<0)throw Dt(xt)}static validateClaims(e){try{JSON.parse(e)}catch(e){throw Dt(wt)}}static validateCodeChallengeParams(e,t){if(!e||!t)throw Dt(jt);this.validateCodeChallengeMethod(t)}static validateCodeChallengeMethod(e){if([j.PLAIN,j.S256].indexOf(e)<0)throw Dt(St)}}class ws{constructor(e,t){this.parameters=new Map,this.performanceClient=t,this.correlationId=e}addResponseTypeCode(){this.parameters.set(ps,encodeURIComponent(a.CODE_RESPONSE_TYPE))}addResponseTypeForTokenAndIdToken(){this.parameters.set(ps,encodeURIComponent(`${a.TOKEN_RESPONSE_TYPE} ${a.ID_TOKEN_RESPONSE_TYPE}`))}addResponseMode(e){this.parameters.set("response_mode",encodeURIComponent(e||I.QUERY))}addNativeBroker(){this.parameters.set("nativebroker",encodeURIComponent("1"))}addScopes(e,t=!0,n=i){!t||n.includes("openid")||e.includes("openid")||n.push("openid");const r=t?[...e||[],...n]:e||[],o=new qt(r);this.parameters.set("scope",encodeURIComponent(o.printScopes()))}addClientId(e){this.parameters.set(us,encodeURIComponent(e))}addRedirectUri(e){xs.validateRedirectUri(e),this.parameters.set(hs,encodeURIComponent(e))}addPostLogoutRedirectUri(e){xs.validateRedirectUri(e),this.parameters.set("post_logout_redirect_uri",encodeURIComponent(e))}addIdTokenHint(e){this.parameters.set("id_token_hint",encodeURIComponent(e))}addDomainHint(e){this.parameters.set("domain_hint",encodeURIComponent(e))}addLoginHint(e){this.parameters.set("login_hint",encodeURIComponent(e))}addCcsUpn(e){this.parameters.set(d,encodeURIComponent(`UPN:${e}`))}addCcsOid(e){this.parameters.set(d,encodeURIComponent(`Oid:${e.uid}@${e.utid}`))}addSid(e){this.parameters.set("sid",encodeURIComponent(e))}addClaims(e,t){const n=this.addClientCapabilitiesToClaims(e,t);xs.validateClaims(n),this.parameters.set("claims",encodeURIComponent(n))}addCorrelationId(e){this.parameters.set("client-request-id",encodeURIComponent(e))}addLibraryInfo(e){this.parameters.set("x-client-SKU",e.sku),this.parameters.set("x-client-VER",e.version),e.os&&this.parameters.set("x-client-OS",e.os),e.cpu&&this.parameters.set("x-client-CPU",e.cpu)}addApplicationTelemetry(e){e?.appName&&this.parameters.set("x-app-name",e.appName),e?.appVersion&&this.parameters.set("x-app-ver",e.appVersion)}addPrompt(e){xs.validatePrompt(e),this.parameters.set("prompt",encodeURIComponent(e))}addState(e){e&&this.parameters.set("state",encodeURIComponent(e))}addNonce(e){this.parameters.set("nonce",encodeURIComponent(e))}addCodeChallengeParams(e,t){if(xs.validateCodeChallengeParams(e,t),!e||!t)throw Dt(jt);this.parameters.set("code_challenge",encodeURIComponent(e)),this.parameters.set("code_challenge_method",encodeURIComponent(t))}addAuthorizationCode(e){this.parameters.set("code",encodeURIComponent(e))}addDeviceCode(e){this.parameters.set("device_code",encodeURIComponent(e))}addRefreshToken(e){this.parameters.set("refresh_token",encodeURIComponent(e))}addCodeVerifier(e){this.parameters.set("code_verifier",encodeURIComponent(e))}addClientSecret(e){this.parameters.set("client_secret",encodeURIComponent(e))}addClientAssertion(e){e&&this.parameters.set("client_assertion",encodeURIComponent(e))}addClientAssertionType(e){e&&this.parameters.set("client_assertion_type",encodeURIComponent(e))}addOboAssertion(e){this.parameters.set("assertion",encodeURIComponent(e))}addRequestTokenUse(e){this.parameters.set("requested_token_use",encodeURIComponent(e))}addGrantType(e){this.parameters.set("grant_type",encodeURIComponent(e))}addClientInfo(){this.parameters.set("client_info","1")}addExtraQueryParameters(e){Object.entries(e).forEach(([e,t])=>{!this.parameters.has(e)&&t&&this.parameters.set(e,t)})}addClientCapabilitiesToClaims(e,t){let n;if(e)try{n=JSON.parse(e)}catch(e){throw Dt(wt)}else n={};return t&&t.length>0&&(n.hasOwnProperty(C)||(n[C]={}),n[C].xms_cc={values:t}),JSON.stringify(n)}addUsername(e){this.parameters.set("username",encodeURIComponent(e))}addPassword(e){this.parameters.set("password",encodeURIComponent(e))}addPopToken(e){e&&(this.parameters.set(fs,F.POP),this.parameters.set(gs,encodeURIComponent(e)))}addSshJwk(e){e&&(this.parameters.set(fs,F.SSH),this.parameters.set(gs,encodeURIComponent(e)))}addServerTelemetry(e){this.parameters.set("x-client-current-telemetry",e.generateCurrentRequestHeaderValue()),this.parameters.set("x-client-last-telemetry",e.generateLastRequestHeaderValue())}addThrottling(){this.parameters.set("x-ms-lib-capability","retry-after, h429")}addLogoutHint(e){this.parameters.set("logout_hint",encodeURIComponent(e))}addBrokerParameters(e){const t={};t[bs]=e.brokerClientId,t[ys]=e.brokerRedirectUri,this.addExtraQueryParameters(t)}createQueryString(){const e=new Array;return this.parameters.forEach((t,n)=>{e.push(`${n}=${t}`)}),function(e,t,n){if(!t)return;const r=e.get(us);r&&e.has(bs)&&n?.addFields({embeddedClientId:r,embeddedRedirectUri:e.get(hs)},t)}(this.parameters,this.correlationId,this.performanceClient),e.join("&")}}async function ks(e,t,n,r,o,a,i){i?.addQueueMeasurement(vr,a);const s=Ci.transformCIAMAuthority(Si(e)),c=new Ci(s,t,n,r,o,a,i);try{return await wi(c.resolveEndpointsAsync.bind(c),br,o,i,a)(),c}catch(e){throw He(te)}}class Cs{constructor(e,t){this.config=function({authOptions:e,systemOptions:t,loggerOptions:n,cacheOptions:r,storageInterface:o,networkInterface:a,cryptoInterface:i,clientCredentials:s,libraryInfo:c,telemetry:l,serverTelemetryManager:d,persistencePlugin:u,serializableCache:h}){const p={...un,...n};return{authOptions:(f=e,{clientCapabilities:[],azureCloudOptions:mn,skipAuthorityMetadataCache:!1,instanceAware:!1,...f}),systemOptions:{...dn,...t},loggerOptions:p,cacheOptions:{...hn,...r},storageInterface:o||new ln(e.clientId,Ke,new U(p)),networkInterface:a||pn,cryptoInterface:i||Ke,clientCredentials:s||gn,libraryInfo:{...fn,...c},telemetry:{...vn,...l},serverTelemetryManager:d||null,persistencePlugin:u||null,serializableCache:h||null};var f}(e),this.logger=new U(this.config.loggerOptions,$e,Ge),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=t}createTokenRequestHeaders(e){const t={};if(t[c]=a.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case zi:try{const n=Ut(e.credential);t[d]=`Oid:${n.uid}@${n.utid}`}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case Li:t[d]=`UPN: ${e.credential}`}return t}async executePostToTokenEndpoint(e,t,n,r,o,a){a&&this.performanceClient?.addQueueMeasurement(a,o);const i=await this.sendPostRequest(r,e,{body:t,headers:n},o);return this.config.serverTelemetryManager&&i.status<500&&429!==i.status&&this.config.serverTelemetryManager.clearTelemetryCache(),i}async sendPostRequest(e,t,n,r){let o;ds.preProcess(this.cacheManager,e,r);try{o=await wi(this.networkClient.sendPostRequestAsync.bind(this.networkClient),Mn,this.logger,this.performanceClient,r)(t,n);const e=o.headers||{};this.performanceClient?.addFields({refreshTokenSize:o.body.refresh_token?.length||0,httpVerToken:e[h]||"",requestId:e[u]||""},r)}catch(e){if(e instanceof Ao){const t=e.responseHeaders;throw t&&this.performanceClient?.addFields({httpVerToken:t[h]||"",requestId:t[u]||"",contentTypeHeader:t[c]||void 0,contentLengthHeader:t["Content-Length"]||void 0,httpStatus:e.httpStatus},r),e.error}throw e instanceof Q?e:He(ne)}return ds.postProcess(this.cacheManager,e,o,r),o}async updateAuthority(e,t){this.performanceClient?.addQueueMeasurement(cr,t);const n=`https://${e}/${this.authority.tenant}/`,r=await ks(n,this.networkClient,this.cacheManager,this.authority.options,this.logger,t,this.performanceClient);this.authority=r}createTokenQueryParameters(e){const t=new ws(e.correlationId,this.performanceClient);return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenQueryParameters&&t.addExtraQueryParameters(e.tokenQueryParameters),t.addCorrelationId(e.correlationId),t.createQueryString()}}class Ss{constructor(e,t){this.cryptoUtils=e,this.performanceClient=t}async generateCnf(e,t){this.performanceClient?.addQueueMeasurement(pr,e.correlationId);const n=await wi(this.generateKid.bind(this),pr,t,this.performanceClient,e.correlationId)(e),r=this.cryptoUtils.base64UrlEncode(JSON.stringify(n));return{kid:n.kid,reqCnfString:r}}async generateKid(e){return this.performanceClient?.addQueueMeasurement(fr,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:"sw"}}async signPopToken(e,t,n){return this.signPayload(e,t,n)}async signPayload(e,t,n,r){const{resourceRequestMethod:o,resourceRequestUri:a,shrClaims:i,shrNonce:s,shrOptions:c}=n,l=a?new Yt(a):void 0,d=l?.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:Qe(),m:o?.toUpperCase(),u:d?.HostNameAndPort,nonce:s||this.cryptoUtils.createNewGuid(),p:d?.AbsolutePath,q:d?.QueryString?[[],d.QueryString]:void 0,client_claims:i||void 0,...r},t,c,n.correlationId)}}class js{constructor(e,t){this.cache=e,this.hasChanged=t}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}class Ts{constructor(e,t,n,r,o,a,i){this.clientId=e,this.cacheStorage=t,this.cryptoObj=n,this.logger=r,this.serializableCache=o,this.persistencePlugin=a,this.performanceClient=i}validateServerAuthorizationCodeResponse(e,t){if(!e.state||!t)throw e.state?He(se,"Cached State"):He(se,"Server State");let n,r;try{n=decodeURIComponent(e.state)}catch(t){throw He(ae,e.state)}try{r=decodeURIComponent(t)}catch(t){throw He(ae,e.state)}if(n!==r)throw He(ie);if(e.error||e.error_description||e.suberror){const t=function(e){const t=e.error_uri?.lastIndexOf("code=");return t&&t>=0?e.error_uri?.substring(t+5):void 0}(e);if(Oi(e.error,e.error_description,e.suberror))throw new Pi(e.error||"",e.error_description,e.suberror,e.timestamp||"",e.trace_id||"",e.correlation_id||"",e.claims||"",t);throw new ls(e.error||"",e.error_description,e.suberror,t)}}validateTokenResponse(e,t){if(e.error||e.error_description||e.suberror){const n=`Error(s): ${e.error_codes||a.NOT_AVAILABLE} - Timestamp: ${e.timestamp||a.NOT_AVAILABLE} - Description: ${e.error_description||a.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||a.NOT_AVAILABLE} - Trace ID: ${e.trace_id||a.NOT_AVAILABLE}`,r=e.error_codes?.length?e.error_codes[0]:void 0,o=new ls(e.error,n,e.suberror,r,e.status);if(t&&e.status&&e.status>=500&&e.status<=599)return void this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed.\n${o}`);if(t&&e.status&&e.status>=400&&e.status<=499)return void this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token.\n${o}`);if(Oi(e.error,e.error_description,e.suberror))throw new Pi(e.error,e.error_description,e.suberror,e.timestamp||a.EMPTY_STRING,e.trace_id||a.EMPTY_STRING,e.correlation_id||a.EMPTY_STRING,e.claims||a.EMPTY_STRING,r);throw o}}async handleServerTokenResponse(e,t,n,r,o,i,s,c,l){let d,u;if(this.performanceClient?.addQueueMeasurement(gr,e.correlation_id),e.id_token){if(d=We(e.id_token||a.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw He(ce);if(r.maxAge||0===r.maxAge){const e=d.auth_time;if(!e)throw He(le);Ve(e,r.maxAge)}}this.homeAccountIdentifier=Wt.generateHomeAccountId(e.client_info||a.EMPTY_STRING,t.authorityType,this.logger,this.cryptoObj,d),o&&o.state&&(u=Mi.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||r.sshKid||void 0;const h=this.generateCacheRecord(e,t,n,r,d,i,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new js(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),s&&!c&&h.account){const e=h.account.generateAccountKey();if(!this.cacheStorage.getAccount(e,r.correlationId,this.logger))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await Ts.generateAuthenticationResult(this.cryptoObj,t,h,!1,r,d,u,void 0,l)}await this.cacheStorage.saveCacheRecord(h,r.correlationId,r.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return Ts.generateAuthenticationResult(this.cryptoObj,t,h,!1,r,d,u,e,l)}generateCacheRecord(e,t,n,r,o,a,i){const s=t.getPreferredCache();if(!s)throw He(Ce);const c=Gt(o);let l,d;e.id_token&&o&&(l=Xe(this.homeAccountIdentifier,s,e.id_token,this.clientId,c||""),d=Is(this.cacheStorage,t,this.homeAccountIdentifier,this.cryptoObj.base64Decode,r.correlationId,o,e.client_info,s,c,i,void 0,this.logger));let u=null;if(e.access_token){const o=e.scope?qt.fromString(e.scope):new qt(r.scopes||[]),i=("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0,l=("string"==typeof e.ext_expires_in?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,d=("string"==typeof e.refresh_in?parseInt(e.refresh_in,10):e.refresh_in)||void 0,h=n+i,p=h+l,f=d&&d>0?n+d:void 0;u=Ze(this.homeAccountIdentifier,s,e.access_token,this.clientId,c||t.tenant||"",o.printScopes(),h,p,this.cryptoObj.base64Decode,f,e.token_type,a,e.key_id,r.claims,r.requestedClaimsHash)}let h=null;if(e.refresh_token){let t;e.refresh_token_expires_in&&(t=n+("string"==typeof e.refresh_token_expires_in?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in)),h=et(this.homeAccountIdentifier,s,e.refresh_token,this.clientId,e.foci,a,t)}let p=null;return e.foci&&(p={clientId:this.clientId,environment:s,familyId:e.foci}),{account:d,idToken:l,accessToken:u,refreshToken:h,appMetadata:p}}static async generateAuthenticationResult(e,t,n,r,o,i,s,c,l){let d,u,h=a.EMPTY_STRING,p=[],f=null,g=a.EMPTY_STRING;if(n.accessToken){if(n.accessToken.tokenType!==F.POP||o.popKid)h=n.accessToken.secret;else{const t=new Ss(e),{secret:r,keyId:a}=n.accessToken;if(!a)throw He(Me);h=await t.signPopToken(r,a,o)}p=qt.fromString(n.accessToken.target).asArray(),f=new Date(1e3*Number(n.accessToken.expiresOn)),d=new Date(1e3*Number(n.accessToken.extendedExpiresOn)),n.accessToken.refreshOn&&(u=new Date(1e3*Number(n.accessToken.refreshOn)))}n.appMetadata&&(g=n.appMetadata.familyId===P?P:"");const m=i?.oid||i?.sub||"",v=i?.tid||"";c?.spa_accountid&&n.account&&(n.account.nativeAccountId=c?.spa_accountid);const b=n.account?$t(n.account.getAccountInfo(),void 0,i,n.idToken?.secret):null;return{authority:t.canonicalAuthority,uniqueId:m,tenantId:v,scopes:p,account:b,idToken:n?.idToken?.secret||"",idTokenClaims:i||{},accessToken:h,fromCache:r,expiresOn:f,extExpiresOn:d,refreshOn:u,correlationId:o.correlationId,requestId:l||a.EMPTY_STRING,familyId:g,tokenType:n.accessToken?.tokenType||a.EMPTY_STRING,state:s?s.userRequestState:a.EMPTY_STRING,cloudGraphHostName:n.account?.cloudGraphHostName||a.EMPTY_STRING,msGraphHost:n.account?.msGraphHost||a.EMPTY_STRING,code:c?.spa_code,fromNativeBroker:!1}}}function Is(e,t,n,r,o,a,i,s,c,l,d,u){u?.verbose("setCachedAccount called");const h=e.getAccountKeys().find(e=>e.startsWith(n));let p=null;h&&(p=e.getAccount(h,o,u));const f=p||Wt.createAccount({homeAccountId:n,idTokenClaims:a,clientInfo:i,environment:s,cloudGraphHostName:l?.cloud_graph_host_name,msGraphHost:l?.msgraph_host,nativeAccountId:d},t,r),g=f.tenantProfiles||[],m=c||f.realm;if(m&&!g.find(e=>e.tenantId===m)){const e=Kt(n,f.localAccountId,m,a);g.push(e)}return f.tenantProfiles=g,f}async function As(e,t,n){return"string"==typeof e?e:e({clientId:t,tokenEndpoint:n})}class Ns extends Cs{constructor(e,t){super(e,t),this.includeRedirectUri=!0,this.oidcDefaultScopes=this.config.authOptions.authority.options.OIDCOptions?.defaultScopes}async getAuthCodeUrl(e){this.performanceClient?.addQueueMeasurement(ar,e.correlationId);const t=await wi(this.createAuthCodeUrlQueryString.bind(this),hr,this.logger,this.performanceClient,e.correlationId)(e);return Yt.appendQueryString(this.authority.authorizationEndpoint,t)}async acquireToken(e,t){if(this.performanceClient?.addQueueMeasurement(lr,e.correlationId),!e.code)throw He(fe);const n=Qe(),r=await wi(this.executeTokenRequest.bind(this),dr,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=r.headers?.[u],a=new Ts(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return a.validateTokenResponse(r.body),wi(a.handleServerTokenResponse.bind(a),gr,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,t,void 0,void 0,void 0,o)}handleFragmentResponse(e,t){if(new Ts(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,null,null).validateServerAuthorizationCodeResponse(e,t),!e.code)throw He(Pe);return e}getLogoutUri(e){if(!e)throw Dt(Ct);const t=this.createLogoutUrlQueryString(e);return Yt.appendQueryString(this.authority.endSessionEndpoint,t)}async executeTokenRequest(e,t){this.performanceClient?.addQueueMeasurement(dr,t.correlationId);const n=this.createTokenQueryParameters(t),r=Yt.appendQueryString(e.tokenEndpoint,n),o=await wi(this.createTokenRequestBody.bind(this),ur,this.logger,this.performanceClient,t.correlationId)(t);let a;if(t.clientInfo)try{const e=Bt(t.clientInfo,this.cryptoUtils.base64Decode);a={credential:`${e.uid}.${e.utid}`,type:zi}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}const i=this.createTokenRequestHeaders(a||t.ccsCredential),s={clientId:t.tokenBodyParameters?.clientId||this.config.authOptions.clientId,authority:e.canonicalAuthority,scopes:t.scopes,claims:t.claims,authenticationScheme:t.authenticationScheme,resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,sshKid:t.sshKid};return wi(this.executePostToTokenEndpoint.bind(this),Ln,this.logger,this.performanceClient,t.correlationId)(r,o,i,s,t.correlationId,Ln)}async createTokenRequestBody(e){this.performanceClient?.addQueueMeasurement(ur,e.correlationId);const t=new ws(e.correlationId,this.performanceClient);if(t.addClientId(e.embeddedClientId||e.tokenBodyParameters?.[us]||this.config.authOptions.clientId),this.includeRedirectUri?t.addRedirectUri(e.redirectUri):xs.validateRedirectUri(e.redirectUri),t.addScopes(e.scopes,!0,this.oidcDefaultScopes),t.addAuthorizationCode(e.code),t.addLibraryInfo(this.config.libraryInfo),t.addApplicationTelemetry(this.config.telemetry.application),t.addThrottling(),this.serverTelemetryManager&&!bn(this.config)&&t.addServerTelemetry(this.serverTelemetryManager),e.codeVerifier&&t.addCodeVerifier(e.codeVerifier),this.config.clientCredentials.clientSecret&&t.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const n=this.config.clientCredentials.clientAssertion;t.addClientAssertion(await As(n.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),t.addClientAssertionType(n.assertionType)}if(t.addGrantType("authorization_code"),t.addClientInfo(),e.authenticationScheme===F.POP){const n=new Ss(this.cryptoUtils,this.performanceClient);let r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await wi(n.generateCnf.bind(n),pr,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,t.addPopToken(r)}else if(e.authenticationScheme===F.SSH){if(!e.sshJwk)throw Dt(Nt);t.addSshJwk(e.sshJwk)}let n;if((!Ft.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&t.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.clientInfo)try{const t=Bt(e.clientInfo,this.cryptoUtils.base64Decode);n={credential:`${t.uid}.${t.utid}`,type:zi}}catch(e){this.logger.verbose("Could not parse client info for CCS Header: "+e)}else n=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&n)switch(n.type){case zi:try{const e=Ut(n.credential);t.addCcsOid(e)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case Li:t.addCcsUpn(n.credential)}return e.embeddedClientId&&t.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&t.addExtraQueryParameters(e.tokenBodyParameters),!e.enableSpaAuthorizationCode||e.tokenBodyParameters&&e.tokenBodyParameters[ms]||t.addExtraQueryParameters({[ms]:"1"}),t.createQueryString()}async createAuthCodeUrlQueryString(e){const t=e.correlationId||this.config.cryptoInterface.createNewGuid();this.performanceClient?.addQueueMeasurement(hr,t);const n=new ws(t,this.performanceClient);n.addClientId(e.embeddedClientId||e.extraQueryParameters?.[us]||this.config.authOptions.clientId);const r=[...e.scopes||[],...e.extraScopesToConsent||[]];if(n.addScopes(r,!0,this.oidcDefaultScopes),n.addRedirectUri(e.redirectUri),n.addCorrelationId(t),n.addResponseMode(e.responseMode),n.addResponseTypeCode(),n.addLibraryInfo(this.config.libraryInfo),bn(this.config)||n.addApplicationTelemetry(this.config.telemetry.application),n.addClientInfo(),e.codeChallenge&&e.codeChallengeMethod&&n.addCodeChallengeParams(e.codeChallenge,e.codeChallengeMethod),e.prompt&&n.addPrompt(e.prompt),e.domainHint&&n.addDomainHint(e.domainHint),e.prompt!==S.SELECT_ACCOUNT)if(e.sid&&e.prompt===S.NONE)this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),n.addSid(e.sid);else if(e.account){const t=this.extractAccountSid(e.account);let r=this.extractLoginHint(e.account);if(r&&e.domainHint&&(this.logger.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),r=null),r){this.logger.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),n.addLoginHint(r);try{const t=Ut(e.account.homeAccountId);n.addCcsOid(t)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(t&&e.prompt===S.NONE){this.logger.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),n.addSid(t);try{const t=Ut(e.account.homeAccountId);n.addCcsOid(t)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint);else if(e.account.username){this.logger.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),n.addLoginHint(e.account.username);try{const t=Ut(e.account.homeAccountId);n.addCcsOid(t)}catch(e){this.logger.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(this.logger.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),n.addLoginHint(e.loginHint),n.addCcsUpn(e.loginHint));else this.logger.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");if(e.nonce&&n.addNonce(e.nonce),e.state&&n.addState(e.state),(e.claims||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),this.addExtraQueryParams(e,n),e.nativeBroker&&(n.addNativeBroker(),e.authenticationScheme===F.POP)){const t=new Ss(this.cryptoUtils);let r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await wi(t.generateCnf.bind(t),pr,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(r)}return n.createQueryString()}createLogoutUrlQueryString(e){const t=new ws(e.correlationId,this.performanceClient);return e.postLogoutRedirectUri&&t.addPostLogoutRedirectUri(e.postLogoutRedirectUri),e.correlationId&&t.addCorrelationId(e.correlationId),e.idTokenHint&&t.addIdTokenHint(e.idTokenHint),e.state&&t.addState(e.state),e.logoutHint&&t.addLogoutHint(e.logoutHint),this.addExtraQueryParams(e,t),t.createQueryString()}addExtraQueryParams(e,t){!(e.extraQueryParameters&&e.extraQueryParameters.hasOwnProperty("instance_aware"))&&this.config.authOptions.instanceAware&&(e.extraQueryParameters=e.extraQueryParameters||{},e.extraQueryParameters.instance_aware="true"),e.extraQueryParameters&&t.addExtraQueryParameters(e.extraQueryParameters)}extractAccountSid(e){return e.idTokenClaims?.sid||null}extractLoginHint(e){return e.idTokenClaims?.login_hint||null}}class Es{constructor(e,t){this.cacheOutcome="0",this.cacheManager=t,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||a.EMPTY_STRING,this.wrapperVer=e.wrapperVer||a.EMPTY_STRING,this.telemetryCacheKey=D.CACHE_KEY+N+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${D.VALUE_SEPARATOR}${this.cacheOutcome}`,t=[this.wrapperSKU,this.wrapperVer],n=this.getNativeBrokerErrorCode();n?.length&&t.push(`broker_error=${n}`);const r=t.join(D.VALUE_SEPARATOR),o=[e,this.getRegionDiscoveryFields()].join(D.VALUE_SEPARATOR);return[D.SCHEMA_VERSION,o,r].join(D.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),t=Es.maxErrorsToSend(e),n=e.failedRequests.slice(0,2*t).join(D.VALUE_SEPARATOR),r=e.errors.slice(0,t).join(D.VALUE_SEPARATOR),o=e.errors.length,a=[o,t<o?D.OVERFLOW_TRUE:D.OVERFLOW_FALSE].join(D.VALUE_SEPARATOR);return[D.SCHEMA_VERSION,e.cacheHits,n,r,a].join(D.CATEGORY_SEPARATOR)}cacheFailedRequest(e){const t=this.getLastRequests();t.errors.length>=D.MAX_CACHED_ERRORS&&(t.failedRequests.shift(),t.failedRequests.shift(),t.errors.shift()),t.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof Q?e.subError?t.errors.push(e.subError):e.errorCode?t.errors.push(e.errorCode):t.errors.push(e.toString()):t.errors.push(e.toString()):t.errors.push(D.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||{failedRequests:[],errors:[],cacheHits:0}}clearTelemetryCache(){const e=this.getLastRequests(),t=Es.maxErrorsToSend(e);if(t===e.errors.length)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const n={failedRequests:e.failedRequests.slice(2*t),errors:e.errors.slice(t),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}}static maxErrorsToSend(e){let t,n=0,r=0;const o=e.errors.length;for(t=0;t<o;t++){const o=e.failedRequests[2*t]||a.EMPTY_STRING,i=e.failedRequests[2*t+1]||a.EMPTY_STRING,s=e.errors[t]||a.EMPTY_STRING;if(r+=o.toString().length+i.toString().length+s.length+3,!(r<D.MAX_LAST_HEADER_BYTES))break;n+=1}return n}getRegionDiscoveryFields(){const e=[];return e.push(this.regionUsed||a.EMPTY_STRING),e.push(this.regionSource||a.EMPTY_STRING),e.push(this.regionOutcome||a.EMPTY_STRING),e.join(",")}updateRegionDiscoveryMetadata(e){this.regionUsed=e.region_used,this.regionSource=e.region_source,this.regionOutcome=e.region_outcome}setCacheOutcome(e){this.cacheOutcome=e}setNativeBrokerErrorCode(e){const t=this.getLastRequests();t.nativeBrokerErrorCode=e,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,t,this.correlationId)}getNativeBrokerErrorCode(){return this.getLastRequests().nativeBrokerErrorCode}clearNativeBrokerErrorCode(){const e=this.getLastRequests();delete e.nativeBrokerErrorCode,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId)}static makeExtraSkuString(e){return function(e){const{skus:t,libraryName:n,libraryVersion:r,extensionName:o,extensionVersion:a}=e,i=new Map([[0,[n,r]],[2,[o,a]]]);let s=[];if(t?.length){if(s=t.split(","),s.length<4)return t}else s=Array.from({length:4},()=>"|");return i.forEach((e,t)=>{2===e.length&&e[0]?.length&&e[1]?.length&&function(e){const{skuArr:t,index:n,skuName:r,skuVersion:o}=e;n>=t.length||(t[n]=[r,o].join("|"))}({skuArr:s,index:t,skuName:e[0],skuVersion:e[1]})}),s.join(",")}(e)}}class _s{constructor(e,t,n,r,o,a,i,s,c){this.config=e,this.browserStorage=t,this.browserCrypto=n,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=a,this.nativeMessageHandler=s,this.correlationId=c||Ha(),this.logger=r.clone(Kr,ai,this.correlationId),this.performanceClient=i}async clearCacheOnLogout(e){if(e){Wt.accountInfoIsEqual(e,this.browserStorage.getActiveAccount(this.correlationId),!1)&&(this.logger.verbose("Setting active account to null"),this.browserStorage.setActiveAccount(null,this.correlationId));try{await this.browserStorage.removeAccount(Wt.generateAccountCacheKey(e),this.correlationId),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch(e){this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),await this.browserStorage.clear(this.correlationId),await this.browserCrypto.clearKeystore()}catch(e){this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const t=e||this.config.auth.redirectUri;return Yt.getAbsoluteUrl(t,Za())}initializeServerTelemetryManager(e,t){this.logger.verbose("initializeServerTelemetryManager called");const n={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:t||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Es(n,this.browserStorage)}async getDiscoveredAuthority(e){const{account:t}=e,n=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(Pn,this.correlationId);const r={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,a=n?.length?"true"===n:this.config.auth.instanceAware,i=t&&a?this.config.auth.authority.replace(Yt.getDomainFromUrl(o),t.environment):o,s=Ci.generateAuthority(i,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),c=await wi(ks,vr,this.logger,this.performanceClient,this.correlationId)(s,this.config.system.networkClient,this.browserStorage,r,this.logger,this.correlationId,this.performanceClient);if(t&&!c.isAlias(t.environment))throw Dt(Mt);return c}}async function Ps(e,t,n){e.addQueueMeasurement(Rr,n);const r=xi(Os,Mr,t,e,n)(e,t,n);return{verifier:r,challenge:await wi(Rs,zr,t,e,n)(r,e,t,n)}}function Os(e,t,n){try{const r=new Uint8Array(32);return xi(Ba,Dr,t,e,n)(r),Pa(r)}catch(e){throw Ia(Eo)}}async function Rs(e,t,n,r){t.addQueueMeasurement(zr,r);try{const o=await wi(qa,Lr,n,t,r)(e,t,r);return Pa(new Uint8Array(o))}catch(e){throw Ia(Eo)}}async function Ms(e,t,n,r){n.addQueueMeasurement(Wn,e.correlationId);const o=e.authority||t.auth.authority,a=[...e&&e.scopes||[]],i={...e,correlationId:e.correlationId,authority:o,scopes:a};if(i.authenticationScheme){if(i.authenticationScheme===F.SSH){if(!e.sshJwk)throw Dt(Nt);if(!e.sshKid)throw Dt(Et)}r.verbose(`Authentication Scheme set to "${i.authenticationScheme}" as configured in Auth request`)}else i.authenticationScheme=F.BEARER,r.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');return t.cache.claimsBasedCachingEnabled&&e.claims&&!Ft.isEmptyObj(e.claims)&&(i.requestedClaimsHash=await $a(e.claims)),i}async function zs(e,t,n,r,o){r.addQueueMeasurement(Vn,e.correlationId);const a=await wi(Ms,Wn,o,r,e.correlationId)(e,n,r,o);return{...e,...a,account:t,forceRefresh:e.forceRefresh||!1}}class Ls extends _s{async initializeAuthorizationCodeRequest(e){this.performanceClient.addQueueMeasurement(or,this.correlationId);const t=await wi(Ps,Rr,this.logger,this.performanceClient,this.correlationId)(this.performanceClient,this.logger,this.correlationId),n={...e,redirectUri:e.redirectUri,code:a.EMPTY_STRING,codeVerifier:t.verifier};return e.codeChallenge=t.challenge,e.codeChallengeMethod=a.S256_CODE_CHALLENGE_METHOD,n}initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e?.correlationId);const t={correlationId:this.correlationId||Ha(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const n=this.getLogoutHintFromIdTokenClaims(e.account);n&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),t.logoutHint=n)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return e&&null===e.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",t.correlationId):e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",t.correlationId),t.postLogoutRedirectUri=Yt.getAbsoluteUrl(e.postLogoutRedirectUri,Za())):null===this.config.auth.postLogoutRedirectUri?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",t.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",t.correlationId),t.postLogoutRedirectUri=Yt.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Za())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",t.correlationId),t.postLogoutRedirectUri=Yt.getAbsoluteUrl(Za(),Za())),t}getLogoutHintFromIdTokenClaims(e){const t=e.idTokenClaims;if(t){if(t.login_hint)return t.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(tr,this.correlationId);const t=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,this.correlationId)(e);return new Ns(t,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:t,requestAuthority:n,requestAzureCloudOptions:r,requestExtraQueryParameters:o,account:i}=e;this.performanceClient.addQueueMeasurement(nr,this.correlationId);const s=await wi(this.getDiscoveredAuthority.bind(this),Pn,this.logger,this.performanceClient,this.correlationId)({requestAuthority:n,requestAzureCloudOptions:r,requestExtraQueryParameters:o,account:i}),c=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:s,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:c.loggerCallback,piiLoggingEnabled:c.piiLoggingEnabled,logLevel:c.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:t,libraryInfo:{sku:Kr,version:ai,cpu:a.EMPTY_STRING,os:a.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,t){this.performanceClient.addQueueMeasurement(rr,this.correlationId);const n=this.getRedirectUri(e.redirectUri),r={interactionType:t},o=Mi.setRequestState(this.browserCrypto,e&&e.state||a.EMPTY_STRING,r),i={...await wi(Ms,Wn,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:n,state:o,nonce:e.nonce||Ha(),responseMode:this.config.auth.OIDCOptions.serverResponseType};if(e.loginHint||e.sid)return i;const s=e.account||this.browserStorage.getActiveAccount(this.correlationId);if(s&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${s.homeAccountId}`,this.correlationId),i.account=s),!i.loginHint&&!s){const e=this.browserStorage.getLegacyLoginHint();e&&(i.loginHint=e)}return i}}const Ds="user_switch",Fs={[Ds]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class qs extends Q{constructor(e,t,n){super(e,t),Object.setPrototypeOf(this,qs.prototype),this.name="NativeAuthError",this.ext=n}}function Bs(e){return!(!e.ext||!e.ext.status||"PERSISTENT_ERROR"!==e.ext.status&&"DISABLED"!==e.ext.status)||!(!e.ext||!e.ext.error||-2147186943!==e.ext.error)||"ContentError"===e.errorCode}function Us(e,t,n){if(n&&n.status)switch(n.status){case"ACCOUNT_UNAVAILABLE":return Ri(Ti);case"USER_INTERACTION_REQUIRED":return new Pi(e,t);case"USER_CANCEL":return Ia(Bo);case"NO_NETWORK":return Ia(oa)}return new qs(e,Fs[e]||t,n)}class Hs extends Cs{constructor(e,t){super(e,t)}async acquireToken(e){this.performanceClient?.addQueueMeasurement(Fn,e.correlationId);const t=Qe(),n=await wi(this.executeTokenRequest.bind(this),Dn,this.logger,this.performanceClient,e.correlationId)(e,this.authority),r=n.headers?.[u],o=new Ts(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(n.body),wi(o.handleServerTokenResponse.bind(o),gr,this.logger,this.performanceClient,e.correlationId)(n.body,this.authority,t,e,void 0,void 0,!0,e.forceCache,r)}async acquireTokenByRefreshToken(e){if(!e)throw Dt(kt);if(this.performanceClient?.addQueueMeasurement(Bn,e.correlationId),!e.account)throw He(we);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await wi(this.acquireTokenWithCachedRefreshToken.bind(this),qn,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(t){const n=t instanceof Pi&&t.errorCode===ji,r=t instanceof ls&&"invalid_grant"===t.errorCode&&"client_mismatch"===t.subError;if(n||r)return wi(this.acquireTokenWithCachedRefreshToken.bind(this),qn,this.logger,this.performanceClient,e.correlationId)(e,!1);throw t}return wi(this.acquireTokenWithCachedRefreshToken.bind(this),qn,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,t){this.performanceClient?.addQueueMeasurement(qn,e.correlationId);const n=xi(this.cacheManager.getRefreshToken.bind(this.cacheManager),Or,this.logger,this.performanceClient,e.correlationId)(e.account,t,e.correlationId,void 0,this.performanceClient);if(!n)throw Ri(ji);if(n.expiresOn&&Ye(n.expiresOn,e.refreshTokenExpirationOffsetSeconds||300))throw Ri(Ii);const r={...e,refreshToken:n.secret,authenticationScheme:e.authenticationScheme||F.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:zi}};try{return await wi(this.acquireToken.bind(this),Fn,this.logger,this.performanceClient,e.correlationId)(r)}catch(t){if(t instanceof Pi&&t.subError===Ai){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const t=Je(n);this.cacheManager.removeRefreshToken(t,e.correlationId)}throw t}}async executeTokenRequest(e,t){this.performanceClient?.addQueueMeasurement(Dn,e.correlationId);const n=this.createTokenQueryParameters(e),r=Yt.appendQueryString(t.tokenEndpoint,n),o=await wi(this.createTokenRequestBody.bind(this),Un,this.logger,this.performanceClient,e.correlationId)(e),a=this.createTokenRequestHeaders(e.ccsCredential),i={clientId:e.tokenBodyParameters?.clientId||this.config.authOptions.clientId,authority:t.canonicalAuthority,scopes:e.scopes,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid};return wi(this.executePostToTokenEndpoint.bind(this),zn,this.logger,this.performanceClient,e.correlationId)(r,o,a,i,e.correlationId,zn)}async createTokenRequestBody(e){this.performanceClient?.addQueueMeasurement(Un,e.correlationId);const t=e.correlationId,n=new ws(t,this.performanceClient);if(n.addClientId(e.embeddedClientId||e.tokenBodyParameters?.[us]||this.config.authOptions.clientId),e.redirectUri&&n.addRedirectUri(e.redirectUri),n.addScopes(e.scopes,!0,this.config.authOptions.authority.options.OIDCOptions?.defaultScopes),n.addGrantType("refresh_token"),n.addClientInfo(),n.addLibraryInfo(this.config.libraryInfo),n.addApplicationTelemetry(this.config.telemetry.application),n.addThrottling(),this.serverTelemetryManager&&!bn(this.config)&&n.addServerTelemetry(this.serverTelemetryManager),n.addRefreshToken(e.refreshToken),this.config.clientCredentials.clientSecret&&n.addClientSecret(this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const t=this.config.clientCredentials.clientAssertion;n.addClientAssertion(await As(t.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),n.addClientAssertionType(t.assertionType)}if(e.authenticationScheme===F.POP){const t=new Ss(this.cryptoUtils,this.performanceClient);let r;r=e.popKid?this.cryptoUtils.encodeKid(e.popKid):(await wi(t.generateCnf.bind(t),pr,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,n.addPopToken(r)}else if(e.authenticationScheme===F.SSH){if(!e.sshJwk)throw Dt(Nt);n.addSshJwk(e.sshJwk)}if((!Ft.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&n.addClaims(e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case zi:try{const t=Ut(e.ccsCredential.credential);n.addCcsOid(t)}catch(e){this.logger.verbose("Could not parse home account ID for CCS Header: "+e)}break;case Li:n.addCcsUpn(e.ccsCredential.credential)}return e.embeddedClientId&&n.addBrokerParameters({brokerClientId:this.config.authOptions.clientId,brokerRedirectUri:this.config.authOptions.redirectUri}),e.tokenBodyParameters&&n.addExtraQueryParameters(e.tokenBodyParameters),n.createQueryString()}}class Ks extends Cs{constructor(e,t){super(e,t)}async acquireToken(e){try{const[t,n]=await this.acquireCachedToken({...e,scopes:e.scopes?.length?e.scopes:[...i]});return"4"===n&&(this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."),new Hs(this.config,this.performanceClient).acquireTokenByRefreshToken(e).catch(()=>{})),t}catch(t){if(t instanceof Ue&&t.errorCode===Ne)return new Hs(this.config,this.performanceClient).acquireTokenByRefreshToken(e);throw t}}async acquireCachedToken(e){this.performanceClient?.addQueueMeasurement(Kn,e.correlationId);let t="0";if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Ft.isEmptyObj(e.claims))throw this.setCacheOutcome("1",e.correlationId),He(Ne);if(!e.account)throw He(we);const n=e.account.tenantId||function(e){const t=new Yt(e).getUrlComponents(),n=t.PathSegments.slice(-1)[0]?.toLowerCase();switch(n){case x:case w:case k:return;default:return n}}(e.authority),r=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,r,n,this.performanceClient);if(!o)throw this.setCacheOutcome("2",e.correlationId),He(Ne);if(a=o.cachedAt,Number(a)>Qe()||Ye(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome("3",e.correlationId),He(Ne);var a;o.refreshOn&&Ye(o.refreshOn,0)&&(t="4");const i=e.authority||this.authority.getPreferredCache(),s={account:this.cacheManager.readAccountFromCache(e.account,e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,r,n,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(i)};return this.setCacheOutcome(t,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await wi(this.generateResultFromCacheRecord.bind(this),$n,this.logger,this.performanceClient,e.correlationId)(s,e),t]}setCacheOutcome(e,t){this.serverTelemetryManager?.setCacheOutcome(e),this.performanceClient?.addFields({cacheOutcome:e},t),"0"!==e&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,t){let n;if(this.performanceClient?.addQueueMeasurement($n,t.correlationId),e.idToken&&(n=We(e.idToken.secret,this.config.cryptoInterface.base64Decode)),t.maxAge||0===t.maxAge){const e=n?.auth_time;if(!e)throw He(le);Ve(e,t.maxAge)}return Ts.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,t,n)}}class $s extends Ls{async acquireToken(e){this.performanceClient.addQueueMeasurement(An,e.correlationId);const t=this.initializeServerTelemetryManager(61),n=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),r=new Ks(n,this.performanceClient);this.logger.verbose("Silent auth client created");try{const t=(await wi(r.acquireCachedToken.bind(r),Kn,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),t}catch(e){throw e instanceof Ta&&e.errorCode===la&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),e}}logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(t?.account)}}class Gs extends _s{constructor(e,t,n,r,o,a,i,s,c,l,d,u){super(e,t,n,r,o,a,s,c,u),this.apiId=i,this.accountId=l,this.nativeMessageHandler=c,this.nativeStorageManager=d,this.silentCacheClient=new $s(e,this.nativeStorageManager,n,r,o,a,s,c,u),this.serverTelemetryManager=this.initializeServerTelemetryManager(this.apiId);const h=this.nativeMessageHandler.getExtensionId()===Gr?"chrome":this.nativeMessageHandler.getExtensionId()?.length?"unknown":void 0;this.skus=Es.makeExtraSkuString({libraryName:Kr,libraryVersion:ai,extensionName:h,extensionVersion:this.nativeMessageHandler.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[vs]:this.skus}}async acquireToken(e){this.performanceClient.addQueueMeasurement(Rn,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const t=this.performanceClient.startMeasurement(Rn,e.correlationId),n=Qe();try{const r=await this.initializeNativeRequest(e);try{const e=await this.acquireTokensFromCache(this.accountId,r);return t.end({success:!0,isNativeBroker:!1,fromCache:!0}),e}catch(e){this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const{...o}=r,a={method:Vr,request:o},i=await this.nativeMessageHandler.sendMessage(a),s=this.validateNativeResponse(i);return await this.handleNativeResponse(s,r,n).then(e=>(t.end({success:!0,isNativeBroker:!0,requestId:e.requestId}),this.serverTelemetryManager.clearNativeBrokerErrorCode(),e)).catch(e=>{throw t.end({success:!1,errorCode:e.errorCode,subErrorCode:e.subError,isNativeBroker:!0}),e})}catch(e){throw e instanceof qs&&this.serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode),e}}createSilentCacheRequest(e,t){return{authority:e.authority,correlationId:this.correlationId,scopes:qt.fromString(e.scope).asArray(),account:t,forceRefresh:!1}}async acquireTokensFromCache(e,t){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),He(Se);const n=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},t.correlationId);if(!n)throw He(Se);try{const e=this.createSilentCacheRequest(t,n),r=await this.silentCacheClient.acquireToken(e),o={...n,idTokenClaims:r?.idTokenClaims,idToken:r?.idToken};return{...r,account:o}}catch(e){throw e}}async acquireTokenRedirect(e,t){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...n}=e;delete n.onRedirectNavigate;const r=await this.initializeNativeRequest(n),o={method:Vr,request:r};try{const e=await this.nativeMessageHandler.sendMessage(o);this.validateNativeResponse(e)}catch(e){if(e instanceof qs&&(this.serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode),Bs(e)))throw e}this.browserStorage.setTemporaryCache(ao,JSON.stringify(r),!0);const a={apiId:ho,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);t.end({success:!0}),await this.navigationClient.navigateExternal(i,a)}async handleRedirectPromise(e,t){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const n=this.browserStorage.getCachedNativeRequest();if(!n)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&t&&e?.addFields({errorCode:"no_cached_request"},t),null;const{prompt:r,...o}=n;r&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(ao));const a={method:Vr,request:o},i=Qe();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const e=await this.nativeMessageHandler.sendMessage(a);this.validateNativeResponse(e);const t=this.handleNativeResponse(e,o,i);this.browserStorage.setInteractionInProgress(!1);const n=await t;return this.serverTelemetryManager.clearNativeBrokerErrorCode(),n}catch(e){throw this.browserStorage.setInteractionInProgress(!1),e}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,t,n){this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const r=We(e.id_token,fi),o=this.createHomeAccountIdentifier(e,r),a=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:t.accountId},this.correlationId)?.homeAccountId;if(o!==a&&e.account.id!==t.accountId)throw Us(Ds);const i=await this.getDiscoveredAuthority({requestAuthority:t.authority}),s=Is(this.browserStorage,i,o,fi,this.correlationId,r,e.client_info,void 0,r.tid,void 0,e.account.id,this.logger),c=await this.generateAuthenticationResult(e,t,r,s,i.canonicalAuthority,n);return this.cacheAccount(s),this.cacheNativeTokens(e,t,o,r,e.access_token,c.tenantId,n),c}createHomeAccountIdentifier(e,t){return Wt.generateHomeAccountId(e.client_info||a.EMPTY_STRING,0,this.logger,this.browserCrypto,t)}generateScopes(e,t){return e.scope?qt.fromString(e.scope):qt.fromString(t.scope)}async generatePopAccessToken(e,t){if(t.tokenType===F.POP&&t.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const n=new Ss(this.browserCrypto),r={resourceRequestMethod:t.resourceRequestMethod,resourceRequestUri:t.resourceRequestUri,shrClaims:t.shrClaims,shrNonce:t.shrNonce};if(!t.keyId)throw He(Me);return n.signPopToken(e.access_token,t.keyId,r)}return e.access_token}async generateAuthenticationResult(e,t,n,r,o,i){const s=this.addTelemetryFromNativeResponse(e),c=e.scope?qt.fromString(e.scope):qt.fromString(t.scope),l=e.account.properties||{},d=l.UID||n.oid||n.sub||a.EMPTY_STRING,u=l.TenantId||n.tid||a.EMPTY_STRING,h=$t(r.getAccountInfo(),void 0,n,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,t),f=t.tokenType===F.POP?F.POP:F.BEARER;return{authority:o,uniqueId:d,tenantId:u,scopes:c.asArray(),account:h,idToken:e.id_token,idTokenClaims:n,accessToken:p,fromCache:!!s&&this.isResponseFromCache(s),expiresOn:new Date(1e3*Number(i+e.expires_in)),tokenType:f,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}cacheAccount(e){this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e,this.correlationId).catch(e=>{this.logger.error(`Error occurred while removing account context from browser storage. ${e}`)})}cacheNativeTokens(e,t,n,r,o,i,s){const c=Xe(n,t.authority,e.id_token||"",t.clientId,r.tid||""),l=s+(t.tokenType===F.POP?a.SHR_NONCE_VALIDITY:("string"==typeof e.expires_in?parseInt(e.expires_in,10):e.expires_in)||0),d=this.generateScopes(e,t),u={idToken:c,accessToken:Ze(n,t.authority,o,t.clientId,r.tid||i,d.printScopes(),l,0,fi,void 0,t.tokenType,void 0,t.keyId)};this.nativeStorageManager.saveCacheRecord(u,t.correlationId,t.storeInCache)}addTelemetryFromNativeResponse(e){const t=this.getMATSFromResponse(e);return t?(this.performanceClient.addFields({extensionId:this.nativeMessageHandler.getExtensionId(),extensionVersion:this.nativeMessageHandler.getExtensionVersion(),matsBrokerVersion:t.broker_version,matsAccountJoinOnStart:t.account_join_on_start,matsAccountJoinOnEnd:t.account_join_on_end,matsDeviceJoin:t.device_join,matsPromptBehavior:t.prompt_behavior,matsApiErrorCode:t.api_error_code,matsUiVisible:t.ui_visible,matsSilentCode:t.silent_code,matsSilentBiSubCode:t.silent_bi_sub_code,matsSilentMessage:t.silent_message,matsSilentStatus:t.silent_status,matsHttpStatus:t.http_status,matsHttpEventCount:t.http_event_count},this.correlationId),t):null}validateNativeResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw Y(G,"Response missing expected properties.")}getMATSFromResponse(e){if(e.properties.MATS)try{return JSON.parse(e.properties.MATS)}catch(e){this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return void 0===e.is_cached?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const t=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:t,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const n=new Yt(t);n.validateAsUri();const{scopes:r,...o}=e,a=new qt(r||[]);a.appendScopes(i);const s={...o,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:a.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:(()=>{switch(this.apiId){case 863:case 61:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),S.NONE}if(e.prompt)switch(e.prompt){case S.NONE:case S.CONSENT:case S.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e.prompt;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e.prompt} is not compatible with native flow`),Ia(ya)}else this.logger.trace("initializeNativeRequest: prompt was not provided")})(),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw Ia(wa);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry="MATS",e.authenticationScheme===F.POP){const t={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},n=new Ss(this.browserCrypto);let r;if(s.keyId)r=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const o=await wi(n.generateCnf.bind(n),pr,this.logger,this.performanceClient,e.correlationId)(t,this.logger);r=o.reqCnfString,s.keyId=o.kid,s.signPopToken=!0}s.reqCnf=r}return this.addRequestSKUs(s),s}handleExtraBrokerParams(e){const t=e.extraParameters&&e.extraParameters.hasOwnProperty(bs)&&e.extraParameters.hasOwnProperty(ys)&&e.extraParameters.hasOwnProperty(us);if(!e.embeddedClientId&&!t)return;let n="";const r=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,n=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ys],n=e.extraParameters[us]),e.extraParameters={child_client_id:n,child_redirect_uri:r},this.performanceClient?.addFields({embeddedClientId:n,embeddedRedirectUri:r},e.correlationId)}}class Ws{constructor(e,t,n,r){this.logger=e,this.handshakeTimeoutMs=t,this.extensionId=r,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=n,this.handshakeEvent=n.startMeasurement(Er)}async sendMessage(e){this.logger.trace("NativeMessageHandler - sendMessage called.");const t={channel:$r,extensionId:this.extensionId,responseId:Ha(),body:e};return this.logger.trace("NativeMessageHandler - Sending request to browser extension"),this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(t)}`),this.messageChannel.port1.postMessage(t),new Promise((e,n)=>{this.resolvers.set(t.responseId,{resolve:e,reject:n})})}static async createProvider(e,t,n){e.trace("NativeMessageHandler - createProvider called.");try{const r=new Ws(e,t,n,Gr);return await r.sendHandshakeRequest(),r}catch(r){const o=new Ws(e,t,n);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace("NativeMessageHandler - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:$r,extensionId:this.extensionId,responseId:Ha(),body:{method:Wr}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=e=>{this.onChannelMessage(e)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((t,n)=>{this.handshakeResolvers.set(e.responseId,{resolve:t,reject:n}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),n(Ia(ga)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace("NativeMessageHandler - onWindowMessage called"),e.source!==window)return;const t=e.data;if(t.channel&&t.channel===$r&&(!t.extensionId||t.extensionId===this.extensionId)&&t.body.method===Wr){const e=this.handshakeResolvers.get(t.responseId);if(!e)return void this.logger.trace(`NativeMessageHandler.onWindowMessage - resolver can't be found for request ${t.responseId}`);this.logger.verbose(t.extensionId?`Extension with id: ${t.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),e.reject(Ia(ma))}}onChannelMessage(e){this.logger.trace("NativeMessageHandler - onChannelMessage called.");const t=e.data,n=this.resolvers.get(t.responseId),r=this.handshakeResolvers.get(t.responseId);try{const e=t.body.method;if("Response"===e){if(!n)return;const e=t.body.response;if(this.logger.trace("NativeMessageHandler - Received response from browser extension"),this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(e)}`),"Success"!==e.status)n.reject(Us(e.code,e.description,e.ext));else{if(!e.result)throw Y(G,"Event does not contain result.");e.result.code&&e.result.description?n.reject(Us(e.result.code,e.result.description,e.result.ext)):n.resolve(e.result)}this.resolvers.delete(t.responseId)}else if("HandshakeResponse"===e){if(!r)return void this.logger.trace(`NativeMessageHandler.onChannelMessage - resolver can't be found for request ${t.responseId}`);clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=t.extensionId,this.extensionVersion=t.body.version,this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),r.resolve(),this.handshakeResolvers.delete(t.responseId)}}catch(t){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${t}`),this.logger.errorPii(`Unable to parse ${e}`),n?n.reject(t):r&&r.reject(t)}}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}static isNativeAvailable(e,t,n,r){if(t.trace("isNativeAvailable called"),!e.system.allowNativeBroker)return t.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false"),!1;if(!n)return t.trace("isNativeAvailable: WAM extension provider is not initialized, returning false"),!1;if(r)switch(r){case F.BEARER:case F.POP:return t.trace("isNativeAvailable: authenticationScheme is supported, returning true"),!0;default:return t.trace("isNativeAvailable: authenticationScheme is not supported, returning false"),!1}return!0}}class Vs{constructor(e,t,n,r,o){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=r,this.performanceClient=o}async handleCodeResponse(e,t){let n;this.performanceClient.addQueueMeasurement(sr,t.correlationId);try{n=this.authModule.handleFragmentResponse(e,t.state)}catch(e){throw e instanceof ls&&e.subError===Bo?Ia(Bo):e}return wi(this.handleCodeResponseFromServer.bind(this),ir,this.logger,this.performanceClient,t.correlationId)(n,t)}async handleCodeResponseFromServer(e,t,n=!0){if(this.performanceClient.addQueueMeasurement(ir,t.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await wi(this.authModule.updateAuthority.bind(this.authModule),cr,this.logger,this.performanceClient,t.correlationId)(e.cloud_instance_host_name,t.correlationId),n&&(e.nonce=t.nonce||void 0),e.state=t.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const e=this.createCcsCredentials(t);e&&(this.authCodeRequest.ccsCredential=e)}return await wi(this.authModule.acquireToken.bind(this.authModule),lr,this.logger,this.performanceClient,t.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:zi}:e.loginHint?{credential:e.loginHint,type:Li}:null}}function Qs(e,t,n){const r=Qt(e);if(!r)throw Vt(e)?(n.error(`A ${t} is present in the iframe but it does not contain known properties. It's likely that the ${t} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${t} detected is: ${e}`),Ia(Mo)):(n.error(`The request has returned to the redirectUri but a ${t} is not present. It's likely that the ${t} has been removed or the page has been redirected by code running on the redirectUri page.`),Ia(Oo));return r}class Ys extends Ls{constructor(e,t,n,r,o,a,i,s,c,l){super(e,t,n,r,o,a,i,c,l),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=s}acquireToken(e){try{const t={popupName:this.generatePopupName(e.scopes||i,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window};return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,t)):(this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),t.popup=this.openSizedPopup("about:blank",t),this.acquireTokenPopupAsync(e,t))}catch(e){return Promise.reject(e)}}logout(e){try{this.logger.verbose("logoutPopup called");const t=this.initializeLogoutRequest(e),n={popupName:this.generateLogoutPopupName(t),popupWindowAttributes:e?.popupWindowAttributes||{},popupWindowParent:e?.popupWindowParent??window},r=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(t,n,r,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),n.popup=this.openSizedPopup("about:blank",n),this.logoutPopupAsync(t,n,r,o))}catch(e){return Promise.reject(e)}}async acquireTokenPopupAsync(e,t){this.logger.verbose("acquireTokenPopupAsync called");const n=this.initializeServerTelemetryManager(po),r=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,this.correlationId)(e,fo.Popup);oi(r.authority);try{const o=await wi(this.initializeAuthorizationCodeRequest.bind(this),or,this.logger,this.performanceClient,this.correlationId)(r),a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:r.authority,requestAzureCloudOptions:r.azureCloudOptions,requestExtraQueryParameters:r.extraQueryParameters,account:r.account}),i=Ws.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme);let s;i&&(s=this.performanceClient.startMeasurement(On,e.correlationId));const c=await a.getAuthCodeUrl({...r,nativeBroker:i}),l=new Vs(a,this.browserStorage,o,this.logger,this.performanceClient),d=this.initiateAuthRequest(c,t);this.eventHandler.emitEvent(ns,fo.Popup,{popupWindow:d},null);const u=await this.monitorPopupForHash(d,t.popupWindowParent),h=xi(Qs,mr,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);if(ds.removeThrottle(this.browserStorage,this.config.auth.clientId,o),h.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),s&&s.end({success:!0,isNativeBroker:!0}),!this.nativeMessageHandler)throw Ia(va);const e=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,po,this.performanceClient,this.nativeMessageHandler,h.accountId,this.nativeStorage,r.correlationId),{userRequestState:t}=Mi.parseRequestState(this.browserCrypto,r.state);return await e.acquireToken({...r,state:t,prompt:void 0})}return await l.handleCodeResponse(h,r)}catch(e){throw t.popup?.close(),e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),e}}async logoutPopupAsync(e,t,n,r){this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(rs,fo.Popup,e);const o=this.initializeServerTelemetryManager(962);try{await this.clearCacheOnLogout(e.account);const a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:n,account:e.account||void 0});try{a.authority.endSessionEndpoint}catch{if(e.account?.homeAccountId&&e.postLogoutRedirectUri&&a.authority.protocolMode===K){if(this.browserStorage.removeAccount(e.account?.homeAccountId,this.correlationId),this.eventHandler.emitEvent(os,fo.Popup,e),r){const e={apiId:962,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},t=Yt.getAbsoluteUrl(r,Za());await this.navigationClient.navigateInternal(t,e)}return void t.popup?.close()}}const i=a.getLogoutUri(e);this.eventHandler.emitEvent(os,fo.Popup,e);const s=this.openPopup(i,t);if(this.eventHandler.emitEvent(ns,fo.Popup,{popupWindow:s},null),await this.monitorPopupForHash(s,t.popupWindowParent).catch(()=>{}),r){const e={apiId:962,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},t=Yt.getAbsoluteUrl(r,Za());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${t}`),await this.navigationClient.navigateInternal(t,e)}else this.logger.verbose("No main window navigation requested")}catch(e){throw t.popup?.close(),e instanceof Q&&(e.setCorrelationId(this.correlationId),o.cacheFailedRequest(e)),this.browserStorage.setInteractionInProgress(!1),this.eventHandler.emitEvent(as,fo.Popup,null,e),this.eventHandler.emitEvent(is,fo.Popup),e}this.eventHandler.emitEvent(is,fo.Popup)}initiateAuthRequest(e,t){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,t);throw this.logger.error("Navigate url is empty"),Ia(Po)}monitorPopupForHash(e,t){return new Promise((t,n)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const r=setInterval(()=>{if(e.closed)return this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(r),void n(Ia(Bo));let o="";try{o=e.location.href}catch(e){}if(!o||"about:blank"===o)return;clearInterval(r);let a="";const i=this.config.auth.OIDCOptions.serverResponseType;e&&(a=i===T.QUERY?e.location.search:e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),t(a)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,t)})}openPopup(e,t){try{let n;if(t.popup?(n=t.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),n.location.assign(e)):void 0===t.popup&&(this.logger.verbosePii(`Opening popup window to: ${e}`),n=this.openSizedPopup(e,t)),!n)throw Ia(qo);return n.focus&&n.focus(),this.currentWindow=n,t.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),n}catch(e){throw this.logger.error("error opening popup "+e.message),this.browserStorage.setInteractionInProgress(!1),Ia(Fo)}}openSizedPopup(e,{popupName:t,popupWindowAttributes:n,popupWindowParent:r}){const o=r.screenLeft?r.screenLeft:r.screenX,a=r.screenTop?r.screenTop:r.screenY,i=r.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,s=r.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let c=n.popupSize?.width,l=n.popupSize?.height,d=n.popupPosition?.top,u=n.popupPosition?.left;return(!c||c<0||c>i)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),c=483),(!l||l<0||l>s)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),l=600),(!d||d<0||d>s)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),d=Math.max(0,s/2-300+a)),(!u||u<0||u>i)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),u=Math.max(0,i/2-241.5+o)),r.open(e,t,`width=${c}, height=${l}, top=${d}, left=${u}, scrollbars=yes`)}unloadWindow(e){this.browserStorage.cleanRequestByInteractionType(fo.Popup),this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,t){e.close(),t.removeEventListener("beforeunload",this.unloadWindow),this.browserStorage.setInteractionInProgress(!1)}generatePopupName(e,t){return`${Hr}.${this.config.auth.clientId}.${e.join("-")}.${t}.${this.correlationId}`}generateLogoutPopupName(e){const t=e.account&&e.account.homeAccountId;return`${Hr}.${this.config.auth.clientId}.${t}.${this.correlationId}`}}class Js{constructor(e,t,n,r,o){this.authModule=e,this.browserStorage=t,this.authCodeRequest=n,this.logger=r,this.performanceClient=o}async initiateAuthRequest(e,t){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){t.redirectStartPage&&(this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page"),this.browserStorage.setTemporaryCache(Zr,t.redirectStartPage,!0)),this.browserStorage.setTemporaryCache(oo,this.authCodeRequest.correlationId,!0),this.browserStorage.cacheCodeRequest(this.authCodeRequest),this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const n={apiId:ho,timeout:t.redirectTimeout,noHistory:!1};return"function"==typeof t.onRedirectNavigate?(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),!1!==t.onRedirectNavigate(e)?(this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),void await t.navigationClient.navigateExternal(e,n)):void this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation")):(this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),void await t.navigationClient.navigateExternal(e,n))}throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),Ia(Po)}async handleCodeResponse(e,t){this.logger.verbose("RedirectHandler.handleCodeResponse called"),this.browserStorage.setInteractionInProgress(!1);const n=this.browserStorage.generateStateKey(t),r=this.browserStorage.getTemporaryCache(n);if(!r)throw He(se,"Cached State");let o;try{o=this.authModule.handleFragmentResponse(e,r)}catch(e){throw e instanceof ls&&e.subError===Bo?Ia(Bo):e}const a=this.browserStorage.generateNonceKey(r),i=this.browserStorage.getTemporaryCache(a);if(this.authCodeRequest.code=o.code,o.cloud_instance_host_name&&await wi(this.authModule.updateAuthority.bind(this.authModule),cr,this.logger,this.performanceClient,this.authCodeRequest.correlationId)(o.cloud_instance_host_name,this.authCodeRequest.correlationId),o.nonce=i||void 0,o.state=r,o.client_info)this.authCodeRequest.clientInfo=o.client_info;else{const e=this.checkCcsCredentials();e&&(this.authCodeRequest.ccsCredential=e)}const s=await this.authModule.acquireToken(this.authCodeRequest,o);return this.browserStorage.cleanRequestByState(t),s}checkCcsCredentials(){const e=this.browserStorage.getTemporaryCache(ro,!0);if(e)try{return JSON.parse(e)}catch(t){this.authModule.logger.error("Cache credential could not be parsed"),this.authModule.logger.errorPii(`Cache credential could not be parsed: ${e}`)}return null}}class Xs extends Ls{constructor(e,t,n,r,o,a,i,s,c,l){super(e,t,n,r,o,a,i,c,l),this.nativeStorage=s}async acquireToken(e){const t=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,this.correlationId)(e,fo.Redirect);this.browserStorage.updateCacheEntries(t.state,t.nonce,t.authority,t.loginHint||"",t.account||null);const n=this.initializeServerTelemetryManager(ho),r=e=>{e.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.cleanRequestByState(t.state),this.eventHandler.emitEvent(ss,fo.Redirect))};try{const o=await wi(this.initializeAuthorizationCodeRequest.bind(this),or,this.logger,this.performanceClient,this.correlationId)(t),a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),i=new Js(a,this.browserStorage,o,this.logger,this.performanceClient),s=await a.getAuthCodeUrl({...t,nativeBroker:Ws.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,e.authenticationScheme)}),c=this.getRedirectStartPage(e.redirectStartPage);return this.logger.verbosePii(`Redirect start page: ${c}`),window.addEventListener("pageshow",r),await i.initiateAuthRequest(s,{navigationClient:this.navigationClient,redirectTimeout:this.config.system.redirectNavigationTimeout,redirectStartPage:c,onRedirectNavigate:e.onRedirectNavigate||this.config.auth.onRedirectNavigate})}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),window.removeEventListener("pageshow",r),this.browserStorage.cleanRequestByState(t.state),e}}async handleRedirectPromise(e="",t){const n=this.initializeServerTelemetryManager(865);try{if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const[r,o]=this.getRedirectResponse(e||"");if(!r)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.cleanRequestByInteractionType(fo.Redirect),"back_forward"!==function(){if("undefined"==typeof window||void 0===window.performance||"function"!=typeof window.performance.getEntriesByType)return;const e=window.performance.getEntriesByType("navigation"),t=e.length?e[0]:void 0;return t?.type}()?t.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const i=this.browserStorage.getTemporaryCache(Zr,!0)||a.EMPTY_STRING;if(Yt.removeHashFromUrl(i)===Yt.removeHashFromUrl(window.location.href)&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),i.indexOf("#")>-1&&function(e){const t=e.split("#");t.shift(),window.location.hash=t.length>0?t.join("#"):""}(i),await this.handleResponse(r,n);if(!this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(r,n);if(!Xa()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(eo,o,!0);const e={apiId:865,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let t=!0;if(i&&"null"!==i)this.logger.verbose(`Navigating to loginRequestUrl: ${i}`),t=await this.navigationClient.navigateInternal(i,e);else{const n=function(){const e=new Yt(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}();this.browserStorage.setTemporaryCache(Zr,n,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),t=await this.navigationClient.navigateInternal(n,e)}if(!t)return await this.handleResponse(r,n)}return null}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),this.browserStorage.cleanRequestByInteractionType(fo.Redirect),e}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let t=e;t||(t=this.config.auth.OIDCOptions.serverResponseType===T.QUERY?window.location.search:window.location.hash);let n=Qt(t);if(n){try{!function(e,t,n){if(!e.state)throw Ia(Ro);const r=qi(t,e.state);if(!r)throw Ia(zo);if(r.interactionType!==n)throw Ia(Lo)}(n,this.browserCrypto,fo.Redirect)}catch(e){return e instanceof Q&&this.logger.error(`Interaction type validation failed due to ${e.errorCode}: ${e.errorMessage}`),[null,""]}return(r=window).location.hash="","function"==typeof r.history.replaceState&&r.history.replaceState(null,"",`${r.location.origin}${r.location.pathname}${r.location.search}`),this.logger.verbose("Hash contains known properties, returning response hash"),[n,t]}var r;const o=this.browserStorage.getTemporaryCache(eo,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(eo)),o&&(n=Qt(o),n)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[n,o]):[null,""]}async handleResponse(e,t){const n=e.state;if(!n)throw Ia(Ro);const r=this.browserStorage.getCachedRequest(n);if(this.logger.verbose("handleResponse called, retrieved cached request"),e.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw Ia(va);const t=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,po,this.performanceClient,this.nativeMessageHandler,e.accountId,this.nativeStorage,r.correlationId),{userRequestState:o}=Mi.parseRequestState(this.browserCrypto,n);return t.acquireToken({...r,state:o,prompt:void 0}).finally(()=>{this.browserStorage.cleanRequestByState(n)})}const o=this.browserStorage.getCachedAuthority(n);if(!o)throw Ia(Zo);const a=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:t,requestAuthority:o});return ds.removeThrottle(this.browserStorage,this.config.auth.clientId,r),new Js(a,this.browserStorage,r,this.logger,this.performanceClient).handleCodeResponse(e,n)}async logout(e){this.logger.verbose("logoutRedirect called");const t=this.initializeLogoutRequest(e),n=this.initializeServerTelemetryManager(961);try{this.eventHandler.emitEvent(rs,fo.Redirect,e),await this.clearCacheOnLogout(t.account);const r={apiId:961,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},o=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e&&e.authority,requestExtraQueryParameters:e?.extraQueryParameters,account:e&&e.account||void 0});if(o.authority.protocolMode===K)try{o.authority.endSessionEndpoint}catch{if(t.account?.homeAccountId)return this.browserStorage.removeAccount(t.account?.homeAccountId,this.correlationId),void this.eventHandler.emitEvent(os,fo.Redirect,t)}const a=o.getLogoutUri(t);if(this.eventHandler.emitEvent(os,fo.Redirect,t),!e||"function"!=typeof e.onRedirectNavigate)return this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),void await this.navigationClient.navigateExternal(a,r);if(!1!==e.onRedirectNavigate(a))return this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0),void await this.navigationClient.navigateExternal(a,r);this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation")}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),this.eventHandler.emitEvent(as,fo.Redirect,null,e),this.eventHandler.emitEvent(is,fo.Redirect),e}this.eventHandler.emitEvent(is,fo.Redirect)}getRedirectStartPage(e){const t=e||window.location.href;return Yt.getAbsoluteUrl(t,Za())}}async function Zs(e,t,n,r,o){if(t.addQueueMeasurement(Jn,r),!e)throw n.info("Navigate url is empty"),Ia(Po);return o?wi(tc,Zn,n,t,r)(e,o,t,r):xi(nc,er,n,t,r)(e)}async function ec(e,t,n,r,o,a,i){return r.addQueueMeasurement(Xn,a),new Promise((r,a)=>{t<1e4&&o.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${t}ms) than the default (10000ms). This may result in timeouts.`);const s=window.setTimeout(()=>{window.clearInterval(c),a(Ia(Ho))},t),c=window.setInterval(()=>{let t="";const n=e.contentWindow;try{t=n?n.location.href:""}catch(e){}if(!t||"about:blank"===t)return;let o="";n&&(o=i===T.QUERY?n.location.search:n.location.hash),window.clearTimeout(s),window.clearInterval(c),r(o)},n)}).finally(()=>{xi(oc,_r,o,r,a)(e)})}function tc(e,t,n,r){return n.addQueueMeasurement(Zn,r),new Promise((n,r)=>{const o=rc();window.setTimeout(()=>{o?(o.src=e,n(o)):r("Unable to load iframe")},t)})}function nc(e){const t=rc();return t.src=e,t}function rc(){const e=document.createElement("iframe");return e.className="msalSilentIframe",e.style.visibility="hidden",e.style.position="absolute",e.style.width=e.style.height="0",e.style.border="0",e.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(e),e}function oc(e){document.body===e.parentNode&&document.body.removeChild(e)}class ac extends Ls{constructor(e,t,n,r,o,a,i,s,c,l,d){super(e,t,n,r,o,a,s,l,d),this.apiId=i,this.nativeStorage=c}async acquireToken(e){this.performanceClient.addQueueMeasurement(Nn,e.correlationId),e.loginHint||e.sid||e.account&&e.account.username||this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const t={...e};t.prompt?t.prompt!==S.NONE&&t.prompt!==S.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${t.prompt} with ${S.NONE}`),t.prompt=S.NONE):t.prompt=S.NONE;const n=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,e.correlationId)(t,fo.Silent);oi(n.authority);const r=this.initializeServerTelemetryManager(this.apiId);let o;try{return o=await wi(this.createAuthCodeClient.bind(this),tr,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),await wi(this.silentTokenHelper.bind(this),Yn,this.logger,this.performanceClient,e.correlationId)(o,n)}catch(n){if(n instanceof Q&&(n.setCorrelationId(this.correlationId),r.cacheFailedRequest(n)),!(o&&n instanceof Q&&n.errorCode===Ur))throw n;this.performanceClient.addFields({retryError:n.errorCode},this.correlationId);const a=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,e.correlationId)(t,fo.Silent);return await wi(this.silentTokenHelper.bind(this),Yn,this.logger,this.performanceClient,this.correlationId)(o,a)}}logout(){return Promise.reject(Ia(Vo))}async silentTokenHelper(e,t){const n=t.correlationId;this.performanceClient.addQueueMeasurement(Yn,n);const r=await wi(this.initializeAuthorizationCodeRequest.bind(this),or,this.logger,this.performanceClient,n)(t),o=await wi(e.getAuthCodeUrl.bind(e),ar,this.logger,this.performanceClient,n)({...t,nativeBroker:Ws.isNativeAvailable(this.config,this.logger,this.nativeMessageHandler,t.authenticationScheme)}),a=new Vs(e,this.browserStorage,r,this.logger,this.performanceClient),i=await wi(Zs,Jn,this.logger,this.performanceClient,n)(o,this.performanceClient,this.logger,n,this.config.system.navigateFrameWait),s=this.config.auth.OIDCOptions.serverResponseType,c=await wi(ec,Xn,this.logger,this.performanceClient,n)(i,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,s),l=xi(Qs,mr,this.logger,this.performanceClient,this.correlationId)(c,s,this.logger);if(l.accountId){if(this.logger.verbose("Account id found in hash, calling WAM for token"),!this.nativeMessageHandler)throw Ia(va);const e=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.apiId,this.performanceClient,this.nativeMessageHandler,l.accountId,this.browserStorage,n),{userRequestState:r}=Mi.parseRequestState(this.browserCrypto,t.state);return wi(e.acquireToken.bind(e),Rn,this.logger,this.performanceClient,n)({...t,state:r,prompt:t.prompt||S.NONE})}return wi(a.handleCodeResponse.bind(a),sr,this.logger,this.performanceClient,n)(l,t)}}class ic extends Ls{async acquireToken(e){this.performanceClient.addQueueMeasurement(En,e.correlationId);const t=await wi(Ms,Wn,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),n={...e,...t};e.redirectUri&&(n.redirectUri=this.getRedirectUri(e.redirectUri));const r=this.initializeServerTelemetryManager(61),o=await this.createRefreshTokenClient({serverTelemetryManager:r,authorityUrl:n.authority,azureCloudOptions:n.azureCloudOptions,account:n.account});return wi(o.acquireTokenByRefreshToken.bind(o),Bn,this.logger,this.performanceClient,e.correlationId)(n).catch(e=>{throw e.setCorrelationId(this.correlationId),r.cacheFailedRequest(e),e})}logout(){return Promise.reject(Ia(Vo))}async createRefreshTokenClient(e){const t=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Hs(t,this.performanceClient)}}class sc{constructor(e,t,n,r){this.isBrowserEnvironment="undefined"!=typeof window,this.config=e,this.storage=t,this.logger=n,this.cryptoObj=r}loadExternalTokens(e,t,n){if(!this.isBrowserEnvironment)throw Ia(na);const r=e.correlationId||Ha(),o=t.id_token?We(t.id_token,fi):void 0,a={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},i=e.authority?new Ci(Ci.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,a,this.logger,e.correlationId||Ha()):void 0,s=this.loadAccount(e,n.clientInfo||t.client_info||"",r,o,i),c=this.loadIdToken(t,s.homeAccountId,s.environment,s.realm,r),l=this.loadAccessToken(e,t,s.homeAccountId,s.environment,s.realm,n,r),d=this.loadRefreshToken(t,s.homeAccountId,s.environment,r);return this.generateAuthenticationResult(e,{account:s,idToken:c,accessToken:l,refreshToken:d},o,i)}loadAccount(e,t,n,r,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const t=Wt.createFromAccountInfo(e.account);return this.storage.setAccount(t,n),t}if(!o||!t&&!r)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),Ia(ca);const a=Wt.generateHomeAccountId(t,o.authorityType,this.logger,this.cryptoObj,r),i=r?.tid,s=Is(this.storage,o,a,fi,n,r,t,o.hostnameAndPort,i,void 0,void 0,this.logger);return this.storage.setAccount(s,n),s}loadIdToken(e,t,n,r,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const a=Xe(t,n,e.id_token,this.config.auth.clientId,r);return this.storage.setIdTokenCredential(a,o),a}loadAccessToken(e,t,n,r,o,a,i){if(!t.access_token)return this.logger.verbose("TokenCache - no access token found in response"),null;if(!t.expires_in)return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;if(!(t.scope||e.scopes&&e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null;this.logger.verbose("TokenCache - loading access token");const s=t.scope?qt.fromString(t.scope):new qt(e.scopes),c=a.expiresOn||t.expires_in+(new Date).getTime()/1e3,l=a.extendedExpiresOn||(t.ext_expires_in||t.expires_in)+(new Date).getTime()/1e3,d=Ze(n,r,t.access_token,this.config.auth.clientId,o,s.printScopes(),c,l,fi);return this.storage.setAccessTokenCredential(d,i),d}loadRefreshToken(e,t,n,r){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=et(t,n,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return this.storage.setRefreshTokenCredential(o,r),o}generateAuthenticationResult(e,t,n,r){let o,a="",i=[],s=null;t?.accessToken&&(a=t.accessToken.secret,i=qt.fromString(t.accessToken.target).asArray(),s=new Date(1e3*Number(t.accessToken.expiresOn)),o=new Date(1e3*Number(t.accessToken.extendedExpiresOn)));const c=t.account;return{authority:r?r.canonicalAuthority:"",uniqueId:t.account.localAccountId,tenantId:t.account.realm,scopes:i,account:c.getAccountInfo(),idToken:t.idToken?.secret||"",idTokenClaims:n||{},accessToken:a,fromCache:!0,expiresOn:s,correlationId:e.correlationId||"",requestId:"",extExpiresOn:o,familyId:t.refreshToken?.familyId||"",tokenType:t?.accessToken?.tokenType||"",state:e.state||"",cloudGraphHostName:c.cloudGraphHostName||"",msGraphHost:c.msGraphHost||"",fromNativeBroker:!1}}}class cc extends Ns{constructor(e){super(e),this.includeRedirectUri=!1}}class lc extends Ls{constructor(e,t,n,r,o,a,i,s,c,l){super(e,t,n,r,o,a,s,c,l),this.apiId=i}async acquireToken(e){if(!e.code)throw Ia(da);const t=await wi(this.initializeAuthorizationRequest.bind(this),rr,this.logger,this.performanceClient,e.correlationId)(e,fo.Silent),n=this.initializeServerTelemetryManager(this.apiId);try{const r={...t,code:e.code},o=await wi(this.getClientConfiguration.bind(this),nr,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:n,requestAuthority:t.authority,requestAzureCloudOptions:t.azureCloudOptions,requestExtraQueryParameters:t.extraQueryParameters,account:t.account}),a=new cc(o);this.logger.verbose("Auth code client created");const i=new Vs(a,this.browserStorage,r,this.logger,this.performanceClient);return await wi(i.handleCodeResponseFromServer.bind(i),ir,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},t,!1)}catch(e){throw e instanceof Q&&(e.setCorrelationId(this.correlationId),n.cacheFailedRequest(e)),e}}logout(){return Promise.reject(Ia(Vo))}}function dc(e){const t=e?.idTokenClaims;return t?.tfp||t?.acr?"B2C":t?.tid?"9188040d-6c67-4c5b-b112-36a304b66dad"===t?.tid?"MSA":"AAD":void 0}function uc(e,t){try{ni(e)}catch(e){throw t.end({success:!1},e),e}}class hc{constructor(e){var t,n;this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new bi(this.logger,this.performanceClient):Ke,this.eventHandler=new cs(this.logger),this.browserStorage=this.isBrowserEnvironment?new Ui(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,function(e){const t=e.cloudDiscoveryMetadata;let n;if(t)try{n=JSON.parse(t)}catch(e){throw Dt(Tt)}return{canonicalAuthority:e.authority?Si(e.authority):void 0,knownAuthorities:e.knownAuthorities,cloudDiscoveryMetadata:n}}(this.config.auth),this.performanceClient):(t=this.config.auth.clientId,n=this.logger,new Ui(t,{cacheLocation:Jr,temporaryCacheLocation:Jr,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1},Ke,n));const r={cacheLocation:Jr,temporaryCacheLocation:Jr,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new Ui(this.config.auth.clientId,r,this.browserCrypto,this.logger,void 0,this.performanceClient),this.tokenCache=new sc(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this),this.listeningToStorageEvents=!1,this.handleAccountCacheChange=this.handleAccountCacheChange.bind(this)}static async createController(e,t){const n=new hc(e);return await n.initialize(t),n}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e){if(this.logger.trace("initialize called"),this.initialized)return void this.logger.info("initialize has already been called, exiting early.");if(!this.isBrowserEnvironment)return this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,void this.eventHandler.emitEvent(Hi);const t=e?.correlationId||this.getRequestCorrelationId(),n=this.config.system.allowNativeBroker,r=this.performanceClient.startMeasurement(Qn,t);if(this.eventHandler.emitEvent("msal:initializeStart"),n)try{this.nativeExtensionProvider=await Ws.createProvider(this.logger,this.config.system.nativeBrokerHandshakeTimeout,this.performanceClient)}catch(e){this.logger.verbose(e)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),await wi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),Pr,this.logger,this.performanceClient,t)(this.performanceClient,t)),this.initialized=!0,this.eventHandler.emitEvent(Hi),r.end({allowNativeBroker:n,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),ti(this.initialized),this.isBrowserEnvironment){const t=e||"";let n=this.redirectResponse.get(t);return void 0===n?(n=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(t,n),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),n}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){const t=this.getAllAccounts(),n=this.browserStorage.getCachedNativeRequest(),r=n&&Ws.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider)&&this.nativeExtensionProvider&&!e,o=r?n?.correlationId:this.browserStorage.getTemporaryCache(oo,!0)||"",a=this.performanceClient.startMeasurement(jn,o);let i;if(this.eventHandler.emitEvent(es,fo.Redirect),r&&this.nativeExtensionProvider){this.logger.trace("handleRedirectPromise - acquiring token from native platform");const e=new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,865,this.performanceClient,this.nativeExtensionProvider,n.accountId,this.nativeInternalStorage,n.correlationId);i=wi(e.handleRedirectPromise.bind(e),Nr,this.logger,this.performanceClient,a.event.correlationId)(this.performanceClient,a.event.correlationId)}else{this.logger.trace("handleRedirectPromise - acquiring token from web flow");const t=this.createRedirectClient(o);i=wi(t.handleRedirectPromise.bind(t),Ar,this.logger,this.performanceClient,a.event.correlationId)(e,a)}return i.then(e=>(e?(t.length<this.getAllAccounts().length?(this.eventHandler.emitEvent($i,fo.Redirect,e),this.logger.verbose("handleRedirectResponse returned result, login success")):(this.eventHandler.emitEvent(Vi,fo.Redirect,e),this.logger.verbose("handleRedirectResponse returned result, acquire token success")),a.end({success:!0,accountType:dc(e.account)})):a.event.errorCode?a.end({success:!1}):a.discard(),this.eventHandler.emitEvent(ts,fo.Redirect),e)).catch(e=>{const n=e;throw t.length>0?this.eventHandler.emitEvent(Qi,fo.Redirect,null,n):this.eventHandler.emitEvent(Gi,fo.Redirect,null,n),this.eventHandler.emitEvent(ts,fo.Redirect),a.end({success:!1},n),e})}async acquireTokenRedirect(e){const t=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",t);const n=this.performanceClient.startMeasurement("acquireTokenPreRedirect",t);n.add({accountType:dc(e.account),scenarioId:e.scenarioId});const r=e.onRedirectNavigate;if(r)e.onRedirectNavigate=e=>{const t="function"==typeof r?r(e):void 0;return!1!==t?n.end({success:!0}):n.discard(),t};else{const e=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=t=>{const r="function"==typeof e?e(t):void 0;return!1!==r?n.end({success:!0}):n.discard(),r}}const o=this.getAllAccounts().length>0;try{let r;return ri(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),o?this.eventHandler.emitEvent(Wi,fo.Redirect,e):this.eventHandler.emitEvent(Ki,fo.Redirect,e),r=this.nativeExtensionProvider&&this.canUseNative(e)?new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,ho,this.performanceClient,this.nativeExtensionProvider,this.getNativeAccountId(e),this.nativeInternalStorage,t).acquireTokenRedirect(e,n).catch(n=>{if(n instanceof qs&&Bs(n))return this.nativeExtensionProvider=void 0,this.createRedirectClient(t).acquireToken(e);if(n instanceof Pi)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),n}):this.createRedirectClient(t).acquireToken(e),await r}catch(e){throw n.end({success:!1},e),o?this.eventHandler.emitEvent(Qi,fo.Redirect,null,e):this.eventHandler.emitEvent(Gi,fo.Redirect,null,e),e}}acquireTokenPopup(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(Sn,t);n.add({scenarioId:e.scenarioId,accountType:dc(e.account)});try{this.logger.verbose("acquireTokenPopup called",t),uc(this.initialized,n),this.browserStorage.setInteractionInProgress(!0)}catch(e){return Promise.reject(e)}const r=this.getAllAccounts();let o;return r.length>0?this.eventHandler.emitEvent(Wi,fo.Popup,e):this.eventHandler.emitEvent(Ki,fo.Popup,e),o=this.canUseNative(e)?this.acquireTokenNative({...e,correlationId:t},po).then(e=>(this.browserStorage.setInteractionInProgress(!1),n.end({success:!0,isNativeBroker:!0,accountType:dc(e.account)}),e)).catch(n=>{if(n instanceof qs&&Bs(n))return this.nativeExtensionProvider=void 0,this.createPopupClient(t).acquireToken(e);if(n instanceof Pi)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(t).acquireToken(e);throw this.browserStorage.setInteractionInProgress(!1),n}):this.createPopupClient(t).acquireToken(e),o.then(e=>(r.length<this.getAllAccounts().length?this.eventHandler.emitEvent($i,fo.Popup,e):this.eventHandler.emitEvent(Vi,fo.Popup,e),n.end({success:!0,accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length,accountType:dc(e.account)}),e)).catch(e=>(r.length>0?this.eventHandler.emitEvent(Qi,fo.Popup,null,e):this.eventHandler.emitEvent(Gi,fo.Popup,null,e),n.end({success:!1},e),Promise.reject(e)))}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){const t=this.getRequestCorrelationId(e),n={...e,prompt:e.prompt,correlationId:t};let r;return this.ssoSilentMeasurement=this.performanceClient.startMeasurement(_n,t),this.ssoSilentMeasurement?.add({scenarioId:e.scenarioId,accountType:dc(e.account)}),uc(this.initialized,this.ssoSilentMeasurement),this.ssoSilentMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",t),this.eventHandler.emitEvent(Yi,fo.Silent,n),r=this.canUseNative(n)?this.acquireTokenNative(n,863).catch(e=>{if(e instanceof qs&&Bs(e))return this.nativeExtensionProvider=void 0,this.createSilentIframeClient(n.correlationId).acquireToken(n);throw e}):this.createSilentIframeClient(n.correlationId).acquireToken(n),r.then(e=>(this.eventHandler.emitEvent(Ji,fo.Silent,e),this.ssoSilentMeasurement?.end({success:!0,isNativeBroker:e.fromNativeBroker,accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length,accountType:dc(e.account)}),e)).catch(e=>{throw this.eventHandler.emitEvent(Xi,fo.Silent,null,e),this.ssoSilentMeasurement?.end({success:!1},e),e}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const t=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",t);const n=this.performanceClient.startMeasurement(xn,t);uc(this.initialized,n),this.eventHandler.emitEvent("msal:acquireTokenByCodeStart",fo.Silent,e),n.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Ia(ha);if(e.code){const r=e.code;let o=this.hybridAuthCodeResponses.get(r);return o?(this.logger.verbose("Existing acquireTokenByCode request found",t),n.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",t),o=this.acquireTokenByCodeAsync({...e,correlationId:t}).then(e=>(this.eventHandler.emitEvent("msal:acquireTokenByCodeSuccess",fo.Silent,e),this.hybridAuthCodeResponses.delete(r),n.end({success:!0,isNativeBroker:e.fromNativeBroker,accessTokenSize:e.accessToken.length,idTokenSize:e.idToken.length,accountType:dc(e.account)}),e)).catch(e=>{throw this.hybridAuthCodeResponses.delete(r),this.eventHandler.emitEvent(Zi,fo.Silent,null,e),n.end({success:!1},e),e}),this.hybridAuthCodeResponses.set(r,o)),await o}if(e.nativeAccountId){if(this.canUseNative(e,e.nativeAccountId)){const r=await this.acquireTokenNative({...e,correlationId:t},866,e.nativeAccountId).catch(e=>{throw e instanceof qs&&Bs(e)&&(this.nativeExtensionProvider=void 0),e});return n.end({accountType:dc(r.account),success:!0}),r}throw Ia(fa)}throw Ia(ua)}catch(e){throw this.eventHandler.emitEvent(Zi,fo.Silent,null,e),n.end({success:!1},e),e}}async acquireTokenByCodeAsync(e){this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(Ir,e.correlationId),this.acquireTokenByCodeAsyncMeasurement?.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement);const t=this.createSilentAuthCodeClient(e.correlationId);return await t.acquireToken(e).then(e=>(this.acquireTokenByCodeAsyncMeasurement?.end({success:!0,fromCache:e.fromCache,isNativeBroker:e.fromNativeBroker}),e)).catch(e=>{throw this.acquireTokenByCodeAsyncMeasurement?.end({success:!1},e),e}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,t){switch(this.performanceClient.addQueueMeasurement(Hn,e.correlationId),t){case 0:case 1:case 2:const t=this.createSilentCacheClient(e.correlationId);return wi(t.acquireToken.bind(t),An,this.logger,this.performanceClient,e.correlationId)(e);default:throw He(Ne)}}async acquireTokenByRefreshToken(e,t){switch(this.performanceClient.addQueueMeasurement(wn,e.correlationId),t){case 0:case 2:case 3:case 4:const t=this.createSilentRefreshClient(e.correlationId);return wi(t.acquireToken.bind(t),En,this.logger,this.performanceClient,e.correlationId)(e);default:throw He(Ne)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(Gn,e.correlationId);const t=this.createSilentIframeClient(e.correlationId);return wi(t.acquireToken.bind(t),Nn,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const t=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",t),this.logoutRedirect({correlationId:t,...e})}async logoutRedirect(e){const t=this.getRequestCorrelationId(e);return ri(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0),this.createRedirectClient(t).logout(e)}logoutPopup(e){try{const t=this.getRequestCorrelationId(e);return ni(this.initialized),this.browserStorage.setInteractionInProgress(!0),this.createPopupClient(t).logout(e)}catch(e){return Promise.reject(e)}}async clearCache(e){if(!this.isBrowserEnvironment)return void this.logger.info("in non-browser environment, returning early.");const t=this.getRequestCorrelationId(e);return this.createSilentCacheClient(t).logout(e)}getAllAccounts(e){const t=this.getRequestCorrelationId();return function(e,t,n,r,o){return e.verbose("getAllAccounts called"),n?t.getAllAccounts(r,o):[]}(this.logger,this.browserStorage,this.isBrowserEnvironment,t,e)}getAccount(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccount called"),0===Object.keys(e).length)return t.warning("getAccount: No accountFilter provided"),null;const o=n.getAccountInfoFilteredBy(e,r);return o?(t.verbose("getAccount: Account matching provided filter found, returning"),o):(t.verbose("getAccount: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}getAccountByUsername(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccountByUsername called"),!e)return t.warning("getAccountByUsername: No username provided"),null;const o=n.getAccountInfoFilteredBy({username:e},r);return o?(t.verbose("getAccountByUsername: Account matching username found, returning"),t.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${e}`),o):(t.verbose("getAccountByUsername: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}getAccountByHomeId(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccountByHomeId called"),!e)return t.warning("getAccountByHomeId: No homeAccountId provided"),null;const o=n.getAccountInfoFilteredBy({homeAccountId:e},r);return o?(t.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),t.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${e}`),o):(t.verbose("getAccountByHomeId: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}getAccountByLocalId(e){const t=this.getRequestCorrelationId();return function(e,t,n,r){if(t.trace("getAccountByLocalId called"),!e)return t.warning("getAccountByLocalId: No localAccountId provided"),null;const o=n.getAccountInfoFilteredBy({localAccountId:e},r);return o?(t.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),t.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${e}`),o):(t.verbose("getAccountByLocalId: No matching account found, returning null"),null)}(e,this.logger,this.browserStorage,t)}setActiveAccount(e){const t=this.getRequestCorrelationId();!function(e,t,n){t.setActiveAccount(e,n)}(e,this.browserStorage,t)}getActiveAccount(){const e=this.getRequestCorrelationId();return function(e,t){return e.getActiveAccount(t)}(this.browserStorage,e)}async hydrateCache(e,t){this.logger.verbose("hydrateCache called");const n=Wt.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return this.browserStorage.setAccount(n,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,t)):this.browserStorage.hydrateCache(e,t)}async acquireTokenNative(e,t,n){if(this.logger.trace("acquireTokenNative called"),!this.nativeExtensionProvider)throw Ia(va);return new Gs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,t,this.performanceClient,this.nativeExtensionProvider,n||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e)}canUseNative(e,t){if(this.logger.trace("canUseNative called"),!Ws.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme))return this.logger.trace("canUseNative: isNativeAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case S.NONE:case S.CONSENT:case S.LOGIN:this.logger.trace("canUseNative: prompt is compatible with native flow");break;default:return this.logger.trace(`canUseNative: prompt = ${e.prompt} is not compatible with native flow, returning false`),!1}return!(!t&&!this.getNativeAccountId(e)&&(this.logger.trace("canUseNative: nativeAccountId is not available, returning false"),1))}getNativeAccountId(e){const t=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return t&&t.nativeAccountId||""}createPopupClient(e){return new Ys(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createRedirectClient(e){return new Xs(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentIframeClient(e){return new ac(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,863,this.performanceClient,this.nativeInternalStorage,this.nativeExtensionProvider,e)}createSilentCacheClient(e){return new $s(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentRefreshClient(e){return new ic(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeExtensionProvider,e)}createSilentAuthCodeClient(e){return new lc(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,866,this.performanceClient,this.nativeExtensionProvider,e)}addEventCallback(e,t){return this.eventHandler.addEventCallback(e,t)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return ei(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){"undefined"!=typeof window&&(this.listeningToStorageEvents?this.logger.verbose("Account storage listener already registered."):(this.logger.verbose("Adding account storage listener."),this.listeningToStorageEvents=!0,window.addEventListener("storage",this.handleAccountCacheChange)))}disableAccountStorageEvents(){"undefined"!=typeof window&&(this.listeningToStorageEvents?(this.logger.verbose("Removing account storage listener."),window.removeEventListener("storage",this.handleAccountCacheChange),this.listeningToStorageEvents=!1):this.logger.verbose("No account storage listener registered."))}handleAccountCacheChange(e){try{e.key?.includes(y)&&this.eventHandler.emitEvent("msal:activeAccountChanged");const t=e.newValue||e.oldValue;if(!t)return;const n=JSON.parse(t);if("object"!=typeof n||!Wt.isAccountEntity(n))return;const r=cn.toObject(new Wt,n).getAccountInfo();!e.oldValue&&e.newValue?(this.logger.info("Account was added to cache in a different window"),this.eventHandler.emitEvent("msal:accountAdded",void 0,r)):!e.newValue&&e.oldValue&&(this.logger.info("Account was removed from cache in a different window"),this.eventHandler.emitEvent("msal:accountRemoved",void 0,r))}catch(e){return}}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,t){this.browserStorage.setWrapperMetadata(e,t)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e?.correlationId?e.correlationId:this.isBrowserEnvironment?Ha():a.EMPTY_STRING}async loginRedirect(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",t),this.acquireTokenRedirect({correlationId:t,...e||Co})}loginPopup(e){const t=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",t),this.acquireTokenPopup({correlationId:t,...e||Co})}async acquireTokenSilent(e){const t=this.getRequestCorrelationId(e),n=this.performanceClient.startMeasurement(kn,t);n.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),uc(this.initialized,n),this.logger.verbose("acquireTokenSilent called",t);const r=e.account||this.getActiveAccount();if(!r)throw Ia(Qo);n.add({accountType:dc(r)});const o={clientId:this.config.auth.clientId,authority:e.authority||a.EMPTY_STRING,scopes:e.scopes,homeAccountIdentifier:r.homeAccountId,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,shrOptions:e.shrOptions},i=JSON.stringify(o),s=this.activeSilentTokenRequests.get(i);if(void 0===s){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",t);const o=wi(this.acquireTokenSilentAsync.bind(this),Cn,this.logger,this.performanceClient,t)({...e,correlationId:t},r).then(t=>(this.activeSilentTokenRequests.delete(i),n.end({success:!0,fromCache:t.fromCache,isNativeBroker:t.fromNativeBroker,cacheLookupPolicy:e.cacheLookupPolicy,accessTokenSize:t.accessToken.length,idTokenSize:t.idToken.length}),t)).catch(e=>{throw this.activeSilentTokenRequests.delete(i),n.end({success:!1},e),e});return this.activeSilentTokenRequests.set(i,o),{...await o,state:e.state}}return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",t),n.discard(),{...await s,state:e.state}}async acquireTokenSilentAsync(e,t){const n=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(Cn,e.correlationId),this.eventHandler.emitEvent(Wi,fo.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",n);const r=await wi(zs,Vn,this.logger,this.performanceClient,e.correlationId)(e,t,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||0;return this.acquireTokenSilentNoIframe(r,o).catch(async e=>{const t=function(e,t){const n=!(e instanceof Pi&&e.subError!==Ai),r=e.errorCode===Ur||e.errorCode===Ne,o=n&&r||e.errorCode===ji||e.errorCode===Ii,a=To.includes(t);return o&&a}(e,o);if(t){if(this.activeIframeRequest){if(5!==o){const[t,n]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${n}`,r.correlationId);const a=this.performanceClient.startMeasurement("awaitConcurrentIframe",r.correlationId);a.add({awaitIframeCorrelationId:n});const i=await t;if(a.end({success:i}),i)return this.logger.verbose(`Parallel iframe request with correlationId: ${n} succeeded. Retrying cache and/or RT redemption`,r.correlationId),this.acquireTokenSilentNoIframe(r,o);throw this.logger.info(`Iframe request with correlationId: ${n} failed. Interaction is required.`),e}return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",r.correlationId),wi(this.acquireTokenBySilentIframe.bind(this),Gn,this.logger,this.performanceClient,r.correlationId)(r)}{let e;return this.activeIframeRequest=[new Promise(t=>{e=t}),r.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",r.correlationId),wi(this.acquireTokenBySilentIframe.bind(this),Gn,this.logger,this.performanceClient,r.correlationId)(r).then(t=>(e(!0),t)).catch(t=>{throw e(!1),t}).finally(()=>{this.activeIframeRequest=void 0})}}throw e}).then(t=>(this.eventHandler.emitEvent(Vi,fo.Silent,t),e.correlationId&&this.performanceClient.addFields({fromCache:t.fromCache,isNativeBroker:t.fromNativeBroker},e.correlationId),t)).catch(e=>{throw this.eventHandler.emitEvent(Qi,fo.Silent,null,e),e}).finally(()=>{document.removeEventListener("visibilitychange",n)})}async acquireTokenSilentNoIframe(e,t){return Ws.isNativeAvailable(this.config,this.logger,this.nativeExtensionProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,61).catch(async e=>{if(e instanceof qs&&Bs(e))throw this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.nativeExtensionProvider=void 0,He(Ne);throw e})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),wi(this.acquireTokenFromCache.bind(this),Hn,this.logger,this.performanceClient,e.correlationId)(e,t).catch(n=>{if(1===t)throw n;return this.eventHandler.emitEvent("msal:acquireTokenFromNetworkStart",fo.Silent,e),wi(this.acquireTokenByRefreshToken.bind(this),wn,this.logger,this.performanceClient,e.correlationId)(e,t)}))}}class pc{static async createPublicClientApplication(e){const t=await async function(e){const t=new si(e);return await t.initialize(),hc.createController(t,void 0)}(e);return new pc(e,t)}constructor(e,t){this.controller=t||new hc(new si(e))}async initialize(e){return this.controller.initialize(e)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,t){return this.controller.addEventCallback(e,t)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,t){return this.controller.initializeWrapperLibrary(e,t)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,t){return this.controller.hydrateCache(e,t)}clearCache(e){return this.controller.clearCache(e)}}const fc={instance:{initialize:()=>Promise.reject(Ja(Wa)),acquireTokenPopup:()=>Promise.reject(Ja(Wa)),acquireTokenRedirect:()=>Promise.reject(Ja(Wa)),acquireTokenSilent:()=>Promise.reject(Ja(Wa)),acquireTokenByCode:()=>Promise.reject(Ja(Wa)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(Ja(Wa)),loginPopup:()=>Promise.reject(Ja(Wa)),loginRedirect:()=>Promise.reject(Ja(Wa)),logout:()=>Promise.reject(Ja(Wa)),logoutRedirect:()=>Promise.reject(Ja(Wa)),logoutPopup:()=>Promise.reject(Ja(Wa)),ssoSilent:()=>Promise.reject(Ja(Wa)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw Ja(Wa)},getLogger:()=>{throw Ja(Wa)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw Ja(Wa)},hydrateCache:()=>Promise.reject(Ja(Wa)),clearCache:()=>Promise.reject(Ja(Wa))},inProgress:ko,accounts:[],logger:new U({})},gc=r.createContext(fc);gc.Consumer;class mc{static getInteractionStatusFromEvent(e,t){switch(e.eventType){case Ki:return vo;case Yi:return xo;case Wi:if(e.interactionType===fo.Redirect||e.interactionType===fo.Popup)return yo;break;case es:return wo;case rs:return bo;case Ji:case Xi:if(t&&t!==xo)break;return ko;case is:if(t&&t!==bo)break;return ko;case ts:if(t&&t!==wo)break;return ko;case $i:case Gi:case Vi:case Qi:case ss:if(e.interactionType===fo.Redirect||e.interactionType===fo.Popup){if(t&&t!==vo&&t!==yo)break;return ko}}return null}}function vc(e,t){if(e.length!==t.length)return!1;const n=[...t];return e.every(e=>{const t=n.shift();return!(!e||!t)&&e.homeAccountId===t.homeAccountId&&e.localAccountId===t.localAccountId&&e.username===t.username})}const bc="2.2.0",yc="UNBLOCK_INPROGRESS",xc="EVENT",wc=(e,t)=>{const{type:n,payload:r}=t;let o=e.inProgress;switch(n){case yc:e.inProgress===mo&&(o=ko,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case xc:const t=r.message,a=mc.getInteractionStatusFromEvent(t,e.inProgress);a&&(r.logger.info(`MsalProvider - ${t.eventType} results in setting inProgress from ${e.inProgress} to ${a}`),o=a);break;default:throw new Error(`Unknown action type: ${n}`)}const a=r.instance.getAllAccounts();return o===e.inProgress||vc(a,e.accounts)?o!==e.inProgress?{...e,inProgress:o}:vc(a,e.accounts)?e:{...e,accounts:a}:{...e,inProgress:o,accounts:a}};function kc({instance:e,children:t}){(0,r.useEffect)(()=>{e.initializeWrapperLibrary("@azure/msal-react",bc)},[e]);const n=(0,r.useMemo)(()=>e.getLogger().clone("@azure/msal-react",bc),[e]),[o,a]=(0,r.useReducer)(wc,void 0,()=>({inProgress:mo,accounts:e.getAllAccounts()}));(0,r.useEffect)(()=>{const t=e.addEventCallback(t=>{a({payload:{instance:e,logger:n,message:t},type:xc})});return n.verbose(`MsalProvider - Registered event callback with id: ${t}`),e.initialize().then(()=>{e.handleRedirectPromise().catch(()=>{}).finally(()=>{a({payload:{instance:e,logger:n},type:yc})})}).catch(()=>{}),()=>{t&&(n.verbose(`MsalProvider - Removing event callback ${t}`),e.removeEventCallback(t))}},[e,n]);const i={instance:e,inProgress:o.inProgress,accounts:o.accounts,logger:n};return r.createElement(gc.Provider,{value:i},t)}var Cc="https://PositiveSpendClients.ciamlogin.com/".concat("891f98f1-ed34-42a1-9b6c-28b0554d92c2"),Sc="https://portal.positivespend.com",jc="https://mgmt.positivespend.com",Tc=("".concat(Sc,"/api/auth/session"),{auth:{clientId:"154c9111-14a0-4c0f-8132-7bc68254a74e",authority:Cc,redirectUri:window.location.origin,postLogoutRedirectUri:window.location.origin,knownAuthorities:["PositiveSpendClients.ciamlogin.com"],navigateToLoginRequestUrl:!0},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:function(e,t,n){if(!n)switch(e){case 0:console.error(t);break;case 1:console.warn(t);break;case 2:console.info(t);break;case 3:console.debug(t)}},logLevel:3}}}),Ic={scopes:["openid","profile","email"]},Ac=n(848);function Nc(e){return Nc="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},Nc(e)}function Ec(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 _c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ec(Object(n),!0).forEach(function(t){Pc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ec(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Pc(e,t,n){return(t=function(e){var t=function(e){if("object"!=Nc(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Nc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Nc(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Oc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Rc(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Rc(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Rc(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Rc(u,"constructor",l),Rc(l,"constructor",c),c.displayName="GeneratorFunction",Rc(l,o,"GeneratorFunction"),Rc(u),Rc(u,o,"Generator"),Rc(u,r,function(){return this}),Rc(u,"toString",function(){return"[object Generator]"}),(Oc=function(){return{w:a,m:h}})()}function Rc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Rc=function(e,t,n,r){function a(t,n){Rc(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Rc(e,t,n,r)}function Mc(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function zc(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Mc(a,r,o,i,s,"next",e)}function s(e){Mc(a,r,o,i,s,"throw",e)}i(void 0)})}}function Lc(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Dc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dc(e,t):void 0}}(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 Dc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Fc=new pc(Tc),qc=Fc.initialize(),Bc=(0,r.createContext)(null),Uc=function(){return(0,r.useContext)(Bc)},Hc="adp_session_token",Kc="adp_session_user";function $c(e){var t=e.children,n=(0,r.useContext)(gc),o=n.instance,a=(n.inProgress,n.accounts),i=Lc((0,r.useState)("authenticating"),2),s=i[0],c=i[1],l=Lc((0,r.useState)(null),2),d=l[0],u=l[1],h=Lc((0,r.useState)(null),2),p=h[0],f=h[1],g=Lc((0,r.useState)(null),2),m=g[0],v=g[1],b=(0,r.useRef)(!1),y=(0,r.useCallback)(function(){var e=zc(Oc().m(function e(t){var n,r,o,a,i,s;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!b.current){e.n=1;break}return e.a(2);case 1:return b.current=!0,console.log("[Auth] Exchanging JWT for session at","".concat(Sc,"/api/auth/session")),e.p=2,e.n=3,fetch("".concat(Sc,"/api/auth/session"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(t)}});case 3:return n=e.v,e.n=4,n.json();case 4:r=e.v,console.log("[Auth] Session response:",n.status,r.ok),r.ok&&r.data?(o=r.data,a={sessionId:o.sessionId,userId:o.userId,email:o.userEmail,displayName:o.displayName,role:o.role,clientId:o.clientId,clientName:o.clientName,expiresAt:o.expiresAt,availableClients:o.availableClients||[]},u(o.sessionToken),f(a),sessionStorage.setItem(Hc,o.sessionToken),sessionStorage.setItem(Kc,JSON.stringify(a)),c("active"),console.log("[Auth] Session established for",o.userEmail,"| client:",o.clientName)):(i=r.error||"Session creation failed",console.warn("[Auth] Session exchange error:",i),/no client access|user not found|not registered/i.test(i)?c("needsRegistration"):(v(i),c("error"))),e.n=6;break;case 5:e.p=5,s=e.v,console.error("[Auth] Network error during session exchange:",s),v("Unable to connect to the server. Please try again."),c("error");case 6:return e.p=6,b.current=!1,e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])}));return function(t){return e.apply(this,arguments)}}(),[]),x=(0,r.useCallback)(function(){var e=zc(Oc().m(function e(t){var n,r,o,a,i;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,fetch("".concat(Sc,"/api/auth/me"),{headers:{Authorization:"Bearer ".concat(t)}});case 1:return n=e.v,e.n=2,n.json();case 2:if(!(r=e.v).ok||!r.data){e.n=3;break}return o=r.data,a={sessionId:o.sessionId,userId:o.userId,email:o.userEmail,displayName:o.displayName,role:o.role,clientId:o.clientId,clientName:o.clientName,expiresAt:o.expiresAt,availableClients:o.availableClients||[]},u(t),f(a),c("active"),console.log("[Auth] Session restored for",o.userEmail),e.a(2,!0);case 3:e.n=5;break;case 4:e.p=4,i=e.v,console.warn("[Auth] Session validation failed:",i.message);case 5:return e.a(2,!1)}},e,null,[[0,4]])}));return function(t){return e.apply(this,arguments)}}(),[]);(0,r.useEffect)(function(){var e=!1;function t(){return(t=zc(Oc().m(function t(){var n,r,a,i,s,l;return Oc().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.n=1,qc;case 1:return t.p=1,t.n=2,o.handleRedirectPromise();case 2:if(!(n=t.v)||!n.idToken||e){t.n=4;break}return console.log("[Auth] MSAL redirect received, exchanging token"),t.n=3,y(n.idToken);case 3:return t.a(2);case 4:t.n=6;break;case 5:t.p=5,s=t.v,console.warn("[Auth] MSAL redirect error:",s);case 6:if(!e){t.n=7;break}return t.a(2);case 7:if(!(r=sessionStorage.getItem(Hc))){t.n=10;break}return t.n=8,x(r);case 8:if(!t.v){t.n=9;break}return t.a(2);case 9:sessionStorage.removeItem(Hc),sessionStorage.removeItem(Kc);case 10:if(!(a=o.getActiveAccount()||o.getAllAccounts()[0])){t.n=16;break}return t.p=11,t.n=12,o.acquireTokenSilent(_c(_c({},Ic),{},{account:a}));case 12:if(null==(i=t.v)||!i.idToken||e){t.n=14;break}return t.n=13,y(i.idToken);case 13:return t.a(2);case 14:t.n=16;break;case 15:t.p=15,l=t.v,console.warn("[Auth] Silent token acquisition failed:",l.message);case 16:e||c("unauthenticated");case 17:return t.a(2)}},t,null,[[11,15],[1,5]])}))).apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}},[o,y,x]);var w=(0,r.useCallback)(function(){c("authenticating"),o.loginRedirect(Ic).catch(function(e){console.error("[Auth] Login redirect error:",e),c("unauthenticated")})},[o]),k=(0,r.useCallback)(zc(Oc().m(function e(){return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!d){e.n=4;break}return e.p=1,e.n=2,fetch("".concat(Sc,"/api/auth/signoff"),{method:"POST",headers:{Authorization:"Bearer ".concat(d)}});case 2:e.n=4;break;case 3:e.p=3,e.v;case 4:sessionStorage.removeItem(Hc),sessionStorage.removeItem(Kc),u(null),f(null),c("unauthenticated"),o.logoutRedirect({postLogoutRedirectUri:window.location.origin});case 5:return e.a(2)}},e,null,[[1,3]])})),[o,d]),C=(0,r.useCallback)(function(){sessionStorage.clear(),v(null),c("unauthenticated"),o.logoutRedirect({postLogoutRedirectUri:window.location.origin}).catch(function(){c("unauthenticated")})},[o]),S=(0,r.useCallback)(function(){var e=zc(Oc().m(function e(t){var n,r,o,a;return Oc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(d){e.n=1;break}return e.a(2);case 1:return e.p=1,e.n=2,fetch("".concat(Sc,"/api/auth/switch-client"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(d)},body:JSON.stringify({clientId:t})});case 2:return n=e.v,e.n=3,n.json();case 3:(r=e.v).ok&&r.data&&(o=r.data,f(function(e){return _c(_c({},e),{},{clientId:o.clientId||e.clientId,clientName:o.clientName||e.clientName,role:o.role||e.role})}),sessionStorage.setItem(Kc,JSON.stringify(_c(_c({},p),o)))),e.n=5;break;case 4:e.p=4,a=e.v,console.error("[Auth] Switch client error:",a);case 5:return e.a(2)}},e,null,[[1,4]])}));return function(t){return e.apply(this,arguments)}}(),[d,p]),j=(null==a?void 0:a[0])||null,T={authState:s,sessionToken:d,sessionUser:p,error:m,msalAccount:j,gatewayUrl:Sc,signIn:w,signOut:k,retrySignIn:C,switchClient:S,clearError:function(){v(null),c("unauthenticated")}};return(0,Ac.jsx)(Bc.Provider,{value:T,children:t})}function Gc(e){var t=e.children;return(0,Ac.jsx)(kc,{instance:Fc,children:(0,Ac.jsx)($c,{children:t})})}function Wc(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Vc(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Vc(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Vc(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Vc(u,"constructor",l),Vc(l,"constructor",c),c.displayName="GeneratorFunction",Vc(l,o,"GeneratorFunction"),Vc(u),Vc(u,o,"Generator"),Vc(u,r,function(){return this}),Vc(u,"toString",function(){return"[object Generator]"}),(Wc=function(){return{w:a,m:h}})()}function Vc(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Vc=function(e,t,n,r){function a(t,n){Vc(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Vc(e,t,n,r)}function Qc(e){return Qc="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},Qc(e)}function Yc(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Jc(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xc(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Xc(e,t):void 0}}(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 Xc(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Zc={dashboard:[{id:"overview",label:"Overview"}],campaigns:[{id:"myCampaigns",label:"My Campaigns"},{id:"newCampaign",label:"+ New Campaign"}],performance:[{id:"metrics",label:"Metrics"},{id:"recommendations",label:"Recommendations"}],billing:[{id:"invoices",label:"Invoices"}],documents:[{id:"myDocuments",label:"My Documents"}],support:[{id:"help",label:"Help & FAQs"}]},el={dashboard:"Dashboard",campaigns:"Campaigns",performance:"Performance",billing:"Billing",documents:"Documents",support:"Support"},tl=(0,r.createContext)(null);function nl(){var e=(0,r.useContext)(tl);if(!e)throw new Error("useAdmin must be used within ClientProvider");return e}function rl(e){var t=e.children,n=Uc(),o=n.sessionUser,a=n.sessionToken,i=n.signOut,s=Jc((0,r.useState)("dashboard"),2),c=s[0],l=s[1],d=Jc((0,r.useState)("overview"),2),u=d[0],h=d[1],p=Jc((0,r.useState)(!1),2),f=p[0],g=p[1],m=Jc((0,r.useState)(null),2),v=m[0],b=m[1],y=Jc((0,r.useState)(!1),2),x=y[0],w=(y[1],Jc((0,r.useState)(null),2)),k=w[0],C=w[1],S=Jc((0,r.useState)(0),2),j=(S[0],S[1]),T=Jc((0,r.useState)(null),2),I=T[0],A=T[1],N=(0,r.useCallback)(function(){var e,t=(e=Wc().m(function e(t){var n,r,o,i,s,c,l,d,u,h,p,f,g,m,v=arguments;return Wc().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n=v.length>1&&void 0!==v[1]?v[1]:"GET",r=v.length>2&&void 0!==v[2]?v[2]:null,a){e.n=1;break}return e.a(2,{ok:!1,error:"Not authenticated"});case 1:return null!==n&&"object"===Qc(n)?(o=n.method||"GET",c=!!n.rawResponse,u=null!==(d=n.body)&&void 0!==d?d:null,s=u instanceof FormData,i=s?u:u?JSON.stringify(u):null,l=n.mgmt?jc:Sc):(o=n,c=!1,s=!1,i=r?JSON.stringify(r):null,l=Sc),h=t.startsWith("http")?t:"".concat(l).concat(t),p={Authorization:"Bearer ".concat(a)},s||(p["Content-Type"]="application/json"),e.p=2,e.n=3,fetch(h,{method:o,headers:p,body:i||void 0});case 3:if((f=e.v).ok){e.n=6;break}if(!c){e.n=4;break}return e.a(2,null);case 4:return e.n=5,f.text();case 5:return g=e.v,404!==f.status&&console.error("[Client] HTTP ".concat(f.status,":"),g.substring(0,200)),e.a(2,{ok:!1,error:"HTTP ".concat(f.status)});case 6:if(!c){e.n=7;break}return e.a(2,f);case 7:return e.n=8,f.json();case 8:return e.a(2,e.v);case 9:return e.p=9,m=e.v,console.error("[Client] Network error:",m.message),e.a(2,c?null:{ok:!1,error:"Network error"})}},e,null,[[2,9]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Yc(a,r,o,i,s,"next",e)}function s(e){Yc(a,r,o,i,s,"throw",e)}i(void 0)})});return function(e){return t.apply(this,arguments)}}(),[a]),E=(0,r.useCallback)(function(e){l(e);var t=Zc[e];(null==t?void 0:t.length)>0&&h(t[0].id),b(null),C(null)},[]),_=(0,r.useCallback)(function(e){h(e),b(null),C(null)},[]),P=(0,r.useCallback)(function(){return j(function(e){return e+1})},[]),O=(0,r.useMemo)(function(){return{session:o,user:o,signOut:i,activeCategory:c,activeTab:u,collapsed:f,setActiveCategory:E,setActiveTab:_,setCollapsed:g,tabs:Zc[c]||[],data:v,loading:x,error:k,refresh:P,apiCall:N,clientId:null==o?void 0:o.clientId,clientName:null==o?void 0:o.clientName,wizardId:I,setWizardId:A}},[o,i,c,u,f,E,_,v,x,k,P,N,I]);return(0,Ac.jsx)(tl.Provider,{value:O,children:t})}function ol(e){var t=e.children,n=Uc(),r=n.authState,o=n.sessionUser,a=n.signOut,i="active"===r;return(0,Ac.jsxs)("div",{className:"shell",children:[(0,Ac.jsxs)("header",{className:"shell-header",children:[(0,Ac.jsxs)("div",{className:"shell-logo",children:[(0,Ac.jsx)("span",{className:"logo-icon",children:"◆"}),(0,Ac.jsx)("span",{className:"logo-text",children:"AdPlatform"})]}),i&&o&&(0,Ac.jsxs)("div",{className:"shell-user",children:[(0,Ac.jsx)("span",{className:"user-name",children:o.displayName||o.email}),(0,Ac.jsx)("button",{onClick:a,className:"btn-signout",children:"Sign Out"})]})]}),(0,Ac.jsx)("main",{className:"shell-content",children:t})]})}function al(){var e=Uc(),t=e.authState,n=e.error,r=e.signIn,o=e.retrySignIn;return"needsRegistration"===t?(0,Ac.jsx)("div",{className:"signin-overlay",children:(0,Ac.jsxs)("div",{className:"signin-card",children:[(0,Ac.jsx)("div",{className:"signin-icon",children:"◆"}),(0,Ac.jsx)("h1",{children:"AdPlatform"}),(0,Ac.jsx)("p",{className:"signin-subtitle",children:"Account not found"}),(0,Ac.jsx)("div",{className:"error-message",children:"Your account doesn't have access to AdPlatform yet. Please contact your administrator or complete registration before signing in."}),(0,Ac.jsx)("button",{onClick:o,className:"btn-signin btn-secondary",children:"Try a different account"})]})}):"error"===t?(0,Ac.jsx)("div",{className:"signin-overlay",children:(0,Ac.jsxs)("div",{className:"signin-card",children:[(0,Ac.jsx)("div",{className:"signin-icon",children:"◆"}),(0,Ac.jsx)("h1",{children:"AdPlatform"}),(0,Ac.jsx)("p",{className:"signin-subtitle",children:"Sign-in failed"}),n&&(0,Ac.jsx)("div",{className:"error-message",children:n}),(0,Ac.jsx)("button",{onClick:o,className:"btn-signin",children:"Try again"})]})}):(0,Ac.jsx)("div",{className:"signin-overlay",children:(0,Ac.jsxs)("div",{className:"signin-card",children:[(0,Ac.jsx)("div",{className:"signin-icon",children:"◆"}),(0,Ac.jsx)("h1",{children:"AdPlatform"}),(0,Ac.jsx)("p",{className:"signin-subtitle",children:"Sign in to manage your advertising campaigns"}),(0,Ac.jsx)("button",{onClick:r,className:"btn-signin",children:"Sign in with Microsoft"})]})})}var il={dashboard:(0,Ac.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("rect",{x:"2",y:"2",width:"7",height:"8",rx:"1.5"}),(0,Ac.jsx)("rect",{x:"11",y:"2",width:"7",height:"5",rx:"1.5"}),(0,Ac.jsx)("rect",{x:"2",y:"12",width:"7",height:"6",rx:"1.5"}),(0,Ac.jsx)("rect",{x:"11",y:"9",width:"7",height:"9",rx:"1.5"})]}),campaigns:(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Ac.jsx)("path",{d:"M16 3L8 7H4a1 1 0 00-1 1v4a1 1 0 001 1h1l2 4h2l-2-4h1l8 4V3z"})}),performance:(0,Ac.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("path",{d:"M3 16L7 8l4 5 3-7 3 10"}),(0,Ac.jsx)("circle",{cx:"7",cy:"8",r:"1.5",fill:"currentColor"}),(0,Ac.jsx)("circle",{cx:"11",cy:"13",r:"1.5",fill:"currentColor"}),(0,Ac.jsx)("circle",{cx:"14",cy:"6",r:"1.5",fill:"currentColor"})]}),billing:(0,Ac.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("rect",{x:"2",y:"4",width:"16",height:"12",rx:"2"}),(0,Ac.jsx)("path",{d:"M2 8h16M6 12h3"})]}),documents:(0,Ac.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("path",{d:"M12 2H6a2 2 0 00-2 2v12a2 2 0 002 2h8a2 2 0 002-2V7z"}),(0,Ac.jsx)("path",{d:"M12 2v5h5M7 11h6M7 14h4"})]}),support:(0,Ac.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("circle",{cx:"10",cy:"10",r:"8"}),(0,Ac.jsx)("path",{d:"M10 14v-1M10 10a2 2 0 10-2-2"}),(0,Ac.jsx)("circle",{cx:"10",cy:"14.5",r:"0.5",fill:"currentColor"})]}),chevron:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Ac.jsx)("path",{d:"M5 3l4 4-4 4"})})},sl=[{id:"dashboard",label:"Dashboard",icon:"dashboard"},{id:"campaigns",label:"Campaigns",icon:"campaigns"},{id:"performance",label:"Performance",icon:"performance"},{divider:!0},{id:"billing",label:"Billing",icon:"billing",disabled:!0},{id:"documents",label:"Documents",icon:"documents"},{id:"support",label:"Support",icon:"support"}];function cl(e){var t=e.activeCategory,n=e.onSelectCategory,r=e.collapsed,o=e.onToggleCollapse,a=Uc(),i=a.sessionUser,s=a.signOut;return(0,Ac.jsxs)("aside",{className:"sidebar ".concat(r?"sidebar-collapsed":""),children:[(0,Ac.jsxs)("div",{className:"sidebar-logo",children:[(0,Ac.jsx)("span",{className:"sidebar-logo-icon",children:"◆"}),!r&&(0,Ac.jsx)("span",{className:"sidebar-logo-text",children:"AdPlatform"})]}),!r&&(null==i?void 0:i.clientName)&&(0,Ac.jsx)("div",{style:{padding:"6px 16px 10px",fontSize:12,color:"var(--sidebar-muted, #94a3b8)",borderBottom:"1px solid var(--sidebar-border, rgba(255,255,255,0.08))",marginBottom:8},children:i.clientName}),(0,Ac.jsx)("nav",{className:"sidebar-nav",children:sl.map(function(e,o){if(e.divider)return(0,Ac.jsx)("div",{className:"sidebar-divider"},"d-".concat(o));var a=t===e.id,i=e.disabled;return(0,Ac.jsxs)("button",{className:"sidebar-item ".concat(a?"sidebar-item-active":""," ").concat(i?"sidebar-item-disabled":""),onClick:function(){return!i&&n(e.id)},title:r?e.label:void 0,children:[(0,Ac.jsx)("span",{className:"sidebar-item-icon",children:il[e.icon]}),!r&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"sidebar-item-label",children:e.label}),i&&(0,Ac.jsx)("span",{className:"sidebar-soon",children:"Soon"})]})]},e.id)})}),(0,Ac.jsxs)("div",{className:"sidebar-footer",children:[!r&&i&&(0,Ac.jsxs)("div",{className:"sidebar-user",children:[(0,Ac.jsx)("div",{className:"sidebar-user-avatar",children:(i.displayName||i.email||"?")[0].toUpperCase()}),(0,Ac.jsxs)("div",{className:"sidebar-user-info",children:[(0,Ac.jsx)("span",{className:"sidebar-user-name",children:i.displayName||i.email}),(0,Ac.jsx)("button",{onClick:s,className:"sidebar-user-signout",children:"Sign Out"})]})]}),r&&i&&(0,Ac.jsx)("div",{className:"sidebar-user-collapsed",title:i.displayName||i.email,children:(0,Ac.jsx)("div",{className:"sidebar-user-avatar",children:(i.displayName||i.email||"?")[0].toUpperCase()})}),(0,Ac.jsxs)("button",{className:"sidebar-collapse-btn",onClick:o,children:[(0,Ac.jsx)("span",{className:"sidebar-collapse-icon ".concat(r?"":"sidebar-collapse-icon-flip"),children:il.chevron}),!r&&(0,Ac.jsx)("span",{children:"Collapse"})]})]})]})}function ll(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return dl(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(dl(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,dl(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,dl(u,"constructor",l),dl(l,"constructor",c),c.displayName="GeneratorFunction",dl(l,o,"GeneratorFunction"),dl(u),dl(u,o,"Generator"),dl(u,r,function(){return this}),dl(u,"toString",function(){return"[object Generator]"}),(ll=function(){return{w:a,m:h}})()}function dl(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}dl=function(e,t,n,r){function a(t,n){dl(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},dl(e,t,n,r)}function ul(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function hl(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ul(a,r,o,i,s,"next",e)}function s(e){ul(a,r,o,i,s,"throw",e)}i(void 0)})}}function pl(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return fl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?fl(e,t):void 0}}(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 fl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var gl={active:{bg:"#dcfce7",color:"#166534"},launched:{bg:"#dcfce7",color:"#166534"},staged:{bg:"#dbeafe",color:"#1e40af"},draft:{bg:"#f1f5f9",color:"#475569"},paused:{bg:"#fef9c3",color:"#854d0e"},completed:{bg:"#ede9fe",color:"#5b21b6"},cancelled:{bg:"#fee2e2",color:"#991b1b"}},ml=function(e){return null!=e?"$".concat(Number(e).toLocaleString("en-US",{minimumFractionDigits:2})):"—"};function vl(e){var t=e.status,n=gl[null==t?void 0:t.toLowerCase()]||{bg:"#f1f5f9",color:"#475569"};return(0,Ac.jsx)("span",{style:{background:n.bg,color:n.color,padding:"2px 8px",borderRadius:10,fontSize:11,fontWeight:600},children:t||"—"})}function bl(e){var t=e.label,n=e.value,r=e.sub;return(0,Ac.jsxs)("div",{style:{background:"#fff",border:"1px solid #e2e8f0",borderRadius:10,padding:"20px 24px",flex:"1 1 180px"},children:[(0,Ac.jsx)("div",{style:{fontSize:28,fontWeight:700,color:"#0f172a"},children:n}),(0,Ac.jsx)("div",{style:{fontSize:13,color:"#64748b",marginTop:4},children:t}),r&&(0,Ac.jsx)("div",{style:{fontSize:12,color:"#94a3b8",marginTop:2},children:r})]})}function yl(){var e=nl(),t=e.apiCall,n=(e.clientId,e.clientName),o=e.setActiveCategory,a=e.setActiveTab,i=pl((0,r.useState)([]),2),s=i[0],c=i[1],l=pl((0,r.useState)([]),2),d=l[0],u=l[1],h=pl((0,r.useState)(!0),2),p=h[0],f=h[1],g=(0,r.useCallback)(hl(ll().m(function e(){var n,r,o,a;return ll().w(function(e){for(;;)switch(e.n){case 0:return f(!0),e.n=1,Promise.all([t("/api/initiative"),t("/api/recommendations")]);case 1:n=e.v,r=pl(n,2),o=r[0],a=r[1],c(Array.isArray(null==o?void 0:o.initiatives)?o.initiatives:Array.isArray(null==o?void 0:o.data)?o.data:[]),u(Array.isArray(null==a?void 0:a.recommendations)?a.recommendations:Array.isArray(null==a?void 0:a.data)?a.data:[]),f(!1);case 2:return e.a(2)}},e)})),[t]);(0,r.useEffect)(function(){g()},[g]);var m=s.filter(function(e){var t,n;return["active","launched"].includes((null===(t=e.iniStatus)||void 0===t?void 0:t.toLowerCase())||(null===(n=e.status)||void 0===n?void 0:n.toLowerCase()))}),v=s.filter(function(e){var t,n;return["staged","draft"].includes((null===(t=e.iniStatus)||void 0===t?void 0:t.toLowerCase())||(null===(n=e.status)||void 0===n?void 0:n.toLowerCase()))}),b=d.filter(function(e){return"critical"===e.severity||"critical"===e.Severity}),y=m.reduce(function(e,t){return e+(t.totalSpend||0)},0);return p?(0,Ac.jsx)("div",{className:"loading-message",children:"Loading your dashboard…"}):(0,Ac.jsxs)("div",{style:{maxWidth:960},children:[(0,Ac.jsxs)("div",{style:{marginBottom:24},children:[(0,Ac.jsxs)("h2",{style:{fontSize:22,fontWeight:700,color:"#0f172a",margin:0},children:["Welcome back",n?", ".concat(n):""]}),(0,Ac.jsx)("p",{style:{color:"#64748b",margin:"4px 0 0"},children:"Here's a summary of your advertising activity."})]}),(0,Ac.jsxs)("div",{style:{display:"flex",gap:16,flexWrap:"wrap",marginBottom:28},children:[(0,Ac.jsx)(bl,{label:"Active Campaigns",value:m.length}),(0,Ac.jsx)(bl,{label:"Drafts / Staged",value:v.length}),(0,Ac.jsx)(bl,{label:"Open Alerts",value:b.length,sub:b.length>0?"Needs attention":"All clear"}),(0,Ac.jsx)(bl,{label:"Total Spend (MTD)",value:y>0?ml(y):"—"})]}),m.length>0&&(0,Ac.jsxs)("div",{style:{marginBottom:28},children:[(0,Ac.jsx)("h3",{style:{fontSize:15,fontWeight:600,color:"#0f172a",marginBottom:12},children:"Active Campaigns"}),(0,Ac.jsx)("div",{style:{background:"#fff",border:"1px solid #e2e8f0",borderRadius:10,overflow:"hidden"},children:(0,Ac.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[(0,Ac.jsx)("thead",{children:(0,Ac.jsxs)("tr",{style:{background:"#f8fafc"},children:[(0,Ac.jsx)("th",{style:{padding:"10px 16px",textAlign:"left",color:"#64748b",fontWeight:600},children:"Campaign"}),(0,Ac.jsx)("th",{style:{padding:"10px 16px",textAlign:"left",color:"#64748b",fontWeight:600},children:"Status"}),(0,Ac.jsx)("th",{style:{padding:"10px 16px",textAlign:"right",color:"#64748b",fontWeight:600},children:"Budget"}),(0,Ac.jsx)("th",{style:{padding:"10px 16px",textAlign:"left",color:"#64748b",fontWeight:600},children:"Ends"})]})}),(0,Ac.jsx)("tbody",{children:m.slice(0,5).map(function(e,t){return(0,Ac.jsxs)("tr",{style:{borderTop:"1px solid #f1f5f9",cursor:"pointer"},onClick:function(){o("campaigns"),a("myCampaigns")},children:[(0,Ac.jsx)("td",{style:{padding:"12px 16px",fontWeight:500,color:"#0f172a"},children:e.iniName||e.name||"—"}),(0,Ac.jsx)("td",{style:{padding:"12px 16px"},children:(0,Ac.jsx)(vl,{status:e.iniStatus||e.status})}),(0,Ac.jsx)("td",{style:{padding:"12px 16px",textAlign:"right",color:"#475569"},children:ml(e.iniTotalBudget||e.totalBudget)}),(0,Ac.jsx)("td",{style:{padding:"12px 16px",color:"#64748b"},children:(n=e.iniEndDate||e.endDate,n?new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—")})]},e.iniId||e.initiativeId||t);var n})})]})}),m.length>5&&(0,Ac.jsxs)("button",{style:{marginTop:8,fontSize:13,color:"var(--accent)",background:"none",border:"none",cursor:"pointer",padding:0},onClick:function(){o("campaigns"),a("myCampaigns")},children:["View all ",m.length," campaigns →"]})]}),d.length>0&&(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h3",{style:{fontSize:15,fontWeight:600,color:"#0f172a",marginBottom:12},children:"Recommendations"}),(0,Ac.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:d.slice(0,3).map(function(e,t){var n=e.severity||e.Severity||"info",r="critical"===n?"#fca5a5":"warning"===n?"#fcd34d":"#93c5fd";return(0,Ac.jsxs)("div",{style:{background:"#fff",border:"1px solid ".concat(r),borderRadius:8,padding:"14px 16px"},children:[(0,Ac.jsx)("div",{style:{fontWeight:600,fontSize:13,color:"#0f172a"},children:e.title||e.Title||"Recommendation"}),(0,Ac.jsx)("div",{style:{fontSize:12,color:"#64748b",marginTop:4},children:e.recommendation||e.Recommendation||e.description||e.Description})]},e.recommendationId||e.RecId||t)})})]}),0===s.length&&0===d.length&&(0,Ac.jsxs)("div",{style:{textAlign:"center",padding:"60px 20px",color:"#94a3b8"},children:[(0,Ac.jsx)("div",{style:{fontSize:40,marginBottom:12},children:"📣"}),(0,Ac.jsx)("div",{style:{fontSize:16,fontWeight:600,color:"#475569",marginBottom:8},children:"No campaigns yet"}),(0,Ac.jsx)("div",{style:{marginBottom:20},children:"Create your first campaign to start advertising on Google, Meta, and TikTok."}),(0,Ac.jsx)("button",{className:"btn-action",onClick:function(){o("campaigns"),a("newCampaign")},children:"Create Campaign"})]})]})}function xl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return wl(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(wl(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,wl(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,wl(u,"constructor",l),wl(l,"constructor",c),c.displayName="GeneratorFunction",wl(l,o,"GeneratorFunction"),wl(u),wl(u,o,"Generator"),wl(u,r,function(){return this}),wl(u,"toString",function(){return"[object Generator]"}),(xl=function(){return{w:a,m:h}})()}function wl(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}wl=function(e,t,n,r){function a(t,n){wl(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},wl(e,t,n,r)}function kl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Cl(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Sl(e){var t={"Content-Type":"application/json"};e&&(t.Authorization="Bearer ".concat(e));var n=localStorage.getItem("adplatform_tenantId");return n&&(t["X-Tenant-Id"]=n),t}function jl(e,t,n,r){return Tl.apply(this,arguments)}function Tl(){var e;return e=xl().m(function e(t,n,r,o){var a,i,s,c;return xl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a={method:t,headers:Sl(o)},r&&"GET"!==t&&(a.body=JSON.stringify(r)),e.n=1,fetch("".concat(Sc).concat(n),a);case 1:return i=e.v,e.n=2,i.json().catch(function(){return null});case 2:return s=e.v,e.a(2,{ok:i.ok&&!1!==(null==s?void 0:s.ok),status:i.status,data:s,error:i.ok?null:(null==s?void 0:s.error)||(null==s?void 0:s.message)||"HTTP ".concat(i.status)});case 3:return e.p=3,c=e.v,e.a(2,{ok:!1,status:0,data:null,error:c.message})}},e,null,[[0,3]])}),Tl=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Cl(a,r,o,i,s,"next",e)}function s(e){Cl(a,r,o,i,s,"throw",e)}i(void 0)})},Tl.apply(this,arguments)}function Il(e){var t=new URLSearchParams;Object.entries(e).forEach(function(e){var n,r,o=(r=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(n,r)||function(e,t){if(e){if("string"==typeof e)return kl(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?kl(e,t):void 0}}(n,r)||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.")}()),a=o[0],i=o[1];null!=i&&t.set(a,String(i))});var n=t.toString();return n?"?"+n:""}function Al(e,t,n,r){return jl("GET","/api/initiative".concat(Il({status:t,page:n,pageSize:r})),null,e)}function Nl(e,t,n){return jl("PATCH","/api/initiative/".concat(e,"/status"),{status:t},n)}function El(e,t){return jl("POST","/api/initiative/stage",e,t)}function _l(e,t){return jl("GET","/api/initiative/".concat(e,"/billing"),null,t)}function Pl(e,t){return jl("POST","/api/initiative/".concat(e,"/launch"),{},t)}function Ol(e,t){return jl("GET","/api/initiative/".concat(e,"/channels"),null,t)}function Rl(e){return jl("GET","/api/initiative/channels/available",null,e)}function Ml(e,t,n){return jl("GET","/api/initiative/templates".concat(Il({businessCategory:t,objective:n})),null,e)}function zl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Ll(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Ll(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Ll(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Ll(u,"constructor",l),Ll(l,"constructor",c),c.displayName="GeneratorFunction",Ll(l,o,"GeneratorFunction"),Ll(u),Ll(u,o,"Generator"),Ll(u,r,function(){return this}),Ll(u,"toString",function(){return"[object Generator]"}),(zl=function(){return{w:a,m:h}})()}function Ll(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ll=function(e,t,n,r){function a(t,n){Ll(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Ll(e,t,n,r)}function Dl(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Fl(e,t){return ql.apply(this,arguments)}function ql(){return e=zl().m(function e(t,n){var r,o,a,i,s,c,l,d,u,h,p,f=arguments;return zl().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=f.length>2&&void 0!==f[2]?f[2]:{},a=(o=f.length>3&&void 0!==f[3]?f[3]:{}).sessionToken,i=o.tenantId,console.log("[API] callService:",t,n),s={"Content-Type":"application/json"},a&&(s.Authorization="Bearer ".concat(a)),(c=i||localStorage.getItem("adplatform_tenantId"))&&(s["X-Tenant-Id"]=c),l="".concat(Sc,"/api/execution/request"),d={provider:t,operation:n,payload:r},console.log("[API] Request URL:",l),console.log("[API] Request body:",d),e.p=1,e.n=2,fetch(l,{method:"POST",headers:s,body:JSON.stringify(d)});case 2:return u=e.v,console.log("[API] Response status:",u.status),e.n=3,u.json().catch(function(){return null});case 3:return h=e.v,e.a(2,{ok:u.ok&&!1!==(null==h?void 0:h.ok),status:u.status,data:h,error:u.ok?null:(null==h?void 0:h.message)||(null==h?void 0:h.error)||"HTTP ".concat(u.status)});case 4:return e.p=4,p=e.v,console.error("[API] Request error:",p),e.a(2,{ok:!1,status:0,data:null,error:p.message||"Network error"})}},e,null,[[1,4]])}),ql=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Dl(a,r,o,i,s,"next",e)}function s(e){Dl(a,r,o,i,s,"throw",e)}i(void 0)})},ql.apply(this,arguments);var e}function Bl(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Ul(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Ul(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Ul(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Ul(u,"constructor",l),Ul(l,"constructor",c),c.displayName="GeneratorFunction",Ul(l,o,"GeneratorFunction"),Ul(u),Ul(u,o,"Generator"),Ul(u,r,function(){return this}),Ul(u,"toString",function(){return"[object Generator]"}),(Bl=function(){return{w:a,m:h}})()}function Ul(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ul=function(e,t,n,r){function a(t,n){Ul(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Ul(e,t,n,r)}function Hl(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Kl(e){var t={"Content-Type":"application/json"};e&&(t.Authorization="Bearer ".concat(e));var n=localStorage.getItem("adplatform_tenantId");return n&&(t["X-Tenant-Id"]=n),t}function $l(e,t,n,r){return Gl.apply(this,arguments)}function Gl(){var e;return e=Bl().m(function e(t,n,r,o){var a,i,s,c;return Bl().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a={method:t,headers:Kl(o)},r&&"GET"!==t&&(a.body=JSON.stringify(r)),e.n=1,fetch("".concat(Sc).concat(n),a);case 1:return i=e.v,e.n=2,i.json().catch(function(){return null});case 2:return s=e.v,e.a(2,{ok:i.ok&&!1!==(null==s?void 0:s.ok),status:i.status,data:s,error:i.ok?null:(null==s?void 0:s.error)||(null==s?void 0:s.message)||"HTTP ".concat(i.status)});case 3:return e.p=3,c=e.v,e.a(2,{ok:!1,status:0,data:null,error:c.message})}},e,null,[[0,3]])}),Gl=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Hl(a,r,o,i,s,"next",e)}function s(e){Hl(a,r,o,i,s,"throw",e)}i(void 0)})},Gl.apply(this,arguments)}function Wl(e){return $l("GET","/api/wizard/config",null,e)}function Vl(e,t,n){return $l("POST","/api/wizard",{name:e,url:t},n)}function Ql(e,t){return $l("GET","/api/wizard/".concat(e),null,t)}function Yl(e,t,n){var r=new URLSearchParams;t&&r.set("status",t),n&&r.set("limit",String(n));var o=r.toString();return $l("GET","/api/wizard".concat(o?"?"+o:""),null,e)}function Jl(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return $l("DELETE","/api/wizard/".concat(e).concat(n?"?force=true":""),null,t)}function Xl(e,t,n,r,o){return $l("PUT","/api/wizard/".concat(e,"/step/").concat(t),{data:n,name:o},r)}function Zl(e,t){return Fl("creative","AnalyzeUrl",{url:e},{sessionToken:t})}function ed(e,t){return Fl("creative","GenerateAssets",{analysis:e},{sessionToken:t})}function td(e,t){return Fl("creative","GetImages",{analysis:e},{sessionToken:t})}function nd(e,t){return Fl("creative","CreateDraft",{url:e},{sessionToken:t})}function rd(e,t,n,r,o){var a={businessCategory:e,objective:t};return n&&(a.ageSkew=n),r&&(a.marketScope=r),$l("POST","/api/wizard/recommend",a,o)}function od(e,t){return Fl("google","SearchGeoTargets",{query:e,countryCode:arguments.length>2&&void 0!==arguments[2]?arguments[2]:"US",maxResults:arguments.length>3&&void 0!==arguments[3]?arguments[3]:10},{sessionToken:t})}function ad(e,t){return $l("GET","/api/demographics/".concat(e),null,t)}function id(e){return id="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},id(e)}function sd(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return cd(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(cd(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,cd(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,cd(u,"constructor",l),cd(l,"constructor",c),c.displayName="GeneratorFunction",cd(l,o,"GeneratorFunction"),cd(u),cd(u,o,"Generator"),cd(u,r,function(){return this}),cd(u,"toString",function(){return"[object Generator]"}),(sd=function(){return{w:a,m:h}})()}function cd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}cd=function(e,t,n,r){function a(t,n){cd(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},cd(e,t,n,r)}function ld(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function dd(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ld(a,r,o,i,s,"next",e)}function s(e){ld(a,r,o,i,s,"throw",e)}i(void 0)})}}function ud(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return hd(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hd(e,t):void 0}}(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 hd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var pd={draft:{label:"Draft",css:"status-draft",color:"gray"},staged:{label:"Ready to Launch",css:"status-staged",color:"blue"},pending:{label:"Launching",css:"status-pending",color:"blue"},submitted:{label:"In Review",css:"status-in-review",color:"blue"},pending_review:{label:"In Review",css:"status-in-review",color:"blue"},in_review:{label:"In Review",css:"status-in-review",color:"blue"},active:{label:"Active",css:"status-active",color:"green"},paused:{label:"Paused",css:"status-paused",color:"orange"},completed:{label:"Completed",css:"status-completed",color:"gray"},cancelled:{label:"Cancelled",css:"status-cancelled",color:"red"},error:{label:"Action Needed",css:"status-action-needed",color:"red"}},fd=["submitted","pending_review","in_review"];function gd(e){var t=(e.iniStatus||e.status||"draft").toLowerCase();if("staged"===t){var n=e.iniStartDate||e.startDate;if(n&&new Date(n)>new Date)return{label:"Scheduled",css:"status-scheduled",color:"blue"}}return pd[t]||pd.draft}function md(e){return(e.iniStatus||e.status||"draft").toLowerCase()}function vd(e){return fd.includes(e)}function bd(e){return e.iniInitiativeId||e.initiativeId||e.id}var yd=[{key:"all",label:"All"},{key:"active",label:"Active"},{key:"in_review",label:"In Review"},{key:"staged",label:"Ready"},{key:"paused",label:"Paused"},{key:"completed",label:"Completed"}],xd={active:["active"],in_review:["submitted","pending_review","in_review","pending"],staged:["staged"],paused:["paused"],completed:["completed","cancelled"]},wd=function(e){var t=parseFloat(e);return!t||isNaN(t)?"$0":t>=1e3?"$".concat((t/1e3).toFixed(t%1e3==0?0:1),"k"):"$".concat(t.toFixed(0))},kd=function(e){return e?new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"},Cd=function(e){if(!e)return"";var t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?"just now":t<3600?"".concat(Math.floor(t/60),"m ago"):t<86400?"".concat(Math.floor(t/3600),"h ago"):"".concat(Math.floor(t/86400),"d ago")},Sd=function(e){return e?{awareness:"Brand Awareness",traffic:"Website Traffic",leads:"Lead Generation",sales:"Sales",conversions:"Conversions"}[e.toLowerCase()]||e.charAt(0).toUpperCase()+e.slice(1):"Campaign"},jd=function(e){return{google_ads:"Google Ads",google:"Google Ads",meta:"Meta",tiktok:"TikTok"}[(e||"").toLowerCase()]||e},Td={search:(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,Ac.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),calendar:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),(0,Ac.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,Ac.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,Ac.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),dollar:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"12",y1:"1",x2:"12",y2:"23"}),(0,Ac.jsx)("path",{d:"M17 5H9.5a3.5 3.5 0 000 7h5a3.5 3.5 0 010 7H6"})]}),play:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:(0,Ac.jsx)("polygon",{points:"5,3 19,12 5,21"})}),pause:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:[(0,Ac.jsx)("rect",{x:"6",y:"4",width:"4",height:"16"}),(0,Ac.jsx)("rect",{x:"14",y:"4",width:"4",height:"16"})]}),rocket:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 00-2.91-.09z"}),(0,Ac.jsx)("path",{d:"M12 15l-3-3a22 22 0 012-3.95A12.88 12.88 0 0122 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 01-4 2z"}),(0,Ac.jsx)("path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"}),(0,Ac.jsx)("path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"})]}),eye:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}),copy:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),(0,Ac.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1"})]}),alert:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,Ac.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),pencil:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),(0,Ac.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]}),plus:(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),(0,Ac.jsx)("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),close:(0,Ac.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Ac.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),chart:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"20",x2:"18",y2:"10"}),(0,Ac.jsx)("line",{x1:"12",y1:"20",x2:"12",y2:"4"}),(0,Ac.jsx)("line",{x1:"6",y1:"20",x2:"6",y2:"14"})]}),x:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,Ac.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),check:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("polyline",{points:"20 6 9 17 4 12"})}),clock:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("polyline",{points:"12 6 12 12 16 14"})]})};function Id(e){var t=e.initiative,n=e.billing,r=e.loading,o=e.onConfirm,a=e.onCancel,i=(null==t?void 0:t.iniName)||(null==t?void 0:t.name)||"Campaign",s=parseFloat((null==t?void 0:t.iniBudget)||(null==t?void 0:t.totalBudget)||0);return(0,Ac.jsx)("div",{className:"modal-overlay",onClick:a,children:(0,Ac.jsxs)("div",{className:"modal-content launch-modal",onClick:function(e){return e.stopPropagation()},children:[(0,Ac.jsxs)("div",{className:"launch-modal-header",children:[(0,Ac.jsx)("div",{className:"launch-modal-icon",children:Td.rocket}),(0,Ac.jsx)("h3",{children:"Launch Campaign"}),(0,Ac.jsxs)("p",{children:["Ready to go live with ",(0,Ac.jsx)("strong",{children:i}),"?"]})]}),n&&(0,Ac.jsxs)("div",{className:"launch-modal-billing",children:[(0,Ac.jsxs)("div",{className:"billing-row",children:[(0,Ac.jsx)("span",{children:"Ad Spend"}),(0,Ac.jsxs)("span",{children:[wd(n.adSpend||s),"/mo"]})]}),n.managementFee>0&&(0,Ac.jsxs)("div",{className:"billing-row",children:[(0,Ac.jsx)("span",{children:"Management Fee"}),(0,Ac.jsxs)("span",{children:[wd(n.managementFee),"/mo"]})]}),(0,Ac.jsxs)("div",{className:"billing-row billing-total",children:[(0,Ac.jsx)("span",{children:"Total Monthly"}),(0,Ac.jsxs)("span",{children:[wd(n.totalCharge||s),"/mo"]})]})]}),!n&&(0,Ac.jsx)("div",{className:"launch-modal-billing",children:(0,Ac.jsxs)("div",{className:"billing-row billing-total",children:[(0,Ac.jsx)("span",{children:"Monthly Budget"}),(0,Ac.jsxs)("span",{children:[wd(s),"/mo"]})]})}),(0,Ac.jsxs)("div",{className:"launch-modal-actions",children:[(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:a,disabled:r,children:"Cancel"}),(0,Ac.jsx)("button",{className:"btn btn-primary btn-launch",onClick:o,disabled:r,children:r?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"mini-spinner"})," Launching…"]}):(0,Ac.jsxs)(Ac.Fragment,{children:[Td.rocket," Launch Now"]})})]})]})})}function Ad(e){var t=e.initiative,n=e.channels,r=e.onClose,o=e.onAction,a=e.actionLoading;if(!t)return null;var i=gd(t),s=md(t),c=parseFloat(t.iniBudget||t.totalBudget||0),l=bd(t),d=vd(s);return(0,Ac.jsx)("div",{className:"detail-panel-overlay",onClick:r,children:(0,Ac.jsxs)("div",{className:"detail-panel",onClick:function(e){return e.stopPropagation()},children:[(0,Ac.jsxs)("div",{className:"detail-panel-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h3",{children:t.iniName||t.name||"Untitled"}),(0,Ac.jsx)("span",{className:"status-badge ".concat(i.css),children:i.label})]}),(0,Ac.jsx)("button",{className:"btn btn-ghost btn-icon",onClick:r,children:Td.close})]}),(0,Ac.jsxs)("div",{className:"detail-panel-body",children:[d&&(0,Ac.jsxs)("div",{className:"detail-notice notice-info",children:[(0,Ac.jsx)("span",{className:"notice-icon",children:Td.clock}),(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("strong",{children:"Under Review"}),(0,Ac.jsx)("p",{children:"This campaign has been submitted to the ad network and is awaiting approval. This typically takes 2448 hours."})]})]}),(0,Ac.jsxs)("section",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Overview"}),(0,Ac.jsxs)("div",{className:"detail-grid",children:[(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Objective"}),(0,Ac.jsx)("span",{className:"detail-value",children:Sd(t.iniObjective||t.objective)})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Budget"}),(0,Ac.jsxs)("span",{className:"detail-value",children:[wd(c),"/",t.iniBudgetPeriod||t.budgetPeriod||"month"]})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"Start Date"}),(0,Ac.jsx)("span",{className:"detail-value",children:kd(t.iniStartDate||t.startDate)})]}),(0,Ac.jsxs)("div",{className:"detail-item",children:[(0,Ac.jsx)("span",{className:"detail-label",children:"End Date"}),(0,Ac.jsx)("span",{className:"detail-value",children:kd(t.iniEndDate||t.endDate)})]})]})]}),n&&n.length>0&&(0,Ac.jsxs)("section",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Channel Allocation"}),(0,Ac.jsx)("div",{className:"channel-allocation-list",children:n.map(function(e,t){var n=parseFloat(e.chcAllocPct||e.allocPct||0),r=c*(n/100),o=(e.chcStatus||e.status||"").toLowerCase(),a=pd[o]||pd.pending;return(0,Ac.jsxs)("div",{className:"channel-alloc-row",children:[(0,Ac.jsxs)("div",{className:"channel-alloc-info",children:[(0,Ac.jsx)("span",{className:"channel-alloc-name",children:jd(e.chcChannel||e.channel)}),(0,Ac.jsx)("span",{className:"status-badge-sm ".concat(a.css),children:a.label}),(0,Ac.jsx)("span",{className:"channel-alloc-budget",children:wd(r)})]}),(0,Ac.jsx)("div",{className:"channel-alloc-bar-track",children:(0,Ac.jsx)("div",{className:"channel-alloc-bar",style:{width:"".concat(Math.min(n,100),"%")}})}),(0,Ac.jsxs)("span",{className:"channel-alloc-pct",children:[n.toFixed(0),"%"]})]},t)})})]}),(0,Ac.jsxs)("section",{className:"detail-section",children:[(0,Ac.jsx)("h4",{children:"Timeline"}),(0,Ac.jsxs)("div",{className:"detail-timeline",children:[(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot created"}),(0,Ac.jsxs)("span",{children:["Created ",kd(t.iniCreatedAt||t.createdAt)]})]}),d&&(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot submitted"}),(0,Ac.jsx)("span",{children:"Submitted for review"})]}),("active"===s||"paused"===s||"completed"===s)&&(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot launched"}),(0,Ac.jsxs)("span",{children:["Launched ",kd(t.iniStartDate||t.startDate)]})]}),"completed"===s&&(0,Ac.jsxs)("div",{className:"timeline-item",children:[(0,Ac.jsx)("span",{className:"timeline-dot completed"}),(0,Ac.jsxs)("span",{children:["Completed ",kd(t.iniEndDate||t.endDate)]})]})]})]}),(0,Ac.jsx)("section",{className:"detail-section",children:(0,Ac.jsxs)("div",{className:"detail-actions",children:["staged"===s&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return o("launch",t)},disabled:a===l,children:[Td.rocket," Launch Campaign"]}),(0,Ac.jsxs)("button",{className:"btn btn-ghost",onClick:function(){return o("cancel",t)},disabled:a===l,children:[Td.x," Cancel"]})]}),d&&(0,Ac.jsxs)("button",{className:"btn btn-outline btn-danger-outline",onClick:function(){return o("cancel",t)},disabled:a===l,children:[Td.x," Cancel Campaign"]}),"active"===s&&(0,Ac.jsxs)("button",{className:"btn btn-outline",onClick:function(){return o("pause",t)},children:[Td.pause," Pause Campaign"]}),"paused"===s&&(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return o("resume",t)},children:[Td.play," Resume Campaign"]}),("completed"===s||"cancelled"===s)&&(0,Ac.jsxs)("button",{className:"btn btn-outline",onClick:function(){return o("duplicate",t)},children:[Td.copy," Duplicate Campaign"]}),"error"===s&&(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return o("resolve",t)},children:[Td.alert," Resolve Issue"]})]})})]})]})})}function Nd(e){var t=e.onNavigate,n=Uc().sessionToken,o=ud((0,r.useState)([]),2),a=o[0],i=o[1],s=ud((0,r.useState)([]),2),c=s[0],l=s[1],d=ud((0,r.useState)(!0),2),u=d[0],h=d[1],p=ud((0,r.useState)("all"),2),f=p[0],g=p[1],m=ud((0,r.useState)(""),2),v=m[0],b=m[1],y=ud((0,r.useState)(null),2),x=y[0],w=y[1],k=ud((0,r.useState)([]),2),C=k[0],S=k[1],j=ud((0,r.useState)(null),2),T=j[0],I=j[1],A=ud((0,r.useState)(null),2),N=A[0],E=A[1],_=ud((0,r.useState)(null),2),P=_[0],O=_[1],R=ud((0,r.useState)(!1),2),M=R[0],z=R[1],L=(0,r.useCallback)(dd(sd().m(function e(){var t,r,o,a,s,c,d,u,p,f;return sd().w(function(e){for(;;)switch(e.p=e.n){case 0:return h(!0),e.p=1,e.n=2,Promise.all([Al(n),Yl(n,"draft",20)]);case 2:t=e.v,r=ud(t,2),o=r[0],a=r[1],o.ok&&(d=(null===(s=o.data)||void 0===s?void 0:s.data)||(null===(c=o.data)||void 0===c?void 0:c.initiatives)||[],i(Array.isArray(d)?d:[])),a.ok&&(p=(null===(u=a.data)||void 0===u?void 0:u.data)||a.data||[],l(Array.isArray(p)?p:[])),e.n=4;break;case 3:e.p=3,f=e.v,console.error("Failed to load campaigns:",f);case 4:h(!1);case 5:return e.a(2)}},e,null,[[1,3]])})),[n]);(0,r.useEffect)(function(){n&&L()},[n,L]);var D=function(){var e=dd(sd().m(function e(t){var r,o,a,i,s;return sd().w(function(e){for(;;)switch(e.n){case 0:if(w(t),!(r=bd(t))){e.n=2;break}return e.n=1,Ol(r,n);case 1:(o=e.v).ok&&(s=(null===(a=o.data)||void 0===a?void 0:a.data)||(null===(i=o.data)||void 0===i?void 0:i.channels)||[],S(Array.isArray(s)?s:[]));case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),F=function(){w(null),S([])},q=function(){var e=dd(sd().m(function e(t){var r,o,a;return sd().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=bd(t),E(t),O(null),e.p=1,e.n=2,_l(r,n);case 2:(a=e.v).ok&&null!==(o=a.data)&&void 0!==o&&o.billing&&O(a.data.billing),e.n=4;break;case 3:e.p=3,e.v;case 4:return e.a(2)}},e,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}}(),B=function(){var e=dd(sd().m(function e(){var t,r,o,a,i;return sd().w(function(e){for(;;)switch(e.p=e.n){case 0:if(N){e.n=1;break}return e.a(2);case 1:return t=bd(N),z(!0),e.p=2,e.n=3,Pl(t,n);case 3:if(!((o=e.v).ok||null!==(r=o.data)&&void 0!==r&&r.channels)){e.n=5;break}return E(null),F(),e.n=4,L();case 4:e.n=6;break;case 5:alert(o.error||(null===(a=o.data)||void 0===a?void 0:a.error)||"Launch failed");case 6:e.n=8;break;case 7:e.p=7,i=e.v,alert("Launch error: "+i.message);case 8:z(!1);case 9:return e.a(2)}},e,null,[[2,7]])}));return function(){return e.apply(this,arguments)}}(),U=function(){var e=dd(sd().m(function e(r,o){var a,i;return sd().w(function(e){for(;;)switch(e.p=e.n){case 0:if(a=bd(o),I(a),e.p=1,"launch"!==r){e.n=2;break}return I(null),q(o),e.a(2);case 2:if("pause"!==r){e.n=5;break}return e.n=3,Nl(a,"paused",n);case 3:return e.n=4,L();case 4:F(),e.n=13;break;case 5:if("resume"!==r){e.n=8;break}return e.n=6,Nl(a,"active",n);case 6:return e.n=7,L();case 7:F(),e.n=13;break;case 8:if("cancel"!==r){e.n=12;break}if(!window.confirm("Cancel this campaign? This action cannot be undone.")){e.n=11;break}return e.n=9,Nl(a,"cancelled",n);case 9:return e.n=10,L();case 10:F();case 11:e.n=13;break;case 12:"duplicate"===r?null==t||t("wizard",{duplicateFrom:a}):"resolve"===r&&D(o);case 13:e.n=15;break;case 14:e.p=14,i=e.v,console.error("Action ".concat(r," failed:"),i);case 15:I(null);case 16:return e.a(2)}},e,null,[[1,14]])}));return function(t,n){return e.apply(this,arguments)}}(),H=function(e){var n=e.wizWizardId||e.wizardId||e.id;null==t||t("wizard",{wizardId:n})},K=function(){var e=dd(sd().m(function e(t,r){var o;return sd().w(function(e){for(;;)switch(e.n){case 0:if(t.stopPropagation(),!(o=r.wizWizardId||r.wizardId||r.id)||!window.confirm("Delete this draft?")){e.n=2;break}return e.n=1,Jl(o,n);case 1:return e.n=2,L();case 2:return e.a(2)}},e)}));return function(t,n){return e.apply(this,arguments)}}(),$=a.filter(function(e){var t,n=md(e);if("all"!==f&&(null===(t=xd[f])||void 0===t||!t.includes(n)))return!1;if(v){var r=v.toLowerCase(),o=(e.iniName||e.name||"").toLowerCase(),a=(e.iniObjective||e.objective||"").toLowerCase(),i=gd(e);if(!o.includes(r)&&!a.includes(r)&&!i.label.toLowerCase().includes(r))return!1}return!0}),G={};return yd.forEach(function(e){"all"===e.key?G[e.key]=a.length:G[e.key]=a.filter(function(t){var n;return null===(n=xd[e.key])||void 0===n?void 0:n.includes(md(t))}).length}),u?(0,Ac.jsx)("div",{className:"view-container",children:(0,Ac.jsx)("div",{style:{textAlign:"center",padding:"60px 0",color:"var(--color-text-muted)"},children:"Loading campaigns…"})}):(0,Ac.jsxs)("div",{className:"view-container",children:[(0,Ac.jsxs)("div",{className:"view-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h2",{children:"Campaigns"}),(0,Ac.jsx)("p",{className:"text-muted",children:"Manage your advertising campaigns across all channels"})]}),(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return null==t?void 0:t("wizard")},children:[Td.plus," New Campaign"]})]}),c.length>0&&(0,Ac.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,Ac.jsxs)("h4",{style:{fontSize:"13px",fontWeight:600,color:"var(--color-text-muted)",textTransform:"uppercase",letterSpacing:"0.5px",marginBottom:"10px"},children:["Drafts (",c.length,")"]}),(0,Ac.jsx)("div",{className:"draft-cards",children:c.map(function(e,t){return(0,Ac.jsxs)("div",{className:"draft-card",onClick:function(){return H(e)},children:[(0,Ac.jsx)("span",{style:{fontSize:"20px"},children:Td.pencil}),(0,Ac.jsxs)("div",{className:"draft-info",children:[(0,Ac.jsx)("span",{style:{fontWeight:600,fontSize:"13px"},children:e.wizName||e.name||"Draft ".concat(t+1)}),(0,Ac.jsx)("span",{style:{fontSize:"12px",color:"var(--color-text-muted)"},children:Cd(e.wizUpdatedAt||e.updatedAt)})]}),(0,Ac.jsx)("button",{className:"btn btn-ghost btn-icon",onClick:function(t){return K(t,e)},title:"Delete draft",style:{marginLeft:"auto",fontSize:"12px",opacity:.5},children:"×"})]},t)})})]}),(0,Ac.jsxs)("div",{className:"campaigns-toolbar",children:[(0,Ac.jsx)("div",{className:"filter-tabs",children:yd.map(function(e){var t=G[e.key]||0,n=f===e.key;return 0!==t||"all"===e.key||n?(0,Ac.jsxs)("button",{className:"filter-tab".concat(n?" active":""),onClick:function(){return g(e.key)},children:[e.label,t>0&&(0,Ac.jsx)("span",{className:"tab-count",children:t})]},e.key):null})}),(0,Ac.jsxs)("div",{className:"search-box",children:[(0,Ac.jsx)("span",{className:"search-icon",children:Td.search}),(0,Ac.jsx)("input",{type:"text",className:"search-input",placeholder:"Search campaigns…",value:v,onChange:function(e){return b(e.target.value)}}),v&&(0,Ac.jsx)("button",{className:"search-clear",onClick:function(){return b("")},children:Td.x})]})]}),0===$.length?(0,Ac.jsxs)("div",{className:"campaigns-empty",children:[(0,Ac.jsx)("div",{className:"campaigns-empty-icon",children:Td.chart}),(0,Ac.jsx)("p",{className:"campaigns-empty-title",children:0===a.length?"No campaigns yet":"No campaigns match your filters"}),(0,Ac.jsx)("p",{className:"campaigns-empty-sub",children:0===a.length?"Create your first campaign to get started.":"Try adjusting your search or filter."})]}):(0,Ac.jsx)("div",{className:"campaign-cards",children:$.map(function(e,t){var n=gd(e),r=md(e),o=bd(e),a=parseFloat(e.iniBudget||e.totalBudget||0),i=e.channels||e.channelSummary||[],s=vd(r);return(0,Ac.jsxs)("div",{className:"campaign-card",onClick:function(){return D(e)},children:[(0,Ac.jsxs)("div",{className:"campaign-card-header",children:[(0,Ac.jsx)("span",{className:"campaign-card-title",children:e.iniName||e.name||"Untitled Campaign"}),(0,Ac.jsx)("span",{className:"status-badge ".concat(n.css),children:n.label})]}),(0,Ac.jsxs)("div",{className:"campaign-card-body",children:[(0,Ac.jsxs)("div",{className:"campaign-card-meta",children:[(0,Ac.jsxs)("span",{children:[Td.dollar," ",wd(a),"/",e.iniBudgetPeriod||e.budgetPeriod||"monthly"]}),(0,Ac.jsxs)("span",{children:[Td.calendar," ",kd(e.iniStartDate||e.startDate)]}),(e.iniObjective||e.objective)&&(0,Ac.jsx)("span",{children:Sd(e.iniObjective||e.objective)})]}),Array.isArray(i)&&i.length>0&&(0,Ac.jsx)("div",{className:"campaign-card-channels",children:i.map(function(e,t){var n="string"==typeof e?e:e.chcChannel||e.channel||e.name,r="object"===id(e)?e.chcAllocPct||e.allocPct:null;return(0,Ac.jsxs)("span",{className:"channel-pill",children:[jd(n),r?" ".concat(parseFloat(r).toFixed(0),"%"):""]},t)})}),(0,Ac.jsxs)("div",{className:"campaign-card-actions",children:["draft"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),H(e)},children:[Td.pencil," Continue"]}),"staged"===r&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:function(t){t.stopPropagation(),U("launch",e)},disabled:T===o,children:[Td.rocket," Launch"]}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-ghost",onClick:function(t){t.stopPropagation(),U("cancel",e)},children:[Td.x," Cancel"]})]}),s&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),D(e)},children:[Td.eye," View Details"]}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-ghost",onClick:function(t){t.stopPropagation(),U("cancel",e)},children:[Td.x," Cancel"]})]}),"active"===r&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),D(e)},children:[Td.chart," Performance"]}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-ghost",onClick:function(t){t.stopPropagation(),U("pause",e)},children:[Td.pause," Pause"]})]}),"paused"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:function(t){t.stopPropagation(),U("resume",e)},children:[Td.play," Resume"]}),"pending"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),D(e)},children:[Td.eye," View Details"]}),("completed"===r||"cancelled"===r)&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(t){t.stopPropagation(),U("duplicate",e)},children:[Td.copy," Duplicate"]}),"error"===r&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-primary",onClick:function(t){t.stopPropagation(),U("resolve",e)},children:[Td.alert," Resolve"]})]})]})]},o||t)})}),x&&(0,Ac.jsx)(Ad,{initiative:x,channels:C,onClose:F,onAction:U,actionLoading:T}),N&&(0,Ac.jsx)(Id,{initiative:N,billing:P,loading:M,onConfirm:B,onCancel:function(){E(null),O(null)}})]})}function Ed(){var e=nl(),t=e.setActiveTab,n=e.setWizardId;return(0,Ac.jsx)(Nd,{onNavigate:function(e,r){"wizard"===e&&(n((null==r?void 0:r.wizardId)||null),t("newCampaign"))}})}function _d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Pd(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Pd(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Pd(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Pd(u,"constructor",l),Pd(l,"constructor",c),c.displayName="GeneratorFunction",Pd(l,o,"GeneratorFunction"),Pd(u),Pd(u,o,"Generator"),Pd(u,r,function(){return this}),Pd(u,"toString",function(){return"[object Generator]"}),(_d=function(){return{w:a,m:h}})()}function Pd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Pd=function(e,t,n,r){function a(t,n){Pd(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Pd(e,t,n,r)}function Od(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Rd(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Md(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Md(e,t):void 0}}(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 Md(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var zd=(0,r.createContext)(null),Ld=function(){return(0,r.useContext)(zd)},Dd=[{name:"awareness",objectiveId:1},{name:"traffic",objectiveId:2},{name:"leads",objectiveId:3},{name:"conversions",objectiveId:4},{name:"sales",objectiveId:5}],Fd=[{name:"restaurant",categoryId:1,icon:"🍽️"},{name:"retail",categoryId:2,icon:"🛍️"},{name:"b2b services",categoryId:3,icon:"💼"},{name:"local services",categoryId:4,icon:"🏠"},{name:"health & wellness",categoryId:5,icon:"🏥"},{name:"general",categoryId:6,icon:"📦"}];function qd(e){return e?e.split(" ").map(function(e){return"&"===e?"&":"b2b"===e.toLowerCase()?"B2B":e.charAt(0).toUpperCase()+e.slice(1)}).join(" "):""}var Bd={awareness:"Reach new audiences and build recognition",traffic:"Drive more visitors to your site",leads:"Get contact form submissions and signups",conversions:"Drive specific actions on your site",sales:"Drive purchases and revenue"},Ud={awareness:"📣",traffic:"🌐",leads:"📋",conversions:"🎯",sales:"💰"},Hd=(Object.fromEntries(["awareness","traffic","leads","conversions","sales"].map(function(e){return[e,qd(e)]})),Object.fromEntries(Fd.map(function(e){return[e.name,qd(e.name)]})),[{channelType:"google_ads",displayName:"Google Ads",description:"Search, Display, Shopping & Performance Max",minMonthlyBudget:300,color:"#4285F4",isStub:!1},{channelType:"meta",displayName:"Meta Ads",description:"Facebook, Instagram, Messenger & Threads",minMonthlyBudget:250,color:"#0668E1",isStub:!0},{channelType:"tiktok",displayName:"TikTok Ads",description:"In-feed video ads across TikTok",minMonthlyBudget:200,color:"#000000",isStub:!0}]);function Kd(e){var t=e.children,n=Uc().sessionToken,o=Rd((0,r.useState)([]),2),a=o[0],i=o[1],s=Rd((0,r.useState)([]),2),c=s[0],l=s[1],d=Rd((0,r.useState)([]),2),u=d[0],h=d[1],p=Rd((0,r.useState)(null),2),f=p[0],g=p[1],m=Rd((0,r.useState)(!0),2),v=m[0],b=m[1];(0,r.useEffect)(function(){var e=!1;function t(){var r;return r=_d().m(function t(){var r,o,a,s,c;return _d().w(function(t){for(;;)switch(t.n){case 0:return b(!0),t.n=1,Promise.all([Wl(n),Rl(n)]);case 1:if(r=t.v,o=Rd(r,2),a=o[0],s=o[1],!e){t.n=2;break}return t.a(2);case 2:a.ok&&a.data?(c=a.data,i(Array.isArray(c.categories)?c.categories:Fd),l(Array.isArray(c.objectives)?c.objectives:Dd)):(console.warn("Wizard config load failed, using fallbacks:",a.error),i(Fd),l(Dd)),s.ok&&s.data?(h(s.data.channels||Hd),g(s.data.allocation||null)):(console.warn("Channels load failed, using fallbacks:",s.error),h(Hd)),b(!1);case 3:return t.a(2)}},t)}),t=function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function i(e){Od(a,n,o,i,s,"next",e)}function s(e){Od(a,n,o,i,s,"throw",e)}i(void 0)})},t.apply(this,arguments)}return function(){t.apply(this,arguments)}(),function(){e=!0}},[n]);var y={categories:a,objectives:c,channels:u,allocationRules:f,loading:v,toDisplayLabel:qd,objectiveDescriptions:Bd,objectiveIcons:Ud,getChannelLabel:function(e){return function(e,t){if(!e)return"Unknown";var n=t.find(function(t){return t.channelType===e});return(null==n?void 0:n.displayName)||qd(e.replace(/_/g," "))}(e,u)},getChannelColor:function(e){return function(e,t){if(!e)return"#4F46E5";var n=t.find(function(t){return t.channelType===e});return(null==n?void 0:n.color)||"#4F46E5"}(e,u)}};return(0,Ac.jsx)(zd.Provider,{value:y,children:t})}function $d(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Gd(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Gd(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Gd(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Gd(u,"constructor",l),Gd(l,"constructor",c),c.displayName="GeneratorFunction",Gd(l,o,"GeneratorFunction"),Gd(u),Gd(u,o,"Generator"),Gd(u,r,function(){return this}),Gd(u,"toString",function(){return"[object Generator]"}),($d=function(){return{w:a,m:h}})()}function Gd(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Gd=function(e,t,n,r){function a(t,n){Gd(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Gd(e,t,n,r)}function Wd(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Vd(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Wd(a,r,o,i,s,"next",e)}function s(e){Wd(a,r,o,i,s,"throw",e)}i(void 0)})}}function Qd(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Yd(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Yd(e,t):void 0}}(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 Yd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Jd=new Map;function Xd(e){var t=e.helpKey,n=e.label,o=Qd((0,r.useState)(!1),2),a=o[0],i=o[1],s=Qd((0,r.useState)(null),2),c=s[0],l=s[1],d=Qd((0,r.useState)(!1),2),u=d[0],h=d[1],p=Qd((0,r.useState)(null),2),f=p[0],g=p[1],m=(0,r.useRef)(null),v=(0,r.useCallback)(Vd($d().m(function e(){var n,r,o;return $d().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!Jd.has(t)){e.n=1;break}return l(Jd.get(t)),e.a(2);case 1:return h(!0),g(null),e.p=2,e.n=3,fetch("".concat(jc,"/api/help/").concat(encodeURIComponent(t)));case 3:return n=e.v,e.n=4,n.json();case 4:(r=e.v).ok?(o={title:r.title,body:r.body},Jd.set(t,o),l(o)):g(r.error||"No help content available yet."),e.n=6;break;case 5:e.p=5,e.v,g("Could not load help content.");case 6:return e.p=6,h(!1),e.f(6);case 7:return e.a(2)}},e,null,[[2,5,6,7]])})),[t]),b=function(){return i(!1)};return(0,r.useEffect)(function(){if(a){var e=function(e){"Escape"===e.key&&b()},t=function(e){m.current&&!m.current.contains(e.target)&&b()};return document.addEventListener("keydown",e),document.addEventListener("mousedown",t),function(){document.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)}}},[a]),(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("button",{className:"help-trigger",onClick:function(){i(!0),v()},title:"Help: ".concat(n||t),children:[(0,Ac.jsx)("span",{className:"help-trigger-icon",children:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("circle",{cx:"8",cy:"8",r:"7"}),(0,Ac.jsx)("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1-.6 1.5-1.3 2S8 9.5 8 10"}),(0,Ac.jsx)("circle",{cx:"8",cy:"12.5",r:".75",fill:"currentColor",stroke:"none"})]})}),n&&(0,Ac.jsx)("span",{className:"help-trigger-label",children:n})]}),a&&(0,Ac.jsx)("div",{className:"help-overlay",children:(0,Ac.jsxs)("div",{className:"help-modal",ref:m,role:"dialog","aria-modal":"true","aria-label":(null==c?void 0:c.title)||"Help",children:[(0,Ac.jsxs)("div",{className:"help-modal-header",children:[(0,Ac.jsxs)("div",{className:"help-modal-title-row",children:[(0,Ac.jsx)("span",{className:"help-modal-icon",children:(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,Ac.jsx)("circle",{cx:"8",cy:"8",r:"7"}),(0,Ac.jsx)("path",{d:"M6 6c0-1.1.9-2 2-2s2 .9 2 2c0 1-.6 1.5-1.3 2S8 9.5 8 10"}),(0,Ac.jsx)("circle",{cx:"8",cy:"12.5",r:".75",fill:"currentColor",stroke:"none"})]})}),(0,Ac.jsx)("h3",{className:"help-modal-title",children:u?"Loading…":(null==c?void 0:c.title)||"Help"})]}),(0,Ac.jsx)("button",{className:"help-modal-close",onClick:b,"aria-label":"Close",children:(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,Ac.jsx)("path",{d:"M3 3l10 10M13 3L3 13"})})})]}),(0,Ac.jsxs)("div",{className:"help-modal-body",children:[u&&(0,Ac.jsxs)("div",{className:"help-loading",children:[(0,Ac.jsx)("div",{className:"help-spinner"}),(0,Ac.jsx)("span",{children:"Loading help…"})]}),!u&&f&&(0,Ac.jsx)("p",{className:"help-error",children:f}),!u&&c&&(0,Ac.jsx)("div",{className:"help-content",dangerouslySetInnerHTML:{__html:c.body}})]}),(0,Ac.jsx)("div",{className:"help-modal-footer",children:(0,Ac.jsx)("span",{className:"help-key-badge",children:t})})]})})]})}function Zd(e){return Zd="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},Zd(e)}function eu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return tu(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(tu(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,tu(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,tu(u,"constructor",l),tu(l,"constructor",c),c.displayName="GeneratorFunction",tu(l,o,"GeneratorFunction"),tu(u),tu(u,o,"Generator"),tu(u,r,function(){return this}),tu(u,"toString",function(){return"[object Generator]"}),(eu=function(){return{w:a,m:h}})()}function tu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}tu=function(e,t,n,r){function a(t,n){tu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},tu(e,t,n,r)}function nu(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function ru(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 ou(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ru(Object(n),!0).forEach(function(t){au(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ru(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function au(e,t,n){return(t=function(e){var t=function(e){if("object"!=Zd(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Zd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Zd(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function iu(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return su(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?su(e,t):void 0}}(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 su(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var cu=(0,r.memo)(function(e){var t=e.data,n=e.onChange,o=Uc().sessionToken,a=Ld(),i=a.categories,s=a.objectives,c=a.loading,l=a.toDisplayLabel,d=a.objectiveDescriptions,u=a.objectiveIcons,h=iu((0,r.useState)(!1),2),p=h[0],f=h[1],g=iu((0,r.useState)(null),2),m=g[0],v=g[1],b=ou({url:"",campaignName:"",objective:"",businessCategory:"",analysis:null},t),y=(0,r.useCallback)(function(e){n(ou(ou({},b),e))},[b,n]);r.useEffect(function(){if(!c&&i.length>0&&!b.businessCategory){var e=i.find(function(e){return"general"===e.name.toLowerCase()});e&&y({businessCategory:e.name})}},[c,i.length]);var x=function(){var e,t=(e=eu().m(function e(){var t,n,r,a,s,c;return eu().w(function(e){for(;;)switch(e.n){case 0:if(b.url){e.n=1;break}return e.a(2);case 1:return f(!0),v(null),e.n=2,Zl(b.url,o);case 2:(t=e.v).ok?(a=(null===(n=t.data)||void 0===n||null===(n=n.result)||void 0===n?void 0:n.data)||(null===(r=t.data)||void 0===r?void 0:r.data)||t.data,s=null!=a&&a.title?"".concat(a.title.slice(0,40)," Campaign"):b.campaignName,c=du(null==a?void 0:a.inferredCategory,i),y({analysis:a,campaignName:b.campaignName||s,businessCategory:b.businessCategory||c})):v(t.error||"Failed to analyze URL"),f(!1);case 3:return e.a(2)}},e)}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){nu(a,r,o,i,s,"next",e)}function s(e){nu(a,r,o,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("div",{className:"step-intro-header",children:[(0,Ac.jsx)("h2",{children:"What's your advertising goal?"}),(0,Ac.jsx)(Xd,{helpKey:"client.wizard.objective",label:"About this step"})]}),(0,Ac.jsx)("p",{children:"Tell us about your business and what you want to achieve. We'll help you reach the right audience across multiple channels."})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Website URL"}),(0,Ac.jsxs)("div",{className:"url-input-row",children:[(0,Ac.jsx)("input",{className:"form-input",type:"url",placeholder:"https://yourwebsite.com",value:b.url,onChange:function(e){return y({url:e.target.value})}}),(0,Ac.jsx)("button",{className:"btn btn-primary",onClick:x,disabled:p||!b.url,children:p?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"btn-spinner"})," Analyzing…"]}):b.analysis?"Re-analyze":"Analyze"})]}),m&&(0,Ac.jsx)("div",{className:"field-error",children:m})]}),b.analysis&&(0,Ac.jsxs)("div",{className:"analysis-card",children:[(0,Ac.jsxs)("div",{className:"analysis-card-header",children:[(0,Ac.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:"Site analyzed successfully"})]}),(0,Ac.jsxs)("div",{className:"analysis-card-body",children:[(0,Ac.jsxs)("div",{className:"analysis-detail",children:[(0,Ac.jsx)("span",{className:"analysis-label",children:"Title"}),(0,Ac.jsx)("span",{className:"analysis-value",children:b.analysis.title||"—"})]}),b.analysis.metaDescription&&(0,Ac.jsxs)("div",{className:"analysis-detail",children:[(0,Ac.jsx)("span",{className:"analysis-label",children:"Description"}),(0,Ac.jsx)("span",{className:"analysis-value",children:b.analysis.metaDescription})]})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Campaign Name"}),(0,Ac.jsx)("input",{className:"form-input",type:"text",placeholder:"e.g. Summer Sale 2025",value:b.campaignName,onChange:function(e){return y({campaignName:e.target.value})}}),(0,Ac.jsx)("span",{className:"field-hint",children:"A name to identify this initiative in your dashboard"})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Business Category"}),(0,Ac.jsx)("span",{className:"field-hint",style:{marginBottom:8,display:"block"},children:"This helps us recommend the best channel mix and budget allocation for your industry."}),c?(0,Ac.jsx)("div",{className:"skeleton",style:{height:48,borderRadius:8}}):(0,Ac.jsxs)("select",{className:"form-select form-select-lg",value:b.businessCategory,onChange:function(e){return y({businessCategory:e.target.value})},children:[(0,Ac.jsx)("option",{value:"",children:"Select your industry…"}),i.map(function(e){return(0,Ac.jsxs)("option",{value:e.name,children:[e.icon||"📦"," ",l(e.name)]},e.categoryId||e.name)})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Advertising Objective"}),c?(0,Ac.jsx)("div",{className:"loading-placeholder",children:(0,Ac.jsx)("div",{className:"objective-grid",children:[1,2,3,4,5].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton",style:{height:80,borderRadius:10}},e)})})}):(0,Ac.jsx)("div",{className:"objective-grid",children:s.map(function(e){return(0,Ac.jsxs)("button",{className:"objective-card ".concat(b.objective===e.name?"selected":""),onClick:function(){return y({objective:e.name})},style:e.color?{"--objective-accent":e.color}:void 0,children:[(0,Ac.jsx)("span",{className:"objective-icon",children:u[e.name]||"🎯"}),(0,Ac.jsx)("span",{className:"objective-label",children:l(e.name)}),d[e.name]&&(0,Ac.jsx)("span",{className:"objective-desc",children:d[e.name]})]},e.objectiveId||e.name)})})]})]})});const lu=cu;function du(e,t){if(!e||null==t||!t.length)return"";for(var n,r=e.toLowerCase(),o=function(){var e=i[a],n=e.regex,o=e.match;if(n.test(r)){var s=t.find(function(e){return e.name.toLowerCase().includes(o)});if(s)return{v:s.name}}},a=0,i=[{regex:/restaurant|food|dining|cafe|bar|bakery|pizza/i,match:"restaurant"},{regex:/retail|shop|store|ecommerce|fashion|boutique/i,match:"retail"},{regex:/b2b|saas|consult|agency|enterprise|software/i,match:"b2b services"},{regex:/plumb|electric|clean|landscap|repair|local|hvac/i,match:"local services"},{regex:/health|medical|dental|fitness|wellness|gym|therapy/i,match:"health"}];a<i.length;a++)if(n=o())return n.v;var s=t.find(function(e){return e.name.toLowerCase()===r||r.includes(e.name.toLowerCase())});if(s)return s.name;var c=t.find(function(e){return"general"===e.name.toLowerCase()});return c?c.name:""}function uu(e){return uu="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},uu(e)}function hu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return pu(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(pu(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,pu(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,pu(u,"constructor",l),pu(l,"constructor",c),c.displayName="GeneratorFunction",pu(l,o,"GeneratorFunction"),pu(u),pu(u,o,"Generator"),pu(u,r,function(){return this}),pu(u,"toString",function(){return"[object Generator]"}),(hu=function(){return{w:a,m:h}})()}function pu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}pu=function(e,t,n,r){function a(t,n){pu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},pu(e,t,n,r)}function fu(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function gu(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){fu(a,r,o,i,s,"next",e)}function s(e){fu(a,r,o,i,s,"throw",e)}i(void 0)})}}function mu(e){return function(e){if(Array.isArray(e))return ku(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||wu(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vu(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 bu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vu(Object(n),!0).forEach(function(t){yu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yu(e,t,n){return(t=function(e){var t=function(e){if("object"!=uu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=uu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==uu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xu(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||wu(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 wu(e,t){if(e){if("string"==typeof e)return ku(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ku(e,t):void 0}}function ku(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Cu=[{id:"AGE_18_24",label:"1824"},{id:"AGE_25_34",label:"2534"},{id:"AGE_35_44",label:"3544"},{id:"AGE_45_54",label:"4554"},{id:"AGE_55_64",label:"5564"},{id:"AGE_65_UP",label:"65+"}],Su=[{id:"MALE",label:"Male"},{id:"FEMALE",label:"Female"},{id:"UNDETERMINED",label:"All Genders"}],ju=[{id:"TOP_10",label:"Top 10%"},{id:"TOP_11_20",label:"1120%"},{id:"TOP_21_30",label:"2130%"},{id:"TOP_31_40",label:"3140%"},{id:"TOP_41_50",label:"4150%"},{id:"LOWER_50",label:"Lower 50%"}];function Tu(e){var t=e.options,n=e.selected,r=e.onToggle,o=e.censusHighlighted;return(0,Ac.jsx)("div",{className:"chip-row",children:t.map(function(e){var t=n.includes(e.id),a=null==o?void 0:o.includes(e.id);return(0,Ac.jsx)("button",{type:"button",className:"chip ".concat(t?"active":""," ").concat(a&&!t?"census-suggested":""),onClick:function(){return r(e.id)},title:a?"Recommended based on local demographics":"",children:e.label},e.id)})})}function Iu(e){var t=e.insights,n=e.census;return e.loading?(0,Ac.jsxs)("div",{className:"market-insight-bar loading",children:[(0,Ac.jsx)("span",{className:"btn-spinner",style:{width:14,height:14}}),(0,Ac.jsx)("span",{children:"Loading market data…"})]}):t&&0!==t.length?(0,Ac.jsxs)("div",{className:"market-insight-bar",children:[(0,Ac.jsxs)("div",{className:"insight-header",children:[(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M3 3v18h18"}),(0,Ac.jsx)("path",{d:"M18.7 8l-5.1 5.2-2.8-2.7L7 14.3"})]}),(0,Ac.jsx)("span",{className:"insight-title",children:"Market Profile"}),(0,Ac.jsx)("span",{className:"insight-source",children:"U.S. Census ACS"})]}),(0,Ac.jsx)("div",{className:"insight-chips",children:t.map(function(e,t){return(0,Ac.jsx)("span",{className:"insight-chip",children:e},t)})}),n&&(0,Ac.jsx)("div",{className:"insight-details",children:(0,Ac.jsxs)("div",{className:"insight-grid",children:[n.medianIncome>0&&(0,Ac.jsxs)("div",{className:"insight-metric",children:[(0,Ac.jsxs)("span",{className:"metric-value",children:["$",(n.medianIncome/1e3).toFixed(0),"K"]}),(0,Ac.jsx)("span",{className:"metric-label",children:"Median Income"})]}),n.medianHomeValue>0&&(0,Ac.jsxs)("div",{className:"insight-metric",children:[(0,Ac.jsxs)("span",{className:"metric-value",children:["$",(n.medianHomeValue/1e3).toFixed(0),"K"]}),(0,Ac.jsx)("span",{className:"metric-label",children:"Home Value"})]}),n.pctBachelorPlus>0&&(0,Ac.jsxs)("div",{className:"insight-metric",children:[(0,Ac.jsxs)("span",{className:"metric-value",children:[n.pctBachelorPlus,"%"]}),(0,Ac.jsx)("span",{className:"metric-label",children:"College Educated"})]}),n.pctOwnerOccupied>0&&(0,Ac.jsxs)("div",{className:"insight-metric",children:[(0,Ac.jsxs)("span",{className:"metric-value",children:[n.pctOwnerOccupied,"%"]}),(0,Ac.jsx)("span",{className:"metric-label",children:"Homeowners"})]})]})})]}):null}function Au(e){var t=(e.type||e.targetType||"").toLowerCase();if("zip code"===t||"postal code"===t){var n=(e.name||"").match(/\b(\d{5})\b/);return n?n[1]:null}var r=(e.name||"").match(/^\d{5}$/);if(r)return r[0];var o=(e.canonicalName||"").match(/\b(\d{5})\b/);return o?o[1]:null}const Nu=(0,r.memo)(function(e){var t,n,o=e.data,a=e.onChange,i=Uc().sessionToken,s=xu((0,r.useState)(""),2),c=s[0],l=s[1],d=xu((0,r.useState)([]),2),u=d[0],h=d[1],p=xu((0,r.useState)(!1),2),f=p[0],g=p[1],m=xu((0,r.useState)(!1),2),v=m[0],b=m[1],y=(0,r.useRef)(null),x=function(e){if(!e||!e.demographics)return e;var t=e.demographics.genders;return t&&2===t.length&&t.includes("MALE")&&t.includes("FEMALE")&&!e.censusData?bu(bu({},e),{},{demographics:bu(bu({},e.demographics),{},{genders:[]})}):e}(o),w=bu({locations:[],demographics:{ageRanges:[],genders:[],incomes:[]},ageSkew:null,marketScope:"national",censusData:null,censusInsights:null,censusRecommendations:null},x),k=(0,r.useCallback)(function(e){var t=bu(bu({},w),e);t.ageSkew=function(e){if(!e||0===e.length)return null;var t=["AGE_18_24","AGE_25_34"],n=["AGE_45_54","AGE_55_64","AGE_65_UP"],r=e.filter(function(e){return t.includes(e)}).length,o=e.filter(function(e){return n.includes(e)}).length;return r>0&&0===o?"young":o>0&&0===r?"mature":r>o?"young":o>r?"mature":null}(t.demographics.ageRanges),t.marketScope=function(e){if(!e||0===e.length)return"national";var t=e.map(function(e){return(e.type||"").toLowerCase()});if(t.some(function(e){return"country"===e}))return"national";var n=new Set;e.forEach(function(e){var t=(e.canonicalName||"").split(",").map(function(e){return e.trim()});t.length>=2&&n.add(t[t.length-2])});var r=t.filter(function(e){return["state","province","region"].includes(e)});return r.length>=2?"national":1===r.length?"regional":n.size<=1?"local":n.size<=3?"regional":"national"}(t.locations),a(t)},[w,a]),C=function(e,t){var n=w.demographics[e]||[];!function(e,t){k({demographics:bu(bu({},w.demographics),{},yu({},e,t))})}(e,n.includes(t)?n.filter(function(e){return e!==t}):[].concat(mu(n),[t]))},S=function(){var e=gu(hu().m(function e(t,n){var r,o,a,s,c,l,d;return hu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t&&5===t.length&&i){e.n=1;break}return e.a(2);case 1:return b(!0),e.p=2,e.n=3,ad(t,i);case 3:(r=e.v).ok&&r.data&&(o=r.data,a=o.recommendations||{},s=a.ageRanges||w.demographics.ageRanges,c=a.incomes||w.demographics.incomes,l=0===w.demographics.genders.length?["UNDETERMINED"]:w.demographics.genders,k({locations:n||w.locations,demographics:bu(bu({},w.demographics),{},{ageRanges:s,incomes:c,genders:l}),censusData:o.census||null,censusInsights:o.insights||null,censusRecommendations:a})),e.n=5;break;case 4:e.p=4,d=e.v,console.warn("Census lookup error:",d);case 5:b(!1);case 6:return e.a(2)}},e,null,[[2,4]])}));return function(t,n){return e.apply(this,arguments)}}(),j=/^\d{5}$/.test(c.trim()),T=function(){var e=c.trim();if(/^\d{5}$/.test(e)&&!w.locations.some(function(t){return t.name===e})){var t=[].concat(mu(w.locations),[{id:"zip_".concat(e),name:e,type:"Zip Code",canonicalName:"".concat(e,", United States")}]);k({locations:t}),l(""),h([]),S(e,t)}},I=function(){var e=gu(hu().m(function e(t){var n,r,o,a,s,c;return hu().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t&&!(t.length<2)){e.n=1;break}return h([]),e.a(2);case 1:return g(!0),e.p=2,e.n=3,od(t,i);case 3:(n=e.v).ok&&(s=(null===(r=n.data)||void 0===r||null===(r=r.result)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.results)||(null===(o=n.data)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.results)||(null===(a=n.data)||void 0===a?void 0:a.results)||[],h(s)),e.n=5;break;case 4:e.p=4,c=e.v,console.warn("Geo search error:",c);case 5:g(!1);case 6:return e.a(2)}},e,null,[[2,4]])}));return function(t){return e.apply(this,arguments)}}(),A={ageSkew:{young:"Younger audience",mature:"Mature audience",null:"Balanced"},marketScope:{local:"Local market",regional:"Regional",national:"National"}};return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("div",{className:"step-intro-header",children:[(0,Ac.jsx)("h2",{children:"Who is your audience?"}),(0,Ac.jsx)(Xd,{helpKey:"client.wizard.audience",label:"About this step"})]}),(0,Ac.jsx)("p",{children:"Add your target location and we'll analyze the local market to recommend the best audience targeting for your campaign."})]}),(0,Ac.jsxs)("div",{className:"audience-section",children:[(0,Ac.jsxs)("h3",{children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),"Target Locations"]}),(0,Ac.jsxs)("div",{className:"geo-search-wrap",children:[(0,Ac.jsxs)("div",{className:"geo-input-row",children:[(0,Ac.jsx)("input",{className:"form-input",placeholder:"Enter a ZIP code or search cities, states…",value:c,onChange:function(e){return t=e.target.value,l(t),clearTimeout(y.current),void(/^\d{3,5}$/.test(t.trim())?h([]):y.current=setTimeout(function(){return I(t)},400));var t},onKeyDown:function(e){"Enter"===e.key&&j&&(e.preventDefault(),T())}}),j&&(0,Ac.jsx)("button",{type:"button",className:"btn btn-primary btn-sm zip-lookup-btn",onClick:T,children:"Look Up"})]}),f&&(0,Ac.jsx)("span",{className:"geo-search-spinner",children:(0,Ac.jsx)("span",{className:"btn-spinner"})}),u.length>0&&(0,Ac.jsx)("div",{className:"geo-dropdown",children:u.map(function(e){return(0,Ac.jsxs)("button",{type:"button",className:"geo-result",onClick:function(){return function(e){if(!w.locations.some(function(t){return t.id===e.id})){var t=[].concat(mu(w.locations),[{id:e.id,name:e.name,type:e.targetType||e.type||"Location",canonicalName:e.canonicalName}]);k({locations:t}),l(""),h([]);var n=Au(e);n&&S(n,t)}}(e)},disabled:w.locations.some(function(t){return t.id===e.id}),children:[(0,Ac.jsx)("span",{className:"geo-result-name",children:e.name}),(0,Ac.jsx)("span",{className:"geo-result-type",children:e.targetType||e.type}),(0,Ac.jsx)("span",{className:"geo-result-canonical",children:e.canonicalName})]},e.id)})})]}),w.locations.length>0&&(0,Ac.jsx)("div",{className:"location-chips",children:w.locations.map(function(e){return(0,Ac.jsxs)("span",{className:"location-chip",children:[(0,Ac.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0118 0z"}),(0,Ac.jsx)("circle",{cx:"12",cy:"10",r:"3"})]}),e.name,(0,Ac.jsx)("button",{type:"button",onClick:function(){return t=e.id,r={locations:n=w.locations.filter(function(e){return e.id!==t})},n.some(function(e){return Au(e)})||(r.censusData=null,r.censusInsights=null,r.censusRecommendations=null,r.demographics=bu(bu({},w.demographics),{},{ageRanges:[],genders:[],incomes:[]})),void k(r);var t,n,r},className:"chip-remove",children:"×"})]},e.id)})}),0===w.locations.length&&(0,Ac.jsx)("div",{className:"field-hint",style:{marginTop:8},children:"Enter a ZIP code to see local market demographics and auto-fill targeting recommendations."})]}),(0,Ac.jsx)(Iu,{insights:w.censusInsights,census:w.censusData,loading:v}),(0,Ac.jsxs)("div",{className:"audience-section",children:[(0,Ac.jsxs)("h3",{children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M17 21v-2a4 4 0 00-4-4H5a4 4 0 00-4 4v2"}),(0,Ac.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,Ac.jsx)("path",{d:"M23 21v-2a4 4 0 00-3-3.87"}),(0,Ac.jsx)("path",{d:"M16 3.13a4 4 0 010 7.75"})]}),"Demographics",w.censusData&&(0,Ac.jsx)("span",{className:"census-badge",children:"Auto-populated from market data"})]}),(0,Ac.jsxs)("div",{className:"demo-group",children:[(0,Ac.jsx)("label",{children:"Age Ranges"}),(0,Ac.jsx)(Tu,{options:Cu,selected:w.demographics.ageRanges,onToggle:function(e){return C("ageRanges",e)},censusHighlighted:null===(t=w.censusRecommendations)||void 0===t?void 0:t.ageRanges}),0===w.demographics.ageRanges.length&&!w.censusData&&(0,Ac.jsx)("span",{className:"field-hint",children:"Add a ZIP code above to auto-fill, or select manually"})]}),(0,Ac.jsxs)("div",{className:"demo-group",children:[(0,Ac.jsx)("label",{children:"Gender"}),(0,Ac.jsx)(Tu,{options:Su,selected:w.demographics.genders,onToggle:function(e){return C("genders",e)}}),0===w.demographics.genders.length&&(0,Ac.jsx)("span",{className:"field-hint",children:"Will default to All Genders when market data loads"})]}),(0,Ac.jsxs)("div",{className:"demo-group",children:[(0,Ac.jsxs)("label",{children:["Household Income",w.censusData?(0,Ac.jsx)("span",{className:"census-badge small",children:"Market-informed"}):(0,Ac.jsx)("span",{className:"optional-tag",children:"Optional"})]}),(0,Ac.jsx)(Tu,{options:ju,selected:w.demographics.incomes,onToggle:function(e){return C("incomes",e)},censusHighlighted:null===(n=w.censusRecommendations)||void 0===n?void 0:n.incomes})]})]}),(0,Ac.jsxs)("div",{className:"audience-profile-summary",children:[(0,Ac.jsxs)("div",{className:"audience-profile-header",children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),(0,Ac.jsx)("span",{className:"audience-profile-title",children:w.censusData?"Market-Informed Profile":"Audience Profile"}),(0,Ac.jsx)("span",{className:"audience-profile-hint",children:w.censusData?"Based on U.S. Census data for your target area — adjust above to override":"Derived from your selections — used for channel recommendations"})]}),(0,Ac.jsxs)("div",{className:"profile-factors",children:[(0,Ac.jsxs)("div",{className:"profile-factor",children:[(0,Ac.jsx)("span",{className:"factor-label",children:"Age Profile"}),(0,Ac.jsx)("span",{className:"factor-value ".concat(w.ageSkew?"has-value":"neutral"),children:A.ageSkew[w.ageSkew]||"Balanced"})]}),(0,Ac.jsxs)("div",{className:"profile-factor",children:[(0,Ac.jsx)("span",{className:"factor-label",children:"Market Scope"}),(0,Ac.jsx)("span",{className:"factor-value has-value",children:A.marketScope[w.marketScope]||"National"})]})]})]})]})});function Eu(e){return Eu="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},Eu(e)}function _u(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 Pu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_u(Object(n),!0).forEach(function(t){Ou(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ou(e,t,n){return(t=function(e){var t=function(e){if("object"!=Eu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Eu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Eu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ru=function(){return(new Date).toISOString().split("T")[0]};const Mu=(0,r.memo)(function(e){var t,n,o=e.data,a=e.onChange,i=Pu({totalBudget:"",budgetPeriod:"monthly",startDate:Ru(),endDate:(t=new Date,t.setDate(t.getDate()+30),t.toISOString().split("T")[0]),hasEndDate:!0},o),s=(0,r.useCallback)(function(e){a(Pu(Pu({},i),e))},[i,a]),c=parseFloat(i.totalBudget)||0,l="daily"===i.budgetPeriod?c:c/30,d=i.hasEndDate&&i.startDate&&i.endDate?Math.max(1,Math.ceil((new Date(i.endDate)-new Date(i.startDate))/864e5)):30,u="daily"===i.budgetPeriod?[25,50,100,250]:[500,1e3,2500,5e3],h=(n="daily"===i.budgetPeriod?30*c:c)<=0?null:n<500?{label:"Starter",desc:"Best suited for a single channel",color:"#94A3B8",channels:1}:n<1500?{label:"Growth",desc:"Enough for 12 channels",color:"#3B82F6",channels:2}:n<3e3?{label:"Accelerate",desc:"Supports 23 channels effectively",color:"#8B5CF6",channels:3}:{label:"Scale",desc:"Full multi-channel coverage",color:"#10B981",channels:3};return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("div",{className:"step-intro-header",children:[(0,Ac.jsx)("h2",{children:"What's your advertising budget?"}),(0,Ac.jsx)(Xd,{helpKey:"client.wizard.budget",label:"About this step"})]}),(0,Ac.jsx)("p",{children:"Set your total budget and schedule. We'll use this to recommend the best channel mix and show you estimated performance in the next step."})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Budget Period"}),(0,Ac.jsxs)("div",{className:"period-toggle",children:[(0,Ac.jsx)("button",{className:"toggle-btn ".concat("monthly"===i.budgetPeriod?"active":""),onClick:function(){return s({budgetPeriod:"monthly"})},children:"Monthly"}),(0,Ac.jsx)("button",{className:"toggle-btn ".concat("daily"===i.budgetPeriod?"active":""),onClick:function(){return s({budgetPeriod:"daily"})},children:"Daily"})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Budget Amount"}),(0,Ac.jsxs)("div",{className:"budget-input-row",children:[(0,Ac.jsx)("span",{className:"budget-prefix",children:"$"}),(0,Ac.jsx)("input",{className:"form-input budget-input",type:"number",min:"1",step:"1",placeholder:"daily"===i.budgetPeriod?"50":"1500",value:i.totalBudget,onChange:function(e){return s({totalBudget:e.target.value})}}),(0,Ac.jsxs)("span",{className:"budget-suffix",children:["/ ","daily"===i.budgetPeriod?"day":"month"]})]}),(0,Ac.jsx)("div",{className:"budget-presets",children:u.map(function(e){return(0,Ac.jsxs)("button",{className:"preset-chip ".concat(parseFloat(i.totalBudget)===e?"active":""),onClick:function(){return s({totalBudget:String(e)})},children:["$",e.toLocaleString()]},e)})})]}),c>0&&(0,Ac.jsx)("div",{className:"estimate-banner",children:(0,Ac.jsxs)("div",{className:"estimate-row",children:[(0,Ac.jsx)("span",{children:"daily"===i.budgetPeriod?"~$".concat((30*c).toLocaleString()," / month"):"~$".concat(l.toFixed(2)," / day")}),i.hasEndDate&&(0,Ac.jsxs)("strong",{children:["$",(l*d).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})," estimated total (",d," days)"]})]})}),h&&(0,Ac.jsxs)("div",{className:"budget-tier-card",style:{"--tier-color":h.color},children:[(0,Ac.jsxs)("div",{className:"budget-tier-header",children:[(0,Ac.jsx)("span",{className:"budget-tier-label",style:{color:h.color},children:h.label}),(0,Ac.jsx)("span",{className:"budget-tier-channels",children:1===h.channels?"1 channel recommended":"Up to ".concat(h.channels," channels")})]}),(0,Ac.jsx)("div",{className:"budget-tier-desc",children:h.desc}),(0,Ac.jsx)("div",{className:"budget-tier-bar",children:["Starter","Growth","Accelerate","Scale"].map(function(e,t){return(0,Ac.jsx)("div",{className:"tier-segment ".concat(e===h.label?"active":""),style:e===h.label?{background:h.color}:void 0},e)})})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{children:"Schedule"}),(0,Ac.jsxs)("div",{className:"form-row",children:[(0,Ac.jsxs)("div",{className:"form-group",style:{marginBottom:0},children:[(0,Ac.jsx)("label",{className:"field-sub-label",children:"Start Date"}),(0,Ac.jsx)("input",{className:"form-input",type:"date",value:i.startDate,min:Ru(),onChange:function(e){return s({startDate:e.target.value})}})]}),(0,Ac.jsxs)("div",{className:"form-group",style:{marginBottom:0},children:[(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,Ac.jsx)("label",{className:"field-sub-label",children:"End Date"}),(0,Ac.jsxs)("label",{className:"toggle-label",children:[(0,Ac.jsx)("input",{type:"checkbox",checked:i.hasEndDate,onChange:function(e){return s({hasEndDate:e.target.checked})}}),(0,Ac.jsx)("span",{className:"toggle-text",children:i.hasEndDate?"Set":"No end date"})]})]}),(0,Ac.jsx)("input",{className:"form-input",type:"date",value:i.endDate,min:i.startDate||Ru(),disabled:!i.hasEndDate,onChange:function(e){return s({endDate:e.target.value})}})]})]})]})]})});function zu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Lu(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Lu(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Lu(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Lu(u,"constructor",l),Lu(l,"constructor",c),c.displayName="GeneratorFunction",Lu(l,o,"GeneratorFunction"),Lu(u),Lu(u,o,"Generator"),Lu(u,r,function(){return this}),Lu(u,"toString",function(){return"[object Generator]"}),(zu=function(){return{w:a,m:h}})()}function Lu(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Lu=function(e,t,n,r){function a(t,n){Lu(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Lu(e,t,n,r)}function Du(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Fu(e){var t={"Content-Type":"application/json"};e&&(t.Authorization="Bearer ".concat(e));var n=localStorage.getItem("adplatform_tenantId");return n&&(t["X-Tenant-Id"]=n),t}function qu(){var e;return e=zu().m(function e(t,n,r,o){var a,i,s,c;return zu().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a={method:t,headers:Fu(o)},r&&"GET"!==t&&(a.body=JSON.stringify(r)),e.n=1,fetch("".concat(Sc).concat(n),a);case 1:return i=e.v,e.n=2,i.json().catch(function(){return null});case 2:return s=e.v,e.a(2,{ok:i.ok&&!1!==(null==s?void 0:s.ok),status:i.status,data:s,error:i.ok?null:(null==s?void 0:s.error)||(null==s?void 0:s.message)||"HTTP ".concat(i.status)});case 3:return e.p=3,c=e.v,e.a(2,{ok:!1,status:0,data:null,error:c.message})}},e,null,[[0,3]])}),qu=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Du(a,r,o,i,s,"next",e)}function s(e){Du(a,r,o,i,s,"throw",e)}i(void 0)})},qu.apply(this,arguments)}function Bu(e,t){return function(e,t,n,r){return qu.apply(this,arguments)}("POST","/api/forecast/channel-estimate",e,t)}function Uu(e){return Uu="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},Uu(e)}function Hu(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Ku(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Ku(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Ku(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Ku(u,"constructor",l),Ku(l,"constructor",c),c.displayName="GeneratorFunction",Ku(l,o,"GeneratorFunction"),Ku(u),Ku(u,o,"Generator"),Ku(u,r,function(){return this}),Ku(u,"toString",function(){return"[object Generator]"}),(Hu=function(){return{w:a,m:h}})()}function Ku(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Ku=function(e,t,n,r){function a(t,n){Ku(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Ku(e,t,n,r)}function $u(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Gu(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){$u(a,r,o,i,s,"next",e)}function s(e){$u(a,r,o,i,s,"throw",e)}i(void 0)})}}function Wu(e){return function(e){if(Array.isArray(e))return Zu(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Xu(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Vu(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 Qu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vu(Object(n),!0).forEach(function(t){Yu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Yu(e,t,n){return(t=function(e){var t=function(e){if("object"!=Uu(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Uu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Uu(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ju(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||Xu(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 Xu(e,t){if(e){if("string"==typeof e)return Zu(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Zu(e,t):void 0}}function Zu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var eh=function(e){return null!=e?Number(e).toLocaleString(void 0,{maximumFractionDigits:0}):"—"},th=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return null!=e?Number(e).toLocaleString(void 0,{minimumFractionDigits:t,maximumFractionDigits:t}):"—"},nh={google_ads:(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"#4285F4",strokeWidth:"2"}),(0,Ac.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"bold",fill:"#4285F4",children:"G"})]}),meta:(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"#0668E1",strokeWidth:"2"}),(0,Ac.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"bold",fill:"#0668E1",children:"M"})]}),tiktok:(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10",stroke:"#000000",strokeWidth:"2"}),(0,Ac.jsx)("text",{x:"12",y:"16",textAnchor:"middle",fontSize:"12",fontWeight:"bold",fill:"#000000",children:"T"})]})},rh=(0,r.memo)(function(e){var t,n=e.data,o=e.onChange,a=e.objectiveData,i=e.audienceData,s=e.budgetData,c=Uc().sessionToken,l=Ld(),d=l.getChannelLabel,u=l.getChannelColor,h=l.channels,p=l.allocationRules,f=l.loading,g=Ju((0,r.useState)([]),2),m=g[0],v=g[1],b=Ju((0,r.useState)(!1),2),y=(b[0],b[1]),x=Ju((0,r.useState)(null),2),w=x[0],k=x[1],C=Ju((0,r.useState)(!1),2),S=C[0],j=C[1],T=Ju((0,r.useState)(null),2),I=T[0],A=T[1],N=(0,r.useRef)(null),E=Qu({selectedChannels:[],allocations:{},allocationStrategy:"manual"},n),_=E.selectedChannels||[],P=_.length>1,O=parseFloat(null==s?void 0:s.totalBudget)||0,R=(null==s?void 0:s.budgetPeriod)||"monthly",M="daily"===R?30*O:O,z=(0,r.useCallback)(function(e){o(Qu(Qu({},E),e))},[E,o]),L=function(e){var t=E.selectedChannels,n=t.includes(e)?t.filter(function(t){return t!==e}):[].concat(Wu(t),[e]);z({selectedChannels:n})},D=null==a?void 0:a.objective,F=E.selectedChannels.length;(0,r.useEffect)(function(){var e=E.allocations||{};if((_.some(function(t){return!(t in e)})||_.length!==Object.keys(e).length)&&_.length>0){var t=Math.floor(100/_.length),n=100-t*_.length,r={};_.forEach(function(o,a){r[o]=e[o]||t+(0===a?n:0)}),z({allocations:r})}},[_.join(",")]);var q=[];null!=i&&i.marketScope&&"national"!==i.marketScope&&q.push(i.marketScope+" market"),null!=i&&i.ageSkew&&q.push("young"===i.ageSkew?"younger audience":"mature audience"),(0,r.useEffect)(function(){function e(){return(e=Gu(Hu().m(function e(){var t,n,r,o,s,l,d,u,h,p;return Hu().w(function(e){for(;;)switch(e.n){case 0:if(y(!0),t=(null==i?void 0:i.ageSkew)||null,n=(null==i?void 0:i.marketScope)||null,!t&&!n){e.n=2;break}return e.n=1,rd(null==a?void 0:a.businessCategory,null==a?void 0:a.objective,t,n,c);case 1:if(!(o=e.v).ok||null===(r=o.data)||void 0===r||!r.channels){e.n=2;break}return l=o.data.channels||(null===(s=o.data.data)||void 0===s?void 0:s.channels)||[],v(l.map(function(e){return{channelType:e.channelType,allocationPct:e.recommendedPct,rationale:e.baseRationale}})),y(!1),e.a(2);case 2:return e.n=3,Ml(c,null==a?void 0:a.businessCategory,null==a?void 0:a.objective);case 3:(d=e.v).ok&&(p=(null===(u=d.data)||void 0===u?void 0:u.data)||(null===(h=d.data)||void 0===h?void 0:h.templates)||[],v(Array.isArray(p)?p:[])),y(!1);case 4:return e.a(2)}},e)}))).apply(this,arguments)}P&&function(){e.apply(this,arguments)}()},[c,null==a?void 0:a.businessCategory,null==a?void 0:a.objective,P,null==i?void 0:i.ageSkew,null==i?void 0:i.marketScope]);var B=(0,r.useCallback)(function(){var e=Gu(Hu().m(function e(t){var n,r,o,s,l,d,u,h,p,f,g;return Hu().w(function(e){for(;;)switch(e.n){case 0:if(t&&!(t<=0)&&0!==_.length){e.n=1;break}return k(null),e.a(2);case 1:if(l=null==a?void 0:a.analysis,d=[],null!=l&&l.keywords&&d.push.apply(d,Wu(l.keywords)),null!=l&&l.suggestedKeywords&&d.push.apply(d,Wu(l.suggestedKeywords)),0===d.length&&(null!=l&&l.title&&d.push(l.title),null!=a&&a.businessCategory&&d.push(a.businessCategory),null!=l&&l.metaDescription&&(u=l.metaDescription.split(/\s+/).slice(0,6).join(" "))&&d.push(u)),0!==d.length){e.n=2;break}return A("No keywords available — analyze your URL in Step 1"),e.a(2);case 2:return h={},(null==i||null===(n=i.locations)||void 0===n?void 0:n.length)>0&&(h.zipCodes=i.locations.filter(function(e){return"zip"===e.type||e.zipCode}).map(function(e){return e.zipCode||e.value}),h.geoTargetIds=i.locations.filter(function(e){return e.geoTargetId}).map(function(e){return e.geoTargetId})),p={ageMin:null==i||null===(r=i.demographics)||void 0===r?void 0:r.ageMin,ageMax:null==i||null===(o=i.demographics)||void 0===o?void 0:o.ageMax},j(!0),A(null),e.n=3,Bu({objective:(null==a?void 0:a.objective)||"traffic",businessCategory:null==a?void 0:a.businessCategory,keywords:d,geoTargeting:h,audience:p,monthlyBudget:t,channels:_},c);case 3:f=e.v,j(!1),f.ok&&null!==(s=f.data)&&void 0!==s&&s.channels?(k(f.data),P&&f.data.channels.length>0&&(g={},f.data.channels.forEach(function(e){_.includes(e.provider)&&(g[e.provider]=e.allocationPercent)}),"manual-adjusted"!==E.allocationStrategy&&z({allocations:g,allocationStrategy:"forecast"}))):A(f.error||"Could not load estimates");case 4:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),[_.join(","),null==a?void 0:a.objective,null==a?void 0:a.businessCategory,null==a?void 0:a.analysis,i,c]);(0,r.useEffect)(function(){return N.current&&clearTimeout(N.current),M>0&&_.length>0?N.current=setTimeout(function(){return B(M)},800):k(null),function(){N.current&&clearTimeout(N.current)}},[M,_.join(","),B]);var U=Object.values(E.allocations).reduce(function(e,t){return e+(t||0)},0),H=Math.abs(U-100)<.01,K=function(e,t){var n=Math.max(0,Math.min(100,parseInt(t)||0));z({allocations:Qu(Qu({},E.allocations),{},Yu({},e,n)),allocationStrategy:"manual-adjusted"})};return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("div",{className:"step-intro-header",children:[(0,Ac.jsxs)("h2",{children:["Choose your channels",P?" & allocation":""]}),(0,Ac.jsx)(Xd,{helpKey:"client.wizard.channels",label:"About this step"})]}),(0,Ac.jsxs)("p",{children:[M>0?"With your $".concat(M.toLocaleString(),"/mo budget, select the channels where you want to advertise."):"Select one or more advertising channels.",F>1?" We'll show estimated performance and help you split the budget.":"",D?" All optimized for your ".concat(D," objective."):""]})]}),(0,Ac.jsxs)("div",{className:"channel-context-bar",children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),(0,Ac.jsxs)("span",{children:[M>0&&(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsxs)("strong",{children:["$",M.toLocaleString(),"/mo"]})," budget"]}),D&&(0,Ac.jsxs)(Ac.Fragment,{children:[M>0?" · ":"","Optimized for ",(0,Ac.jsx)("strong",{children:D})]}),q.length>0&&(0,Ac.jsxs)(Ac.Fragment,{children:[" · ",q.join(" and ")]}),(null==a?void 0:a.businessCategory)&&(0,Ac.jsxs)(Ac.Fragment,{children:[" · ",(0,Ac.jsx)("strong",{children:a.businessCategory})]})]})]}),f?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:120,marginBottom:16}},e)})}):(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("div",{className:"channel-grid",children:h.map(function(e){var t,n,r=(n=e.channelType,E.selectedChannels.includes(n)),o=function(e){return!D||!e.supportedObjectives||e.supportedObjectives.includes(D)}(e),a=function(e){return M<=0||M>=(e.minMonthlyBudget||0)}(e),i=function(e){return!!D&&({awareness:["meta","tiktok","google_ads"],traffic:["google_ads","meta"],leads:["google_ads","meta"],conversions:["google_ads","meta"],sales:["google_ads","meta"]}[D]||[]).includes(e)}(e.channelType),s=function(e){var t;return(null===(t={google_ads:{awareness:"Strong reach via Display & YouTube",traffic:"High-intent search traffic",leads:"Search captures active prospects",conversions:"Intent-driven conversion engine",sales:"Shopping & search drive purchases"},meta:{awareness:"Massive reach on Facebook & Instagram",traffic:"Visual storytelling drives clicks",leads:"Lead forms built into the platform",conversions:"Advanced pixel tracking & lookalikes",sales:"Shop integration & dynamic product ads"},tiktok:{awareness:"Viral potential with younger audiences",traffic:"Engaging video drives curiosity clicks",leads:"Growing lead gen capabilities",conversions:"Strong for impulse & discovery",sales:"TikTok Shop integration"}}[e])||void 0===t?void 0:t[D])||null}(e.channelType),c=r?e.color||"#4F46E5":"transparent",l=!o||!a;return(0,Ac.jsxs)("button",{className:"channel-card ".concat(r?"selected":""," ").concat(l?"unsupported":""),style:{"--channel-color":e.color||"#4F46E5",borderColor:c},onClick:function(){return!l&&L(e.channelType)},disabled:l,children:[(0,Ac.jsxs)("div",{className:"channel-card-header",children:[(0,Ac.jsx)("div",{className:"channel-icon",children:nh[e.channelType]||(0,Ac.jsx)("div",{className:"channel-icon-fallback",style:{background:e.color||"#4F46E5"},children:null===(t=e.displayName)||void 0===t?void 0:t.charAt(0)})}),(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[i&&o&&a&&(0,Ac.jsxs)("span",{className:"channel-rec-badge",children:[(0,Ac.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})}),"Recommended"]}),(0,Ac.jsx)("div",{className:"channel-card-check",children:r?(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,Ac.jsx)("div",{className:"check-empty"})})]})]}),(0,Ac.jsxs)("div",{className:"channel-card-body",children:[(0,Ac.jsxs)("div",{className:"channel-name",children:[e.displayName,e.isStub&&(0,Ac.jsx)("span",{className:"stub-badge",children:"Preview"})]}),(0,Ac.jsx)("div",{className:"channel-desc",children:e.description}),s&&(0,Ac.jsxs)("div",{className:"channel-strength",children:[(0,Ac.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})}),s]})]}),(0,Ac.jsxs)("div",{className:"channel-card-footer",children:[(0,Ac.jsxs)("span",{className:"channel-min-budget",children:["Min $",e.minMonthlyBudget||0,"/mo"]}),!o&&(0,Ac.jsxs)("span",{className:"channel-unsupported-label",children:["Not available for ",D]}),o&&!a&&(0,Ac.jsxs)("span",{className:"channel-unsupported-label",children:["Requires $",e.minMonthlyBudget,"/mo minimum"]})]})]},e.channelType)})}),F>0&&(0,Ac.jsxs)("div",{className:"channel-summary",children:[(0,Ac.jsx)("div",{className:"channel-summary-chips",children:E.selectedChannels.map(function(e){var t=h.find(function(t){return t.channelType===e});return(0,Ac.jsxs)("span",{className:"channel-chip",style:{borderColor:(null==t?void 0:t.color)||"#4F46E5"},children:[(null==t?void 0:t.displayName)||e,(0,Ac.jsx)("button",{onClick:function(){return L(e)},className:"chip-remove",children:"×"})]},e)})}),(0,Ac.jsxs)("div",{className:"channel-summary-info",children:[1===F?"Single-channel campaign":"Multi-channel campaign across ".concat(F," platforms"),F>1&&p&&(0,Ac.jsxs)("span",{className:"channel-summary-note",children:[" ","· Minimum total budget: $",p.minMultiChannelMonthlyBudget,"/mo"]})]})]}),0===F&&(0,Ac.jsxs)("div",{className:"channel-empty-hint",children:[(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:"Select at least one channel to continue"})]})]}),F>0&&M>0&&(0,Ac.jsxs)("div",{className:"forecast-section",children:[S&&(0,Ac.jsxs)("div",{className:"forecast-loading",children:[(0,Ac.jsx)("span",{className:"btn-spinner"}),(0,Ac.jsx)("span",{children:"Getting performance estimates from ad platforms…"})]}),w&&!S&&(0,Ac.jsxs)("div",{className:"forecast-card",children:[(0,Ac.jsxs)("div",{className:"forecast-card-header",children:[(0,Ac.jsxs)("div",{className:"forecast-title",children:[(0,Ac.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),(0,Ac.jsxs)("span",{children:["Estimated Performance at $",M.toLocaleString(),"/mo"]})]}),w.recommendation&&(0,Ac.jsxs)("span",{className:"forecast-objective-tag",children:["Optimized for ",(null==a?void 0:a.objective)||"traffic"]})]}),(0,Ac.jsx)("div",{className:"forecast-channels",children:_.map(function(e){var t,n,r,o=function(e){var t,n,r,o;if(null==w||!w.channels)return null;var a=w.channels.find(function(t){return t.provider===e});if(!a)return null;var i=a.allocationPercent||1,s=E.allocations[e]||i,c=s/i;return Qu(Qu({},a),{},{scaled:{impressions:Math.round(((null===(t=a.estimates)||void 0===t?void 0:t.impressions)||0)*c),reach:null!==(n=a.estimates)&&void 0!==n&&n.reach?Math.round(a.estimates.reach*c):null,clicks:Math.round(((null===(r=a.estimates)||void 0===r?void 0:r.clicks)||0)*c),conversions:Math.round(((null===(o=a.estimates)||void 0===o?void 0:o.conversions)||0)*c*10)/10},allocatedBudget:Math.round(M*s/100)})}(e),a=u(e),i=d(e),s=E.allocations[e]||0;return o&&"template"!==o.dataSource?(0,Ac.jsxs)("div",{className:"forecast-channel",children:[(0,Ac.jsxs)("div",{className:"forecast-ch-header",children:[(0,Ac.jsx)("span",{className:"forecast-ch-dot",style:{background:a}}),(0,Ac.jsxs)("span",{className:"forecast-ch-name",children:[i," (",s,"%)"]}),(0,Ac.jsxs)("span",{className:"forecast-ch-budget",children:["$",o.allocatedBudget.toLocaleString(),"/mo"]})]}),(0,Ac.jsxs)("div",{className:"forecast-ch-metrics",children:[o.scaled.reach&&(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(o.scaled.reach)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"reach"})]}),(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(o.scaled.impressions)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"impressions"})]}),(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(o.scaled.clicks)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"clicks"})]}),(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(o.scaled.conversions)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"est. conv."})]})]}),(0,Ac.jsxs)("div",{className:"forecast-ch-detail",children:[(0,Ac.jsxs)("span",{children:["$",th(null===(t=o.estimates)||void 0===t?void 0:t.avgCpc)," avg CPC"]}),(0,Ac.jsxs)("span",{children:["$",th(null===(n=o.estimates)||void 0===n?void 0:n.avgCpm)," avg CPM"]}),(null===(r=o.estimates)||void 0===r?void 0:r.estimatedCpa)&&(0,Ac.jsxs)("span",{children:["$",th(o.estimates.estimatedCpa)," est. CPA"]})]}),(0,Ac.jsxs)("div",{className:"forecast-ch-strength",children:[(0,Ac.jsx)("span",{className:"forecast-strength-dot",style:{background:a}}),o.strengthLabel]}),"medium"!==o.confidence&&"high"!==o.confidence&&(0,Ac.jsx)("div",{className:"forecast-ch-confidence",children:"emulated"===o.dataSource?"○ Estimated":"○ ".concat(o.confidence)})]},e):(0,Ac.jsxs)("div",{className:"forecast-channel forecast-channel-template",children:[(0,Ac.jsxs)("div",{className:"forecast-ch-header",children:[(0,Ac.jsx)("span",{className:"forecast-ch-dot",style:{background:a}}),(0,Ac.jsxs)("span",{className:"forecast-ch-name",children:[i," (",s,"%)"]}),(0,Ac.jsxs)("span",{className:"forecast-ch-budget",children:["$",Math.round(M*s/100).toLocaleString(),"/mo"]})]}),(0,Ac.jsxs)("div",{className:"forecast-ch-template-note",children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:"Estimates not yet available. Allocation based on category benchmarks."})]})]},e)})}),(null===(t=w.recommendation)||void 0===t||null===(t=t.highlights)||void 0===t?void 0:t.length)>0&&(0,Ac.jsx)("div",{className:"forecast-highlights",children:w.recommendation.highlights.map(function(e,t){return(0,Ac.jsx)("span",{className:"forecast-highlight",children:e},t)})})]}),I&&!S&&(0,Ac.jsxs)("div",{className:"forecast-error",children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("span",{children:I})]})]}),P&&F>0&&(0,Ac.jsxs)("div",{className:"allocation-section",children:[(0,Ac.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[(0,Ac.jsx)("label",{style:{margin:0,fontWeight:600},children:"Channel Allocation"}),(0,Ac.jsxs)("div",{style:{display:"flex",gap:8},children:[!w&&m.length>0&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:function(){return e=m,t={},_.forEach(function(n){var r=e.find(function(e){return(e.channelType||e.atlChannelType)===n});t[n]=r?parseFloat(r.allocationPct||r.atlAllocationPct||0):0}),void z({allocations:t,allocationStrategy:"template"});var e,t},children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"})}),"Apply Template"]}),"manual-adjusted"===E.allocationStrategy&&w&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline forecast-reset-btn",onClick:function(){if(null!=w&&w.channels){var e={};w.channels.forEach(function(t){_.includes(t.provider)&&(e[t.provider]=t.allocationPercent)}),z({allocations:e,allocationStrategy:"forecast"})}},children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),"Reset to recommended"]})]})]}),(0,Ac.jsx)("div",{className:"allocation-sliders",children:_.map(function(e){var t=E.allocations[e]||0,n=M*t/100,r=u(e);return(0,Ac.jsxs)("div",{className:"allocation-row",children:[(0,Ac.jsxs)("div",{className:"allocation-label",children:[(0,Ac.jsx)("span",{className:"alloc-dot",style:{background:r}}),(0,Ac.jsx)("span",{className:"alloc-name",children:d(e)})]}),(0,Ac.jsxs)("div",{className:"allocation-controls",children:[(0,Ac.jsx)("input",{type:"range",min:"0",max:"100",value:t,onChange:function(t){return K(e,t.target.value)},className:"alloc-slider",style:{"--slider-color":r}}),(0,Ac.jsxs)("div",{className:"alloc-values",children:[(0,Ac.jsx)("input",{type:"number",className:"alloc-pct-input",value:t,min:"0",max:"100",onChange:function(t){return K(e,t.target.value)}}),(0,Ac.jsx)("span",{className:"alloc-pct-sign",children:"%"}),(0,Ac.jsxs)("span",{className:"alloc-amount",children:["$",n.toFixed(0),"/","daily"===R?"day":"mo"]})]})]})]},e)})}),(0,Ac.jsx)("div",{className:"allocation-balance ".concat(H?"balanced":"unbalanced"),children:H?(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})})," Allocations total 100%"]}):(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})," Allocations total ",U,"% — must equal 100%"]})}),(0,Ac.jsx)("div",{className:"allocation-bar",children:_.map(function(e){var t=E.allocations[e]||0;return(0,Ac.jsx)("div",{className:"alloc-bar-segment",style:{width:"".concat(t,"%"),background:u(e)},title:"".concat(d(e),": ").concat(t,"%")},e)})})]}),!P&&1===F&&M>0&&w&&!S&&(0,Ac.jsx)("div",{className:"forecast-section",children:(0,Ac.jsxs)("div",{className:"forecast-card forecast-card-single",children:[(0,Ac.jsx)("div",{className:"forecast-card-header",children:(0,Ac.jsxs)("div",{className:"forecast-title",children:[(0,Ac.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),(0,Ac.jsx)("span",{children:"Estimated Performance"})]})}),(0,Ac.jsx)("div",{className:"forecast-channels",children:w.channels.filter(function(e){return"template"!==e.dataSource}).map(function(e){var t,n,r,o,a;return(0,Ac.jsxs)("div",{className:"forecast-channel",children:[(0,Ac.jsxs)("div",{className:"forecast-ch-metrics",children:[(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(null===(t=e.estimates)||void 0===t?void 0:t.impressions)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"impressions"})]}),(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(null===(n=e.estimates)||void 0===n?void 0:n.clicks)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"clicks"})]}),(0,Ac.jsxs)("div",{className:"forecast-metric",children:[(0,Ac.jsxs)("span",{className:"forecast-metric-value",children:["~",eh(null===(r=e.estimates)||void 0===r?void 0:r.conversions)]}),(0,Ac.jsx)("span",{className:"forecast-metric-label",children:"est. conv."})]})]}),(0,Ac.jsxs)("div",{className:"forecast-ch-detail",children:[(0,Ac.jsxs)("span",{children:["$",th(null===(o=e.estimates)||void 0===o?void 0:o.avgCpc)," avg CPC"]}),(0,Ac.jsxs)("span",{children:["$",th(null===(a=e.estimates)||void 0===a?void 0:a.avgCpm)," avg CPM"]})]})]},e.provider)})})]})})]})});const oh=rh;function ah(e){return ah="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},ah(e)}function ih(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return sh(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(sh(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,sh(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,sh(u,"constructor",l),sh(l,"constructor",c),c.displayName="GeneratorFunction",sh(l,o,"GeneratorFunction"),sh(u),sh(u,o,"Generator"),sh(u,r,function(){return this}),sh(u,"toString",function(){return"[object Generator]"}),(ih=function(){return{w:a,m:h}})()}function sh(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}sh=function(e,t,n,r){function a(t,n){sh(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},sh(e,t,n,r)}function ch(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function lh(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 dh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?lh(Object(n),!0).forEach(function(t){uh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):lh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uh(e,t,n){return(t=function(e){var t=function(e){if("object"!=ah(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=ah(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==ah(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function hh(e){return function(e){if(Array.isArray(e))return gh(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||fh(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ph(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||fh(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 fh(e,t){if(e){if("string"==typeof e)return gh(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?gh(e,t):void 0}}function gh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function mh(e){var t=e.items,n=e.maxLen,o=e.type,a=e.onUpdate,i=ph((0,r.useState)(null),2),s=i[0],c=i[1],l=ph((0,r.useState)(""),2),d=l[0],u=l[1],h=function(){if(null!==s){var e=hh(t);e[s]=dh(dh({},e[s]),{},{text:d,charCount:d.length}),a(e),c(null)}};return(0,Ac.jsxs)("div",{className:"asset-editor",children:[t.map(function(e,r){var i;return(0,Ac.jsx)("div",{className:"asset-row ".concat(s===r?"editing":""),children:s===r?(0,Ac.jsxs)("div",{className:"asset-edit-row",children:[(0,Ac.jsx)("input",{className:"form-input",value:d,maxLength:n,onChange:function(e){return u(e.target.value)},onKeyDown:function(e){return"Enter"===e.key&&h()},autoFocus:!0}),(0,Ac.jsxs)("span",{className:"char-counter ".concat(d.length>n?"over":""),children:[d.length,"/",n]}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-primary",onClick:h,children:"Save"}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:function(){return c(null)},children:"Cancel"})]}):(0,Ac.jsxs)(Ac.Fragment,{children:[(0,Ac.jsx)("span",{className:"asset-text",children:e.text||(0,Ac.jsxs)("em",{className:"text-muted",children:["Empty ",o]})}),(0,Ac.jsxs)("span",{className:"char-counter",children:[e.charCount||(null===(i=e.text)||void 0===i?void 0:i.length)||0,"/",n]}),(0,Ac.jsx)("button",{className:"asset-action",onClick:function(){return function(e){var n;c(e),u((null===(n=t[e])||void 0===n?void 0:n.text)||"")}(r)},title:"Edit",children:(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"}),(0,Ac.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"})]})}),(0,Ac.jsx)("button",{className:"asset-action danger",onClick:function(){return function(e){a(t.filter(function(t,n){return n!==e}))}(r)},title:"Remove",children:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]})},r)}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline add-asset-btn",onClick:function(){a([].concat(hh(t),[{text:"",charCount:0}])),c(t.length),u("")},children:[(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M12 5v14M5 12h14"})}),"Add ",o]})]})}const vh=(0,r.memo)(function(e){var t,n,o=e.data,a=e.onChange,i=e.businessData,s=Uc().sessionToken,c=ph((0,r.useState)(!1),2),l=c[0],d=c[1],u=ph((0,r.useState)(""),2),h=u[0],p=u[1],f=ph((0,r.useState)(null),2),g=f[0],m=f[1],v=dh({headlines:[],descriptions:[],images:[],analysis:(null==i?void 0:i.analysis)||null,source:null,imageSource:null},o),b=(0,r.useCallback)(function(e){a(dh(dh({},v),e))},[v,a]),y=v.headlines.length>0||v.images.length>0,x=null==i?void 0:i.url,w=function(){var e,t=(e=ih().m(function e(){var t,n,r,o,a,i,c,l,u,h,f,g,y;return ih().w(function(e){for(;;)switch(e.p=e.n){case 0:if(x||v.analysis){e.n=1;break}return e.a(2);case 1:if(d(!0),m(null),e.p=2,!x){e.n=4;break}return p("Analyzing website and generating creative…"),e.n=3,nd(x,s);case 3:(t=e.v).ok?(o=(null===(n=t.data)||void 0===n||null===(n=n.result)||void 0===n?void 0:n.data)||(null===(r=t.data)||void 0===r?void 0:r.data)||t.data,b({headlines:(null==o?void 0:o.headlines)||[],descriptions:(null==o?void 0:o.descriptions)||[],images:(null==o?void 0:o.images)||[],analysis:(null==o?void 0:o.analysis)||v.analysis,source:(null==o?void 0:o.source)||"generated",imageSource:(null==o?void 0:o.imageSource)||"generated"})):m(t.error||"Failed to generate creative"),e.n=7;break;case 4:if(!v.analysis){e.n=7;break}return p("Generating ad copy…"),e.n=5,ed(v.analysis,s);case 5:return(a=e.v).ok&&(l=(null===(i=a.data)||void 0===i||null===(i=i.result)||void 0===i?void 0:i.data)||(null===(c=a.data)||void 0===c?void 0:c.data)||a.data,b({headlines:(null==l?void 0:l.headlines)||[],descriptions:(null==l?void 0:l.descriptions)||[]})),p("Finding images…"),e.n=6,td(v.analysis,s);case 6:(u=e.v).ok&&(g=(null===(h=u.data)||void 0===h||null===(h=h.result)||void 0===h?void 0:h.data)||(null===(f=u.data)||void 0===f?void 0:f.data)||u.data,b({images:(null==g?void 0:g.images)||[]}));case 7:e.n=9;break;case 8:e.p=8,y=e.v,m(y.message||"Generation failed");case 9:p(""),d(!1);case 10:return e.a(2)}},e,null,[[2,8]])}),function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){ch(a,r,o,i,s,"next",e)}function s(e){ch(a,r,o,i,s,"throw",e)}i(void 0)})});return function(){return t.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("div",{className:"step-intro-header",children:[(0,Ac.jsx)("h2",{children:"Create your ad"}),(0,Ac.jsx)(Xd,{helpKey:"client.wizard.creative",label:"About this step"})]}),(0,Ac.jsx)("p",{children:"Generate headlines, descriptions, and images for your campaign — or write your own."})]}),x&&(0,Ac.jsx)("div",{className:"generate-bar ".concat(y?"has-assets":"empty"),children:(0,Ac.jsxs)("div",{className:"generate-bar-content",children:[(0,Ac.jsx)("div",{className:"generate-bar-icon",children:l?(0,Ac.jsx)("span",{className:"btn-spinner",style:{width:24,height:24}}):y?(0,Ac.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M1 4v6h6M23 20v-6h-6"}),(0,Ac.jsx)("path",{d:"M20.49 9A9 9 0 005.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 013.51 15"})]}):(0,Ac.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,Ac.jsxs)("div",{className:"generate-bar-text",children:[(0,Ac.jsx)("strong",{children:l?h||"Generating…":y?"Regenerate creative":"Generate from your website"}),!l&&!y&&(0,Ac.jsx)("span",{children:"AI will analyze your site and create ad copy + find matching images"}),!l&&y&&(0,Ac.jsx)("span",{children:"Create a fresh set of headlines, descriptions, and images"})]}),(0,Ac.jsx)("button",{className:"btn btn-primary",onClick:w,disabled:l,children:l?"Working…":y?"Regenerate":"Generate"})]})}),g&&(0,Ac.jsx)("div",{className:"error-box",children:g}),(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Headlines"}),(0,Ac.jsxs)("span",{className:"asset-count",children:[v.headlines.length," / 15 max"]})]}),(0,Ac.jsxs)("p",{className:"creative-section-hint",children:["Short, punchy text shown at the top of your ad. Max ",30," characters each."]}),(0,Ac.jsx)(mh,{items:v.headlines,maxLen:30,type:"headline",onUpdate:function(e){return b({headlines:e})}})]}),(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Descriptions"}),(0,Ac.jsxs)("span",{className:"asset-count",children:[v.descriptions.length," / 4 max"]})]}),(0,Ac.jsxs)("p",{className:"creative-section-hint",children:["Longer text that appears below the headline. Max ",90," characters each."]}),(0,Ac.jsx)(mh,{items:v.descriptions,maxLen:90,type:"description",onUpdate:function(e){return b({descriptions:e})}})]}),(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Images"}),(0,Ac.jsxs)("span",{className:"asset-count",children:[v.images.length," image",1!==v.images.length?"s":""]})]}),v.images.length>0?(0,Ac.jsx)("div",{className:"image-grid",children:v.images.map(function(e,t){return(0,Ac.jsxs)("div",{className:"image-thumb",children:[(0,Ac.jsx)("img",{src:e.url,alt:e.altText||"Image ".concat(t+1),loading:"lazy",onError:function(e){e.target.style.display="none"}}),(0,Ac.jsxs)("div",{className:"image-thumb-meta",children:[(0,Ac.jsx)("span",{className:"orientation-tag",children:e.orientation}),e.width&&(0,Ac.jsxs)("span",{className:"dim-tag",children:[e.width,"×",e.height]})]}),(0,Ac.jsx)("button",{className:"image-remove",onClick:function(){return b({images:v.images.filter(function(e,n){return n!==t})})},title:"Remove image",children:(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]},e.imageId||t)})}):(0,Ac.jsxs)("div",{className:"empty-images",children:[(0,Ac.jsxs)("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[(0,Ac.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),(0,Ac.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,Ac.jsx)("path",{d:"M21 15l-5-5L5 21"})]}),(0,Ac.jsx)("span",{children:x?'Click "Generate" above to find images for your ad':"No images added yet"})]})]}),v.headlines.length>0&&(0,Ac.jsxs)("div",{className:"creative-section",children:[(0,Ac.jsxs)("div",{className:"creative-section-header",children:[(0,Ac.jsx)("h3",{children:"Ad Preview"}),(0,Ac.jsx)("span",{className:"asset-count",style:{fontStyle:"italic"},children:"Approximate appearance"})]}),(0,Ac.jsxs)("div",{className:"ad-preview-card",children:[(0,Ac.jsxs)("div",{className:"ad-preview-label",children:["Ad · ",null!=i&&i.url?new URL(i.url).hostname:"yoursite.com"]}),(0,Ac.jsx)("div",{className:"ad-preview-headline",children:(null===(t=v.headlines[0])||void 0===t?void 0:t.text)||"Your Headline"}),(0,Ac.jsx)("div",{className:"ad-preview-desc",children:(null===(n=v.descriptions[0])||void 0===n?void 0:n.text)||"Your description will appear here."})]})]})]})});function bh(e){return bh="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},bh(e)}function yh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return xh(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(xh(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,xh(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,xh(u,"constructor",l),xh(l,"constructor",c),c.displayName="GeneratorFunction",xh(l,o,"GeneratorFunction"),xh(u),xh(u,o,"Generator"),xh(u,r,function(){return this}),xh(u,"toString",function(){return"[object Generator]"}),(yh=function(){return{w:a,m:h}})()}function xh(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}xh=function(e,t,n,r){function a(t,n){xh(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},xh(e,t,n,r)}function wh(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 kh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wh(Object(n),!0).forEach(function(t){Ch(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ch(e,t,n){return(t=function(e){var t=function(e){if("object"!=bh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=bh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==bh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Sh(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function jh(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Sh(a,r,o,i,s,"next",e)}function s(e){Sh(a,r,o,i,s,"throw",e)}i(void 0)})}}function Th(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Ih(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ih(e,t):void 0}}(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 Ih(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Ah={submitted:"✓",pending_review:"⏳",error:"✗",pending:"…"},Nh={submitted:"Submitted",pending_review:"Queued for Review",error:"Failed",pending:"Pending"},Eh={AGE_18_24:"1824",AGE_25_34:"2534",AGE_35_44:"3544",AGE_45_54:"4554",AGE_55_64:"5564",AGE_65_UP:"65+"},_h={MALE:"Male",FEMALE:"Female",UNDETERMINED:"All Genders"},Ph={local:"Local",regional:"Regional",national:"National"},Oh={young:"Younger",mature:"Mature"};function Rh(e){var t=e.title,n=e.icon,r=e.children,o=e.onEdit,a=e.issues,i=e.onFix,s=a&&a.length>0;return(0,Ac.jsxs)("div",{className:"review-section ".concat(s?"has-issues":""),children:[(0,Ac.jsxs)("div",{className:"review-section-header",children:[(0,Ac.jsxs)("div",{className:"review-section-title",children:[(0,Ac.jsx)("span",{className:"review-icon",children:n}),(0,Ac.jsx)("h3",{children:t})]}),(0,Ac.jsxs)("div",{className:"review-section-actions",children:[s&&(0,Ac.jsxs)("button",{className:"btn btn-sm btn-fix",onClick:i||o,children:[(0,Ac.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:(0,Ac.jsx)("path",{d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Fix"]}),o&&(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:o,children:"Edit"})]})]}),s&&(0,Ac.jsx)("div",{className:"review-section-issues",children:a.map(function(e,t){return(0,Ac.jsx)("span",{className:"review-issue-tag",children:e},t)})}),(0,Ac.jsx)("div",{className:"review-section-body",children:r})]})}function Mh(e){var t=e.label,n=e.value,r=e.mono;return(0,Ac.jsxs)("div",{className:"review-row",children:[(0,Ac.jsx)("span",{className:"review-label",children:t}),(0,Ac.jsx)("span",{className:"review-value ".concat(r?"mono":""),children:n||"—"})]})}var zh=(0,r.memo)(function(e){var t,n,o,a,i,s,c,l,d,u,h,p=e.stepData,f=e.onGoToStep,g=Uc().sessionToken,m=Ld(),v=m.toDisplayLabel,b=m.getChannelLabel,y=m.getChannelColor,x=Th((0,r.useState)("review"),2),w=x[0],k=x[1],C=Th((0,r.useState)(null),2),S=C[0],j=C[1],T=Th((0,r.useState)(null),2),I=T[0],A=T[1],N=Th((0,r.useState)(null),2),E=N[0],_=N[1],P=Th((0,r.useState)(null),2),O=P[0],R=P[1],M=Th((0,r.useState)(!1),2),z=M[0],L=M[1],D=Th((0,r.useState)(!1),2),F=D[0],q=D[1],B=(null==p?void 0:p[1])||{},U=(null==p?void 0:p[2])||{},H=(null==p?void 0:p[3])||{},K=(null==p?void 0:p[4])||{},$=(null==p?void 0:p[5])||{},G=K.selectedChannels||[],W=G.length>1,V=parseFloat(H.totalBudget)||0,Q=K.allocations||{},Y=v(B.objective),J=v(B.businessCategory),X=function(e){var t=parseFloat(e);return isNaN(t)?"—":"$".concat(t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}))},Z=[];if(B.campaignName||Z.push({step:1,msg:"Campaign name is required"}),B.objective||Z.push({step:1,msg:"Objective is required"}),0===G.length&&Z.push({step:4,msg:"Select at least one channel"}),(!V||V<=0)&&Z.push({step:3,msg:"Budget must be set"}),W){var ee=Object.values(Q).reduce(function(e,t){return e+(t||0)},0);Math.abs(ee-100)>.01&&Z.push({step:4,msg:"Channel allocations must total 100%"})}var te=function(){var e=jh(yh().m(function e(){var t,n,r,o,a,i,s;return yh().w(function(e){for(;;)switch(e.n){case 0:if(!(Z.length>0)){e.n=1;break}return e.a(2);case 1:return j(null),k("staging"),r=G.map(function(e){return{channelType:e,allocationPct:W?Q[e]||0:100}}),o=kh({name:B.campaignName,objective:B.objective,totalBudget:V,budgetPeriod:H.budgetPeriod||"monthly",startDate:H.startDate,endDate:H.hasEndDate?H.endDate:null,allocationStrategy:K.allocationStrategy||"manual",businessCategory:B.businessCategory,channels:r,ageSkew:U.ageSkew||null,marketScope:U.marketScope||null,locations:U.locations||[],demographics:U.demographics||{}},I?{initiativeId:I}:{}),e.n=2,El(o,g);case 2:if((a=e.v).ok){e.n=3;break}return k("error"),j(a.error||(null===(i=a.data)||void 0===i?void 0:i.error)||"Failed to stage initiative"),e.a(2);case 3:if(s=null===(t=a.data)||void 0===t?void 0:t.initiativeId){e.n=4;break}return k("error"),j("Initiative staged but no ID returned"),e.a(2);case 4:A(s),_((null===(n=a.data)||void 0===n?void 0:n.billing)||null),q(!1),L(!0),k("confirm");case 5:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}(),ne=function(){var e=jh(yh().m(function e(){var t,n,r,o;return yh().w(function(e){for(;;)switch(e.n){case 0:return L(!1),j(null),k("launching"),e.n=1,Pl(I,g);case 1:(n=e.v).ok||null!==(t=n.data)&&void 0!==t&&t.channels?(R(n.data),k("done")):(R(n.data),k("done"),null!==(r=n.data)&&void 0!==r&&null!==(r=r.channels)&&void 0!==r&&r.length||j(n.error||(null===(o=n.data)||void 0===o?void 0:o.error)||"Launch failed — campaigns saved but not dispatched"));case 2:return e.a(2)}},e)}));return function(){return e.apply(this,arguments)}}();if("done"===w){var re=(null==O?void 0:O.channels)||[],oe=re.filter(function(e){return"submitted"===e.status||"pending_review"===e.status}).length,ae=re.filter(function(e){return"error"===e.status}).length;return(0,Ac.jsx)("div",{className:"wizard-step-content",children:(0,Ac.jsxs)("div",{className:"submit-success",children:[(0,Ac.jsx)("div",{className:"success-icon",children:0===ae?(0,Ac.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#10B981",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M22 11.08V12a10 10 0 11-5.93-9.14"}),(0,Ac.jsx)("path",{d:"M22 4L12 14.01l-3-3"})]}):oe>0?(0,Ac.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#F59E0B",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),(0,Ac.jsx)("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}):(0,Ac.jsxs)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"#EF4444",strokeWidth:"2",children:[(0,Ac.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,Ac.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,Ac.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]})}),(0,Ac.jsx)("h2",{children:0===ae?"Campaign ".concat(W?"Initiative ":"","Launched!"):oe>0?"Partially Launched":"Launch Failed"}),(0,Ac.jsx)("p",{children:0===ae?'Your campaign "'.concat(B.campaignName,'" has been submitted').concat(W?" across ".concat(G.length," channels"):"","."):oe>0?"".concat(oe," of ").concat(re.length," channels submitted successfully."):"All channel dispatches failed. Your campaign has been saved — you can retry from the Campaigns view."}),re.length>0&&(0,Ac.jsx)("div",{className:"launch-results",children:re.map(function(e,t){return(0,Ac.jsxs)("div",{className:"launch-result-row ".concat(e.status),children:[(0,Ac.jsx)("span",{className:"launch-ch-dot",style:{background:y(e.channelType)}}),(0,Ac.jsx)("span",{className:"launch-ch-name",children:b(e.channelType)}),(0,Ac.jsxs)("span",{className:"launch-status ".concat(e.status),children:[Ah[e.status]||"?"," ",Nh[e.status]||e.status]}),e.error&&(0,Ac.jsx)("span",{className:"launch-error",children:e.error})]},t)})})]})})}if("staging"===w)return(0,Ac.jsx)("div",{className:"wizard-step-content",children:(0,Ac.jsxs)("div",{className:"phase-loading",children:[(0,Ac.jsx)("div",{className:"loading-spinner"}),(0,Ac.jsx)("h3",{children:"Preparing your campaign…"}),(0,Ac.jsx)("p",{children:"Calculating fees and validating configuration"})]})});if("launching"===w)return(0,Ac.jsx)("div",{className:"wizard-step-content",children:(0,Ac.jsxs)("div",{className:"phase-loading",children:[(0,Ac.jsx)("div",{className:"loading-spinner"}),(0,Ac.jsx)("h3",{children:"Launching campaign…"}),(0,Ac.jsxs)("p",{children:["Submitting to ",W?"".concat(G.length," ad networks"):"ad network"]})]})});var ie=(null===(t=U.locations)||void 0===t?void 0:t.length)>0?U.locations.map(function(e){return e.name}).join(", "):"All regions (national)",se=(null===(n=U.demographics)||void 0===n||null===(n=n.ageRanges)||void 0===n?void 0:n.length)>0?U.demographics.ageRanges.map(function(e){return Eh[e]||e}).join(", "):"All ages",ce=(null===(o=U.demographics)||void 0===o||null===(o=o.genders)||void 0===o?void 0:o.length)>0?U.demographics.genders.map(function(e){return _h[e]||e}).join(", "):"All genders",le={};return Z.forEach(function(e){le[e.step]||(le[e.step]=[]),le[e.step].push(e.msg)}),(0,Ac.jsxs)("div",{className:"wizard-step-content",children:[(0,Ac.jsxs)("div",{className:"step-intro",children:[(0,Ac.jsxs)("div",{className:"step-intro-header",children:[(0,Ac.jsx)("h2",{children:"Review your campaign"}),(0,Ac.jsx)(Xd,{helpKey:"client.wizard.review",label:"About this step"})]}),(0,Ac.jsx)("p",{children:"Double-check everything below before launching."})]}),S&&(0,Ac.jsx)("div",{className:"error-box",children:S}),(0,Ac.jsxs)("div",{className:"review-grid",children:[(0,Ac.jsxs)("div",{className:"review-grid-col",children:[(0,Ac.jsxs)(Rh,{title:"Campaign",icon:"🎯",onEdit:function(){return f(1)},issues:le[1],onFix:function(){return f(1)},children:[(0,Ac.jsx)(Mh,{label:"Name",value:B.campaignName}),(0,Ac.jsx)(Mh,{label:"Objective",value:Y}),(0,Ac.jsx)(Mh,{label:"Category",value:J})]}),(0,Ac.jsxs)(Rh,{title:"Audience",icon:"👥",onEdit:function(){return f(2)},children:[(0,Ac.jsx)(Mh,{label:"Locations",value:ie}),(0,Ac.jsx)(Mh,{label:"Age",value:se}),(0,Ac.jsx)(Mh,{label:"Gender",value:ce}),(0,Ac.jsxs)("div",{className:"review-factors",style:{marginTop:8},children:[(0,Ac.jsx)("span",{className:"review-factor-chip",children:Ph[U.marketScope]||"National"}),(0,Ac.jsx)("span",{className:"review-factor-chip",children:U.ageSkew?Oh[U.ageSkew]:"Balanced"})]})]})]}),(0,Ac.jsxs)("div",{className:"review-grid-col",children:[(0,Ac.jsxs)(Rh,{title:"Budget",icon:"💰",onEdit:function(){return f(3)},issues:le[3],onFix:function(){return f(3)},children:[(0,Ac.jsx)(Mh,{label:"daily"===H.budgetPeriod?"Daily":"Monthly",value:X(V)}),(0,Ac.jsx)(Mh,{label:"Start",value:H.startDate}),H.hasEndDate&&(0,Ac.jsx)(Mh,{label:"End",value:H.endDate})]}),(0,Ac.jsx)(Rh,{title:"Channels",icon:"📡",onEdit:function(){return f(4)},issues:le[4],onFix:function(){return f(4)},children:(0,Ac.jsx)("div",{className:"review-channels",children:G.length>0?G.map(function(e){return(0,Ac.jsxs)("span",{className:"review-channel-chip",style:{borderColor:y(e)},children:[(0,Ac.jsx)("span",{className:"review-ch-dot",style:{background:y(e)}}),b(e),W&&(0,Ac.jsxs)("span",{style:{marginLeft:"auto",fontSize:12,color:"var(--color-text-muted)"},children:[Q[e]||0,"%"]})]},e)}):(0,Ac.jsx)("div",{className:"review-empty-note",children:"No channels selected"})})}),(0,Ac.jsx)(Rh,{title:"Creative",icon:"🖼️",onEdit:function(){return f(5)},children:(null===(a=$.headlines)||void 0===a?void 0:a.length)>0||(null===(i=$.descriptions)||void 0===i?void 0:i.length)>0?(0,Ac.jsxs)("div",{className:"review-creative-summary",children:[(0,Ac.jsxs)("span",{children:[(null===(s=$.headlines)||void 0===s?void 0:s.length)||0," headline",1!==((null===(c=$.headlines)||void 0===c?void 0:c.length)||0)?"s":""]}),(0,Ac.jsx)("span",{className:"review-dot-sep",children:"·"}),(0,Ac.jsxs)("span",{children:[(null===(l=$.descriptions)||void 0===l?void 0:l.length)||0," description",1!==((null===(d=$.descriptions)||void 0===d?void 0:d.length)||0)?"s":""]}),(0,Ac.jsx)("span",{className:"review-dot-sep",children:"·"}),(0,Ac.jsxs)("span",{children:[(null===(u=$.images)||void 0===u?void 0:u.length)||0," image",1!==((null===(h=$.images)||void 0===h?void 0:h.length)||0)?"s":""]})]}):(0,Ac.jsx)("div",{className:"review-empty-note",children:"No creative assets added yet"})})]})]}),(0,Ac.jsxs)("div",{className:"submit-bar",children:[(0,Ac.jsxs)("div",{className:"submit-bar-info",children:[(0,Ac.jsx)("strong",{children:Z.length>0?"Almost there":"Ready to launch?"}),(0,Ac.jsx)("span",{children:Z.length>0?"Fix ".concat(Z.length," issue").concat(Z.length>1?"s":""," above to enable launch."):"Your campaign will be submitted to ".concat(W?G.map(function(e){return b(e)}).join(" and "):b(G[0])," for review.")})]}),(0,Ac.jsxs)("button",{className:"btn btn-primary btn-lg",onClick:te,disabled:Z.length>0,children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"})})," ","Launch Campaign"]})]}),z&&E&&(0,Ac.jsx)(Dh,{campaignName:B.campaignName,objectiveLabel:Y,billing:E,selectedChannels:G,isMultiChannel:W,termsAccepted:F,onToggleTerms:function(){return q(!F)},onConfirm:ne,onCancel:function(){L(!1),k("review")},formatBudget:X,getChannelLabel:b,getChannelColor:y})]})});const Lh=zh;function Dh(e){var t=e.campaignName,n=e.objectiveLabel,r=e.billing,o=(e.selectedChannels,e.isMultiChannel),a=e.termsAccepted,i=e.onToggleTerms,s=e.onConfirm,c=e.onCancel,l=e.formatBudget,d=e.getChannelLabel,u=e.getChannelColor,h="daily"===r.budgetPeriod?"day":"month",p=(100*(r.marginRate||0)).toFixed(0),f=r.channels||[];return(0,Ac.jsx)("div",{className:"confirm-overlay",onClick:c,children:(0,Ac.jsxs)("div",{className:"confirm-modal",onClick:function(e){return e.stopPropagation()},children:[(0,Ac.jsxs)("div",{className:"confirm-header",children:[(0,Ac.jsx)("div",{className:"confirm-icon-wrap",children:(0,Ac.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"#d97706",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"}),(0,Ac.jsx)("line",{x1:"12",y1:"9",x2:"12",y2:"13"}),(0,Ac.jsx)("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})}),(0,Ac.jsx)("h2",{children:"Confirm Campaign Launch"})]}),(0,Ac.jsxs)("p",{className:"confirm-subtitle",children:["You are about to launch ",(0,Ac.jsx)("strong",{children:t}),". By proceeding, you authorize AdPlatform to charge your payment method on file for the advertising spend and management fees described below."]}),(0,Ac.jsxs)("div",{className:"confirm-billing",children:[(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsx)("span",{children:"Campaign objective"}),(0,Ac.jsx)("span",{children:n})]}),(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsx)("span",{children:"Ad spend"}),(0,Ac.jsxs)("span",{children:[l(r.adSpend)," / ",h]})]}),o&&f.map(function(e,t){return(0,Ac.jsxs)("div",{className:"confirm-billing-row confirm-billing-sub",children:[(0,Ac.jsxs)("span",{children:[(0,Ac.jsx)("span",{className:"confirm-ch-dot",style:{background:u(e.channelType)}}),d(e.channelType)," (",e.allocationPct,"%)"]}),(0,Ac.jsxs)("span",{children:[l(e.adSpend)," / ",h]})]},t)}),(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsxs)("span",{children:["Management fee (",p,"%)"]}),(0,Ac.jsxs)("span",{children:[l(r.managementFee)," / ",h]})]}),o&&f.map(function(e,t){return(0,Ac.jsxs)("div",{className:"confirm-billing-row confirm-billing-sub",children:[(0,Ac.jsxs)("span",{children:[(0,Ac.jsx)("span",{className:"confirm-ch-dot",style:{background:u(e.channelType)}}),d(e.channelType)]}),(0,Ac.jsxs)("span",{children:[l(e.managementFee)," / ",h]})]},"fee-".concat(t))}),r.platformFee>0&&(0,Ac.jsxs)("div",{className:"confirm-billing-row",children:[(0,Ac.jsx)("span",{children:"Platform fee"}),(0,Ac.jsxs)("span",{children:[l(r.platformFee)," / ",h]})]}),(0,Ac.jsxs)("div",{className:"confirm-billing-row confirm-billing-total",children:[(0,Ac.jsx)("span",{children:"Total recurring charge"}),(0,Ac.jsxs)("span",{className:"confirm-amount",children:[l(r.totalCharge)," / ",h]})]})]}),(0,Ac.jsxs)("div",{className:"confirm-note",children:["Ad spend will be billed to your payment method on file. Actual ad network charges may vary based on delivery and auction dynamics. Management fees are calculated at ",p,"% of ad spend",r.minManagementFee>0&&" (".concat(l(r.minManagementFee),"/mo minimum)"),". You can pause or cancel campaigns at any time from the Campaigns dashboard.","client"===r.pricingSource&&(0,Ac.jsxs)("span",{className:"confirm-pricing-source",title:"This client has a negotiated rate",children:[" ","— Custom rate applied"]})]}),(0,Ac.jsxs)("label",{className:"confirm-terms",children:[(0,Ac.jsx)("input",{type:"checkbox",checked:a,onChange:i}),(0,Ac.jsxs)("span",{children:["I authorize AdPlatform to charge up to ",(0,Ac.jsxs)("strong",{children:[l(r.totalCharge)," / ",h]})," to my payment method on file. I understand that ad networks may take up to 48 hours to review and approve my campaigns, and that actual delivery and charges may vary."]})]}),(0,Ac.jsxs)("div",{className:"confirm-actions",children:[(0,Ac.jsx)("button",{className:"btn btn-outline",onClick:c,children:"Cancel"}),(0,Ac.jsxs)("button",{className:"btn btn-primary btn-lg",onClick:s,disabled:!a,children:[(0,Ac.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("rect",{x:"1",y:"4",width:"22",height:"16",rx:"2",ry:"2"}),(0,Ac.jsx)("line",{x1:"1",y1:"10",x2:"23",y2:"10"})]})," ","Confirm & Launch"]})]})]})})}function Fh(e){return Fh="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},Fh(e)}function qh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Bh(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Bh(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Bh(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Bh(u,"constructor",l),Bh(l,"constructor",c),c.displayName="GeneratorFunction",Bh(l,o,"GeneratorFunction"),Bh(u),Bh(u,o,"Generator"),Bh(u,r,function(){return this}),Bh(u,"toString",function(){return"[object Generator]"}),(qh=function(){return{w:a,m:h}})()}function Bh(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Bh=function(e,t,n,r){function a(t,n){Bh(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Bh(e,t,n,r)}function Uh(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 Hh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uh(Object(n),!0).forEach(function(t){Kh(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kh(e,t,n){return(t=function(e){var t=function(e){if("object"!=Fh(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=Fh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Fh(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $h(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Gh(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){$h(a,r,o,i,s,"next",e)}function s(e){$h(a,r,o,i,s,"throw",e)}i(void 0)})}}function Wh(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||Vh(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 Vh(e,t){if(e){if("string"==typeof e)return Qh(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qh(e,t):void 0}}function Qh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Yh=[{num:1,key:"objective",label:"Objective",icon:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},{num:2,key:"audience",label:"Audience",icon:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"},{num:3,key:"budget",label:"Budget",icon:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},{num:4,key:"channels",label:"Channels",icon:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.14 0M1.394 9.393c5.857-5.858 15.355-5.858 21.213 0"},{num:5,key:"creative",label:"Creative",icon:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"},{num:6,key:"review",label:"Review",icon:"M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z"}];function Jh(e){var t,n,o=e.onClose,a=e.wizardId,i=Uc().sessionToken,s=Wh((0,r.useState)(1),2),c=s[0],l=s[1],d=Wh((0,r.useState)(a||null),2),u=d[0],h=d[1],p=Wh((0,r.useState)(new Set([1])),2),f=p[0],g=p[1],m=Wh((0,r.useState)({1:{},2:{},3:{},4:{},5:{}}),2),v=m[0],b=m[1],y=(0,r.useRef)(null),x=(0,r.useRef)(u);x.current=u,(0,r.useEffect)(function(){a&&i&&Gh(qh().m(function e(){var t,n,r,o,s;return qh().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,Ql(a,i);case 1:(t=e.v).ok&&t.data&&(n=t.data.data||t.data,r={1:{},2:{},3:{},4:{},5:{}},(n.wizStepData||n.stepData)&&(o="string"==typeof(n.wizStepData||n.stepData)?JSON.parse(n.wizStepData||n.stepData):n.wizStepData||n.stepData,Object.assign(r,o)),(n.wizName||n.name)&&(r[1]=Hh(Hh({},r[1]),{},{campaignName:n.wizName||n.name})),(n.wizUrl||n.url)&&(r[1]=Hh(Hh({},r[1]),{},{url:n.wizUrl||n.url})),b(r),s=parseInt(n.wizCurrentStep||n.currentStep)||1,l(Math.min(Math.max(s,1),Yh.length)));case 2:return e.a(2)}},e)}))()},[a,i]);var w=(0,r.useCallback)(function(){var e=Gh(qh().m(function e(t,n,r){var o,a,s,c,l,d,u,p,f,g,m;return qh().w(function(e){for(;;)switch(e.p=e.n){case 0:if(i){e.n=1;break}return e.a(2);case 1:if(e.p=1,o=x.current){e.n=3;break}return c=(null===(a=r[1])||void 0===a?void 0:a.campaignName)||"Untitled Campaign",l=(null===(s=r[1])||void 0===s?void 0:s.url)||"",e.n=2,Vl(c,l,i);case 2:(d=e.v).ok&&(o=(null===(u=d.data)||void 0===u||null===(u=u.data)||void 0===u?void 0:u.wizardId)||(null===(p=d.data)||void 0===p?void 0:p.wizardId)||(null===(f=d.data)||void 0===f?void 0:f.id))&&(h(o),x.current=o);case 3:if(!o){e.n=4;break}return e.n=4,Xl(o,t,r,i,null===(g=r[1])||void 0===g?void 0:g.campaignName);case 4:e.n=6;break;case 5:e.p=5,m=e.v,console.warn("Auto-save failed:",m);case 6:return e.a(2)}},e,null,[[1,5]])}));return function(t,n,r){return e.apply(this,arguments)}}(),[i]),k=(0,r.useCallback)(function(e,t){b(function(n){var r=Hh(Hh({},n),{},Kh({},e,t));return y.current&&clearTimeout(y.current),y.current=setTimeout(function(){return w(e,t,r)},1500),r})},[w]),C=function(e){var t;g(function(t){return new Set([].concat(function(e){if(Array.isArray(e))return Qh(e)}(n=t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||Vh(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),[e]));var n}),l(e),x.current&&i&&e<=5&&Xl(x.current,e,v,i,null===(t=v[1])||void 0===t?void 0:t.campaignName).catch(function(){})},S=(null===(t=v[1])||void 0===t?void 0:t.campaignName)||"New Campaign",j=(null===(n=v[4])||void 0===n||null===(n=n.selectedChannels)||void 0===n?void 0:n.length)||0;return(0,Ac.jsx)(Kd,{children:(0,Ac.jsxs)("div",{className:"wizard-wrapper",children:[(0,Ac.jsxs)("div",{className:"wizard-header",children:[(0,Ac.jsxs)("div",{className:"wizard-header-left",children:[(0,Ac.jsx)("button",{className:"wizard-back-btn",onClick:o,title:"Exit wizard",children:(0,Ac.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})}),(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h2",{className:"wizard-title",children:S}),(0,Ac.jsx)("span",{className:"wizard-subtitle",children:j>1?"Multi-channel Campaign · ".concat(j," channels"):"Campaign Wizard"})]})]}),(0,Ac.jsx)("div",{className:"wizard-header-right",children:(0,Ac.jsx)("span",{className:"status-badge status-active",children:"draft"})})]}),(0,Ac.jsxs)("div",{className:"wizard-rail",children:[Yh.map(function(e){var t=c===e.num,n=e.num<Yh.length&&function(e){var t,n,r=v[e];switch(e){case 1:return!(null==r||!r.campaignName||null==r||!r.objective);case 2:return f.has(2)&&f.has(3);case 3:return!!(null!=r&&r.totalBudget&&parseFloat(r.totalBudget)>0);case 4:var o;if(!(((null==r||null===(o=r.selectedChannels)||void 0===o?void 0:o.length)||0)>0))return!1;if(r.selectedChannels.length>1){var a=Object.values((null==r?void 0:r.allocations)||{}).reduce(function(e,t){return e+(t||0)},0);return Math.abs(a-100)<.01}return!0;case 5:return!!((null==r||null===(t=r.headlines)||void 0===t?void 0:t.length)>0||(null==r||null===(n=r.descriptions)||void 0===n?void 0:n.length)>0);default:return!1}}(e.num),r=e.num<c;return(0,Ac.jsxs)("button",{className:"wizard-rail-step ".concat(t?"active":""," ").concat(n?"complete":""," ").concat(r?"past":""),onClick:function(){return C(e.num)},children:[(0,Ac.jsx)("div",{className:"rail-step-indicator",children:n?(0,Ac.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:(0,Ac.jsx)("path",{d:"M20 6L9 17l-5-5"})}):(0,Ac.jsx)("span",{children:e.num})}),(0,Ac.jsx)("span",{className:"rail-step-label",children:e.label})]},e.num)}),(0,Ac.jsx)("div",{className:"wizard-rail-progress",style:{width:"".concat((c-1)/(Yh.length-1)*100,"%")}})]}),(0,Ac.jsxs)("div",{className:"wizard-body",children:[1===c&&(0,Ac.jsx)(lu,{data:v[1],onChange:function(e){return k(1,e)}}),2===c&&(0,Ac.jsx)(Nu,{data:v[2],onChange:function(e){return k(2,e)}}),3===c&&(0,Ac.jsx)(Mu,{data:v[3],onChange:function(e){return k(3,e)}}),4===c&&(0,Ac.jsx)(oh,{data:v[4],onChange:function(e){return k(4,e)},objectiveData:v[1],audienceData:v[2],budgetData:v[3]}),5===c&&(0,Ac.jsx)(vh,{data:v[5],onChange:function(e){return k(5,e)},businessData:v[1]}),6===c&&(0,Ac.jsx)(Lh,{stepData:v,onGoToStep:C})]}),c<Yh.length&&(0,Ac.jsxs)("div",{className:"wizard-footer",children:[(0,Ac.jsxs)("button",{className:"btn btn-outline",onClick:function(){return C(Math.max(c-1,1))},disabled:1===c,children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),"Back"]}),(0,Ac.jsxs)("div",{className:"wizard-footer-center",children:["Step ",c," of ",Yh.length]}),(0,Ac.jsxs)("button",{className:"btn btn-primary",onClick:function(){return C(Math.min(c+1,Yh.length))},disabled:4===c&&0===j,children:[5===c?"Review Campaign":"Continue",(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,Ac.jsx)("path",{d:"M5 12h14M12 5l7 7-7 7"})})]})]})]})})}function Xh(){var e=nl(),t=e.setActiveTab,n=e.wizardId;return(0,Ac.jsx)(Jh,{wizardId:n||null,onClose:function(){return t("myCampaigns")}})}function Zh(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return ep(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(ep(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,ep(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,ep(u,"constructor",l),ep(l,"constructor",c),c.displayName="GeneratorFunction",ep(l,o,"GeneratorFunction"),ep(u),ep(u,o,"Generator"),ep(u,r,function(){return this}),ep(u,"toString",function(){return"[object Generator]"}),(Zh=function(){return{w:a,m:h}})()}function ep(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ep=function(e,t,n,r){function a(t,n){ep(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},ep(e,t,n,r)}function tp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function np(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function rp(e){var t={"Content-Type":"application/json"};e&&(t.Authorization="Bearer ".concat(e));var n=localStorage.getItem("adplatform_tenantId");return n&&(t["X-Tenant-Id"]=n),t}function op(e,t,n,r){return ap.apply(this,arguments)}function ap(){var e;return e=Zh().m(function e(t,n,r,o){var a,i,s,c;return Zh().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,a={method:t,headers:rp(o)},r&&"GET"!==t&&(a.body=JSON.stringify(r)),e.n=1,fetch("".concat(Sc).concat(n),a);case 1:return i=e.v,e.n=2,i.json().catch(function(){return null});case 2:return s=e.v,e.a(2,{ok:i.ok&&!1!==(null==s?void 0:s.ok),status:i.status,data:s,error:i.ok?null:(null==s?void 0:s.error)||(null==s?void 0:s.message)||"HTTP ".concat(i.status)});case 3:return e.p=3,c=e.v,e.a(2,{ok:!1,status:0,data:null,error:c.message})}},e,null,[[0,3]])}),ap=function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){np(a,r,o,i,s,"next",e)}function s(e){np(a,r,o,i,s,"throw",e)}i(void 0)})},ap.apply(this,arguments)}function ip(e){var t=new URLSearchParams;Object.entries(e).forEach(function(e){var n,r,o=(r=2,function(e){if(Array.isArray(e))return e}(n=e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(n,r)||function(e,t){if(e){if("string"==typeof e)return tp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tp(e,t):void 0}}(n,r)||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.")}()),a=o[0],i=o[1];null!=i&&t.set(a,String(i))});var n=t.toString();return n?"?"+n:""}function sp(e){return op("GET","/api/intelligence/health",null,e)}function cp(e,t){return op("GET","/api/intelligence/".concat(e,"/pacing"),null,t)}function lp(e,t){return op("GET","/api/intelligence/".concat(e,"/report"),null,t)}function dp(e,t,n){return op("GET","/api/recommendations".concat(ip({status:t,limit:n})),null,e)}function up(e,t){return op("POST","/api/recommendations/".concat(e,"/dismiss"),{},t)}function hp(e,t){return op("POST","/api/recommendations/".concat(e,"/resolve"),{},t)}function pp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return fp(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(fp(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,fp(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,fp(u,"constructor",l),fp(l,"constructor",c),c.displayName="GeneratorFunction",fp(l,o,"GeneratorFunction"),fp(u),fp(u,o,"Generator"),fp(u,r,function(){return this}),fp(u,"toString",function(){return"[object Generator]"}),(pp=function(){return{w:a,m:h}})()}function fp(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}fp=function(e,t,n,r){function a(t,n){fp(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},fp(e,t,n,r)}function gp(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function mp(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){gp(a,r,o,i,s,"next",e)}function s(e){gp(a,r,o,i,s,"throw",e)}i(void 0)})}}function vp(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return bp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bp(e,t):void 0}}(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 bp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var yp=function(e){return null!=e?Number(e).toLocaleString():"—"},xp=function(e){return null!=e?"$"+Number(e).toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2}):"$0.00"},wp=function(e){return null!=e?Number(e).toFixed(1)+"%":"—"},kp=function(e){return e?new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):"—"},Cp=function(e){if(!e)return"";var t=Math.floor((Date.now()-new Date(e).getTime())/1e3);return t<60?"just now":t<3600?"".concat(Math.floor(t/60),"m ago"):t<86400?"".concat(Math.floor(t/3600),"h ago"):"".concat(Math.floor(t/86400),"d ago")},Sp=function(e){return{google_ads:"Google Ads",google:"Google Ads",meta:"Meta",tiktok:"TikTok"}[(e||"").toLowerCase()]||e},jp={critical:{label:"Critical",css:"sev-critical",icon:"⚠"},warning:{label:"Warning",css:"sev-warning",icon:"⚡"},info:{label:"Info",css:"sev-info",icon:""}},Tp={green:{label:"Healthy",css:"health-green",dot:"🟢"},yellow:{label:"Needs Attention",css:"health-yellow",dot:"🟡"},red:{label:"Action Required",css:"health-red",dot:"🔴"}},Ip=[{id:"health",label:"Health Overview",icon:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},{id:"recommendations",label:"Recommendations",icon:"M13 10V3L4 14h7v7l9-11h-7z"},{id:"pacing",label:"Budget Pacing",icon:"M12 8c-1.657 0-3 .895-3 2s1.343 2 3 2 3 .895 3 2-1.343 2-3 2m0-8c1.11 0 2.08.402 2.599 1M12 8V7m0 1v8m0 0v1m0-1c-1.11 0-2.08-.402-2.599-1M21 12a9 9 0 11-18 0 9 9 0 0118 0z"}];function Ap(e){e.onNavigate;var t=Uc().sessionToken,n=vp((0,r.useState)("health"),2),o=n[0],a=n[1],i=vp((0,r.useState)(null),2),s=i[0],c=i[1],l=vp((0,r.useState)(null),2),d=l[0],u=l[1],h=vp((0,r.useState)({critical:0,warning:0,info:0}),2),p=h[0],f=h[1],g=vp((0,r.useState)(!0),2),m=g[0],v=g[1],b=vp((0,r.useState)(null),2),y=b[0],x=b[1],w=vp((0,r.useState)(null),2),k=w[0],C=w[1],S=vp((0,r.useState)(null),2),j=S[0],T=S[1],I=vp((0,r.useState)(!1),2),A=I[0],N=I[1],E=(0,r.useCallback)(mp(pp().m(function e(){var n;return pp().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:return v(!0),e.n=2,sp(t);case 2:(n=e.v).ok&&n.data&&c(n.data.initiatives||[]),v(!1);case 3:return e.a(2)}},e)})),[t]),_=(0,r.useCallback)(mp(pp().m(function e(){var n;return pp().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:return e.n=2,dp(t);case 2:(n=e.v).ok&&n.data&&(u(n.data.recommendations||[]),f({critical:n.data.criticalCount||0,warning:n.data.warningCount||0,info:n.data.infoCount||0}));case 3:return e.a(2)}},e)})),[t]);(0,r.useEffect)(function(){E(),_()},[E,_]);var P=(0,r.useCallback)(function(){var e=mp(pp().m(function e(n){var r,o,a,i;return pp().w(function(e){for(;;)switch(e.n){case 0:if(t){e.n=1;break}return e.a(2);case 1:return N(!0),C(null),T(null),e.n=2,Promise.all([cp(n,t),lp(n,t)]);case 2:r=e.v,o=vp(r,2),a=o[0],i=o[1],a.ok&&a.data&&C(a.data),i.ok&&i.data&&T(i.data),N(!1);case 3:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),[t]),O=function(){var e=mp(pp().m(function e(n){return pp().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,up(n,t);case 1:e.v.ok&&(_(),E());case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),R=function(){var e=mp(pp().m(function e(n){return pp().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,hp(n,t);case 1:e.v.ok&&(_(),E());case 2:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),M=function(e){var t=e.initiativeId||e.iniId;x(e),P(t)},z=p.critical+p.warning+p.info;return(0,Ac.jsxs)("div",{className:"intelligence-view",children:[(0,Ac.jsxs)("div",{className:"view-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h1",{children:"Campaign Intelligence"}),(0,Ac.jsx)("p",{className:"view-subtitle",children:"Real-time health monitoring, recommendations, and budget pacing"})]}),z>0&&(0,Ac.jsxs)("div",{className:"intel-alert-summary",children:[p.critical>0&&(0,Ac.jsxs)("span",{className:"intel-alert-badge sev-critical",children:[p.critical," Critical"]}),p.warning>0&&(0,Ac.jsxs)("span",{className:"intel-alert-badge sev-warning",children:[p.warning," Warning"]}),p.info>0&&(0,Ac.jsxs)("span",{className:"intel-alert-badge sev-info",children:[p.info," Info"]})]})]}),(0,Ac.jsx)("div",{className:"intel-tabs",children:Ip.map(function(e){return(0,Ac.jsxs)("button",{className:"intel-tab ".concat(o===e.id?"active":""),onClick:function(){return a(e.id)},children:[(0,Ac.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,Ac.jsx)("path",{d:e.icon})}),e.label,"recommendations"===e.id&&z>0&&(0,Ac.jsx)("span",{className:"tab-badge",children:z})]},e.id)})}),(0,Ac.jsxs)("div",{className:"intel-content",children:["health"===o&&(0,Ac.jsx)(Np,{health:s,loading:m,onSelectInitiative:M,onRefresh:E}),"recommendations"===o&&(0,Ac.jsx)(Ep,{recommendations:d,loading:m,onDismiss:O,onResolve:R}),"pacing"===o&&(0,Ac.jsx)(_p,{health:s,selectedInitiative:y,pacing:k,report:j,loading:A,onSelectInitiative:M})]})]})}function Np(e){var t=e.health,n=e.loading,r=e.onSelectInitiative,o=e.onRefresh;return n?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:"80px",marginBottom:"12px"}},e)})}):t&&0!==t.length?(0,Ac.jsxs)("div",{children:[(0,Ac.jsxs)("div",{className:"intel-section-header",children:[(0,Ac.jsx)("h3",{children:"Active Campaigns"}),(0,Ac.jsxs)("button",{className:"btn btn-sm btn-outline",onClick:o,children:[(0,Ac.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,Ac.jsx)("path",{d:"M1 4v6h6M23 20v-6h-6"}),(0,Ac.jsx)("path",{d:"M20.49 9A9 9 0 005.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 013.51 15"})]}),"Refresh"]})]}),(0,Ac.jsx)("div",{className:"health-grid",children:t.map(function(e,t){var n=e.channels?"string"==typeof e.channels?JSON.parse(e.channels):e.channels:[],o=n.reduce(function(e,t){var n=t.healthStatus||"green";return"red"===n?"red":"yellow"===n&&"red"!==e?"yellow":e},"green"),a=Tp[o]||Tp.green;return(0,Ac.jsxs)("div",{className:"health-card ".concat(a.css),onClick:function(){return r(e)},children:[(0,Ac.jsxs)("div",{className:"health-card-header",children:[(0,Ac.jsxs)("div",{className:"health-card-title",children:[(0,Ac.jsx)("span",{className:"health-dot",children:a.dot}),(0,Ac.jsx)("span",{children:e.name||"Untitled"})]}),(0,Ac.jsx)("span",{className:"health-status-label ".concat(a.css),children:a.label})]}),(0,Ac.jsxs)("div",{className:"health-card-meta",children:[(0,Ac.jsx)("span",{children:e.objective||"Campaign"}),(0,Ac.jsx)("span",{children:"•"}),(0,Ac.jsx)("span",{children:xp(e.totalBudget)}),(0,Ac.jsx)("span",{children:"•"}),(0,Ac.jsxs)("span",{children:[kp(e.startDate)," ",kp(e.endDate)]})]}),n.length>0&&(0,Ac.jsx)("div",{className:"health-channels",children:n.map(function(e,t){var n=Tp[e.healthStatus||"green"]||Tp.green;return(0,Ac.jsxs)("div",{className:"health-channel-row ".concat(n.css),children:[(0,Ac.jsxs)("div",{className:"health-channel-info",children:[(0,Ac.jsx)("span",{className:"health-channel-dot",children:n.dot}),(0,Ac.jsx)("span",{className:"health-channel-name",children:Sp(e.channelType)})]}),(0,Ac.jsxs)("div",{className:"health-channel-stats",children:[(0,Ac.jsxs)("span",{title:"Impressions (7d)",children:[yp(e.impressions7d)," imp"]}),(0,Ac.jsxs)("span",{title:"Clicks (7d)",children:[yp(e.clicks7d)," clicks"]}),(0,Ac.jsxs)("span",{title:"CTR (7d)",children:[wp(e.ctr7d)," CTR"]}),(0,Ac.jsx)("span",{title:"Spend (7d)",children:xp(e.spend7d)})]}),(0,Ac.jsxs)("div",{className:"health-channel-alerts",children:[e.criticalAlerts>0&&(0,Ac.jsx)("span",{className:"alert-count sev-critical",children:e.criticalAlerts}),e.warningAlerts>0&&(0,Ac.jsx)("span",{className:"alert-count sev-warning",children:e.warningAlerts})]})]},t)})})]},t)})})]}):(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,Ac.jsx)("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("h3",{children:"No active campaigns"}),(0,Ac.jsx)("p",{children:"Campaign health data will appear here once you have active campaigns running."})]})}function Ep(e){var t=e.recommendations,n=e.loading,o=e.onDismiss,a=e.onResolve,i=vp((0,r.useState)("all"),2),s=i[0],c=i[1];if(n)return(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:"72px",marginBottom:"12px"}},e)})});var l="all"===s?t:(null==t?void 0:t.filter(function(e){return e.severity===s}))||[];return(0,Ac.jsxs)("div",{children:[(0,Ac.jsxs)("div",{className:"intel-section-header",children:[(0,Ac.jsx)("h3",{children:"Active Recommendations"}),(0,Ac.jsx)("div",{className:"rec-filters",children:[{key:"all",label:"All"},{key:"critical",label:"Critical"},{key:"warning",label:"Warning"},{key:"info",label:"Info"}].map(function(e){return(0,Ac.jsx)("button",{className:"btn btn-sm ".concat(s===e.key?"btn-primary":"btn-outline"),onClick:function(){return c(e.key)},children:e.label},e.key)})})]}),l&&0!==l.length?(0,Ac.jsx)("div",{className:"rec-list",children:l.map(function(e,t){var n=jp[e.severity]||jp.info;return(0,Ac.jsxs)("div",{className:"rec-card ".concat(n.css),children:[(0,Ac.jsxs)("div",{className:"rec-card-header",children:[(0,Ac.jsxs)("span",{className:"rec-severity ".concat(n.css),children:[n.icon," ",n.label]}),(0,Ac.jsx)("span",{className:"rec-category",children:e.category}),(0,Ac.jsx)("span",{className:"rec-channel",children:Sp(e.channelType)}),(0,Ac.jsx)("span",{className:"rec-time",children:Cp(e.createdAt)})]}),(0,Ac.jsxs)("div",{className:"rec-card-body",children:[(0,Ac.jsx)("p",{className:"rec-initiative",children:e.initiativeName}),(0,Ac.jsx)("p",{className:"rec-message",children:e.message}),null!=e.metricValue&&(0,Ac.jsxs)("div",{className:"rec-metric",children:["Current: ",(0,Ac.jsx)("strong",{children:Number(e.metricValue).toFixed(2)}),null!=e.threshold&&(0,Ac.jsxs)(Ac.Fragment,{children:[" · Threshold: ",(0,Ac.jsx)("strong",{children:Number(e.threshold).toFixed(2)})]})]})]}),(0,Ac.jsxs)("div",{className:"rec-card-actions",children:[(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:function(){return a(e.recommendationId)},children:"✓ Resolve"}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-ghost",onClick:function(){return o(e.recommendationId)},children:"Dismiss"})]})]},e.recommendationId||t)})}):(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:(0,Ac.jsx)("path",{d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,Ac.jsx)("h3",{children:"all"===s?"All clear!":"No ".concat(s," recommendations")}),(0,Ac.jsx)("p",{children:"Your campaigns are performing within expected parameters."})]})]})}function _p(e){var t,n=e.health,r=e.selectedInitiative,o=e.pacing,a=e.report,i=e.loading,s=e.onSelectInitiative;return!r&&n&&n.length>0?(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("div",{className:"intel-section-header",children:(0,Ac.jsx)("h3",{children:"Select a Campaign"})}),(0,Ac.jsx)("div",{className:"pacing-select-grid",children:n.map(function(e,t){return(0,Ac.jsxs)("button",{className:"pacing-select-card",onClick:function(){return s(e)},children:[(0,Ac.jsx)("span",{className:"pacing-select-name",children:e.name||"Untitled"}),(0,Ac.jsxs)("span",{className:"pacing-select-meta",children:[xp(e.totalBudget)," · ",e.objective||"Campaign"]})]},t)})})]}):r?i?(0,Ac.jsx)("div",{className:"loading-placeholder padded",children:[1,2,3,4].map(function(e){return(0,Ac.jsx)("div",{className:"skeleton skeleton-row",style:{height:"60px",marginBottom:"12px"}},e)})}):(0,Ac.jsxs)("div",{children:[(0,Ac.jsxs)("div",{className:"intel-section-header",children:[(0,Ac.jsxs)("h3",{children:[r.name||"Campaign"," — Budget Pacing"]}),(0,Ac.jsx)("button",{className:"btn btn-sm btn-outline",onClick:function(){return s(null)},children:"← Back"})]}),o&&(0,Ac.jsxs)("div",{className:"pacing-overview",children:[(0,Ac.jsxs)("div",{className:"stats-grid",style:{gridTemplateColumns:"repeat(4, 1fr)"},children:[(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Total Budget"}),(0,Ac.jsx)("div",{className:"stat-value",children:xp(o.totalBudget)})]}),(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Spent to Date"}),(0,Ac.jsx)("div",{className:"stat-value",children:xp(o.actualSpendToDate)})]}),(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Expected Spend"}),(0,Ac.jsx)("div",{className:"stat-value",children:xp(o.expectedSpendToDate)})]}),(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:"Pacing"}),(0,Ac.jsx)("div",{className:"stat-value ".concat(o.overallPacingPct>120?"text-red":o.overallPacingPct<50?"text-orange":"text-green"),children:wp(o.overallPacingPct)})]})]}),(0,Ac.jsxs)("div",{className:"pacing-bar-container",children:[(0,Ac.jsxs)("div",{className:"pacing-bar-labels",children:[(0,Ac.jsxs)("span",{children:["Day ",o.elapsedDays," of ",o.campaignDays]}),(0,Ac.jsxs)("span",{children:[xp(o.actualSpendToDate)," of ",xp(o.totalBudget)]})]}),(0,Ac.jsxs)("div",{className:"pacing-bar",children:[(0,Ac.jsx)("div",{className:"pacing-bar-expected",style:{width:"".concat(Math.min(o.elapsedDays/o.campaignDays*100,100),"%")}}),(0,Ac.jsx)("div",{className:"pacing-bar-actual ".concat(o.overallPacingPct>120?"overpacing":o.overallPacingPct<50?"underpacing":"on-track"),style:{width:"".concat(Math.min(o.actualSpendToDate/o.totalBudget*100,100),"%")}})]}),(0,Ac.jsxs)("div",{className:"pacing-bar-legend",children:[(0,Ac.jsxs)("span",{children:[(0,Ac.jsx)("span",{className:"legend-dot expected"})," Expected"]}),(0,Ac.jsxs)("span",{children:[(0,Ac.jsx)("span",{className:"legend-dot actual"})," Actual"]})]})]}),o.channelPacing&&(0,Ac.jsxs)("div",{className:"content-card",style:{marginTop:"20px"},children:[(0,Ac.jsx)("div",{className:"content-card-header",children:(0,Ac.jsx)("h3",{children:"Channel Breakdown"})}),(0,Ac.jsx)("div",{className:"content-card-body",children:(0,Ac.jsxs)("table",{className:"data-table",children:[(0,Ac.jsx)("thead",{children:(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("th",{children:"Channel"}),(0,Ac.jsx)("th",{children:"Allocated"}),(0,Ac.jsx)("th",{children:"Spent"}),(0,Ac.jsx)("th",{children:"Utilization"}),(0,Ac.jsx)("th",{children:"Projected Total"}),(0,Ac.jsx)("th",{children:"Status"})]})}),(0,Ac.jsx)("tbody",{children:("string"==typeof o.channelPacing?JSON.parse(o.channelPacing):o.channelPacing).map(function(e,t){return(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("td",{style:{fontWeight:500},children:Sp(e.channelType)}),(0,Ac.jsx)("td",{children:xp(e.allocatedBudget)}),(0,Ac.jsx)("td",{children:xp(e.totalSpend)}),(0,Ac.jsx)("td",{children:wp(e.budgetUtilPct)}),(0,Ac.jsx)("td",{children:xp(e.projectedTotalSpend)}),(0,Ac.jsx)("td",{children:(0,Ac.jsx)("span",{className:"status-badge-sm status-".concat("on_track"===e.pacingStatus?"active":"overpacing"===e.pacingStatus?"error":"paused"),children:"on_track"===e.pacingStatus?"On Track":"overpacing"===e.pacingStatus?"Overpacing":"Underpacing"})})]},t)})})]})})]})]}),a&&a.totals&&(0,Ac.jsxs)("div",{style:{marginTop:"24px"},children:[(0,Ac.jsx)("h3",{style:{fontSize:"16px",fontWeight:600,marginBottom:"16px"},children:"Performance Summary"}),(0,Ac.jsx)("div",{className:"stats-grid",style:{gridTemplateColumns:"repeat(5, 1fr)"},children:(t="string"==typeof a.totals?JSON.parse(a.totals):a.totals,[{label:"Impressions",value:yp(t.totalImpressions)},{label:"Clicks",value:yp(t.totalClicks)},{label:"CTR",value:wp(t.overallCtr)},{label:"Avg CPC",value:xp(t.overallCpc)},{label:"Conversions",value:yp(t.totalConversions)}].map(function(e,t){return(0,Ac.jsxs)("div",{className:"stat-card",children:[(0,Ac.jsx)("div",{className:"stat-label",children:e.label}),(0,Ac.jsx)("div",{className:"stat-value",style:{fontSize:"20px"},children:e.value})]},t)}))}),a.channelComparison&&(0,Ac.jsxs)("div",{className:"content-card",style:{marginTop:"20px"},children:[(0,Ac.jsx)("div",{className:"content-card-header",children:(0,Ac.jsx)("h3",{children:"Cross-Platform Comparison"})}),(0,Ac.jsx)("div",{className:"content-card-body",children:(0,Ac.jsxs)("table",{className:"data-table",children:[(0,Ac.jsx)("thead",{children:(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("th",{children:"Channel"}),(0,Ac.jsx)("th",{children:"Impressions"}),(0,Ac.jsx)("th",{children:"Clicks"}),(0,Ac.jsx)("th",{children:"CTR"}),(0,Ac.jsx)("th",{children:"CPC"}),(0,Ac.jsx)("th",{children:"Spend"}),(0,Ac.jsx)("th",{children:"Conv."}),(0,Ac.jsx)("th",{children:"ROAS"})]})}),(0,Ac.jsx)("tbody",{children:("string"==typeof a.channelComparison?JSON.parse(a.channelComparison):a.channelComparison).map(function(e,t){return(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("td",{style:{fontWeight:500},children:Sp(e.channelType)}),(0,Ac.jsx)("td",{children:yp(e.totalImpressions)}),(0,Ac.jsx)("td",{children:yp(e.totalClicks)}),(0,Ac.jsx)("td",{children:wp(e.ctr)}),(0,Ac.jsx)("td",{children:xp(e.cpc)}),(0,Ac.jsx)("td",{children:xp(e.totalSpend)}),(0,Ac.jsx)("td",{children:yp(e.totalConversions)}),(0,Ac.jsx)("td",{children:null!=e.roas?Number(e.roas).toFixed(2)+"x":"—"})]},t)})})]})})]})]})]}):(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("h3",{children:"No campaigns available"}),(0,Ac.jsx)("p",{children:"Budget pacing data will appear here once you have active campaigns."})]})}function Pp(){return(0,Ac.jsx)(Ap,{})}function Op(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Rp(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Rp(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Rp(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Rp(u,"constructor",l),Rp(l,"constructor",c),c.displayName="GeneratorFunction",Rp(l,o,"GeneratorFunction"),Rp(u),Rp(u,o,"Generator"),Rp(u,r,function(){return this}),Rp(u,"toString",function(){return"[object Generator]"}),(Op=function(){return{w:a,m:h}})()}function Rp(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Rp=function(e,t,n,r){function a(t,n){Rp(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Rp(e,t,n,r)}function Mp(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function zp(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Mp(a,r,o,i,s,"next",e)}function s(e){Mp(a,r,o,i,s,"throw",e)}i(void 0)})}}function Lp(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Dp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dp(e,t):void 0}}(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 Dp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Fp={critical:{border:"#fca5a5",bg:"#fff1f2",badge:{bg:"#fee2e2",color:"#991b1b"}},warning:{border:"#fcd34d",bg:"#fffbeb",badge:{bg:"#fef9c3",color:"#854d0e"}},info:{border:"#93c5fd",bg:"#eff6ff",badge:{bg:"#dbeafe",color:"#1e40af"}}};function qp(){var e=nl().apiCall,t=Lp((0,r.useState)([]),2),n=t[0],o=t[1],a=Lp((0,r.useState)(!0),2),i=a[0],s=a[1],c=Lp((0,r.useState)(null),2),l=c[0],d=c[1],u=(0,r.useCallback)(zp(Op().m(function t(){var n;return Op().w(function(t){for(;;)switch(t.n){case 0:return s(!0),t.n=1,e("/api/recommendations");case 1:n=t.v,o(Array.isArray(null==n?void 0:n.recommendations)?n.recommendations:Array.isArray(null==n?void 0:n.data)?n.data:[]),s(!1);case 2:return t.a(2)}},t)})),[e]);(0,r.useEffect)(function(){u()},[u]);var h=function(){var t=zp(Op().m(function t(n){return Op().w(function(t){for(;;)switch(t.n){case 0:return d(n),t.n=1,e("/api/recommendations/".concat(n,"/dismiss"),"POST");case 1:return t.n=2,u();case 2:d(null);case 3:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),p=function(){var t=zp(Op().m(function t(n){return Op().w(function(t){for(;;)switch(t.n){case 0:return d(n),t.n=1,e("/api/recommendations/".concat(n,"/resolve"),"POST");case 1:return t.n=2,u();case 2:d(null);case 3:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}();return i?(0,Ac.jsx)("div",{className:"loading-message",children:"Loading recommendations…"}):0===n.length?(0,Ac.jsxs)("div",{className:"empty-state",children:[(0,Ac.jsx)("div",{style:{fontSize:36,marginBottom:10},children:"✅"}),"No active recommendations — your campaigns are looking good."]}):(0,Ac.jsxs)("div",{style:{maxWidth:800},children:[(0,Ac.jsx)("h2",{style:{fontSize:18,fontWeight:700,marginBottom:20},children:"Recommendations"}),(0,Ac.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:14},children:n.map(function(e,t){var n=e.recommendationId||e.RecId||t,r=(e.severity||e.Severity||"info").toLowerCase(),o=Fp[r]||Fp.info;return(0,Ac.jsx)("div",{style:{background:o.bg,border:"1px solid ".concat(o.border),borderRadius:10,padding:"16px 20px"},children:(0,Ac.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:12},children:[(0,Ac.jsxs)("div",{style:{flex:1},children:[(0,Ac.jsxs)("div",{style:{display:"flex",gap:10,alignItems:"center",marginBottom:6},children:[(0,Ac.jsx)("span",{style:{background:o.badge.bg,color:o.badge.color,padding:"2px 8px",borderRadius:10,fontSize:11,fontWeight:700,textTransform:"uppercase"},children:r}),(0,Ac.jsx)("span",{style:{fontWeight:600,fontSize:14,color:"#0f172a"},children:e.title||e.Title})]}),(0,Ac.jsx)("p",{style:{margin:"0 0 8px",fontSize:13,color:"#475569"},children:e.description||e.Description}),(e.recommendation||e.Recommendation)&&(0,Ac.jsxs)("p",{style:{margin:0,fontSize:13,color:"#0f172a",fontWeight:500},children:["💡 ",e.recommendation||e.Recommendation]})]}),(0,Ac.jsxs)("div",{style:{display:"flex",gap:8,flexShrink:0},children:[(0,Ac.jsx)("button",{className:"btn-action",style:{fontSize:12,padding:"6px 12px"},disabled:l===n,onClick:function(){return p(n)},children:"Resolve"}),(0,Ac.jsx)("button",{className:"btn-cancel",style:{fontSize:12,padding:"6px 12px"},disabled:l===n,onClick:function(){return h(n)},children:"Dismiss"})]})]})},n)})})]})}function Bp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return Up(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(Up(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,Up(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,Up(u,"constructor",l),Up(l,"constructor",c),c.displayName="GeneratorFunction",Up(l,o,"GeneratorFunction"),Up(u),Up(u,o,"Generator"),Up(u,r,function(){return this}),Up(u,"toString",function(){return"[object Generator]"}),(Bp=function(){return{w:a,m:h}})()}function Up(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}Up=function(e,t,n,r){function a(t,n){Up(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},Up(e,t,n,r)}function Hp(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function Kp(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){Hp(a,r,o,i,s,"next",e)}function s(e){Hp(a,r,o,i,s,"throw",e)}i(void 0)})}}function $p(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Gp(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Gp(e,t):void 0}}(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 Gp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var Wp=["Business","Technical","Legal","Operations","Financial"],Vp={Business:{bg:"#dbeafe",text:"#1e40af"},Technical:{bg:"#dcfce7",text:"#166534"},Legal:{bg:"#fef9c3",text:"#854d0e"},Operations:{bg:"#ede9fe",text:"#5b21b6"},Financial:{bg:"#fce7f3",text:"#9d174d"}},Qp=function(e){return e?e<1048576?"".concat((e/1024).toFixed(1)," KB"):"".concat((e/1048576).toFixed(1)," MB"):"—"};function Yp(e){var t=e.mimeType,n=void 0===t?"":t;return n.includes("pdf")?(0,Ac.jsx)("span",{children:"📕"}):n.includes("word")||n.includes("document")?(0,Ac.jsx)("span",{children:"📘"}):n.includes("sheet")||n.includes("excel")?(0,Ac.jsx)("span",{children:"📗"}):n.includes("image")?(0,Ac.jsx)("span",{children:"🖼️"}):(0,Ac.jsx)("span",{children:"📄"})}function Jp(e){var t=e.category,n=Vp[t]||{bg:"#f1f5f9",text:"#475569"};return(0,Ac.jsx)("span",{style:{background:n.bg,color:n.text,padding:"2px 8px",borderRadius:12,fontSize:11,fontWeight:600},children:t||"Uncategorized"})}function Xp(){var e=nl().apiCall,t=$p((0,r.useState)([]),2),n=t[0],o=t[1],a=$p((0,r.useState)(!0),2),i=a[0],s=a[1],c=$p((0,r.useState)(null),2),l=c[0],d=c[1],u=$p((0,r.useState)(!1),2),h=u[0],p=u[1],f=$p((0,r.useState)(null),2),g=f[0],m=f[1],v=$p((0,r.useState)("Business"),2),b=v[0],y=v[1],x=$p((0,r.useState)(""),2),w=x[0],k=x[1],C=$p((0,r.useState)(!1),2),S=C[0],j=C[1],T=$p((0,r.useState)(null),2),I=T[0],A=T[1],N=$p((0,r.useState)(null),2),E=N[0],_=N[1],P=$p((0,r.useState)(null),2),O=P[0],R=P[1],M=$p((0,r.useState)(!1),2),z=M[0],L=M[1],D=(0,r.useRef)(),F=(0,r.useCallback)(Kp(Bp().m(function t(){var n;return Bp().w(function(t){for(;;)switch(t.n){case 0:return s(!0),d(null),t.n=1,e("/api/documents/list","POST",{});case 1:!1!==(null==(n=t.v)?void 0:n.ok)?o(Array.isArray(null==n?void 0:n.documents)?n.documents:[]):d((null==n?void 0:n.error)||"Failed to load documents"),s(!1);case 2:return t.a(2)}},t)})),[e]);(0,r.useEffect)(function(){F()},[F]);var q=function(){var t=Kp(Bp().m(function t(){var n,r,o;return Bp().w(function(t){for(;;)switch(t.p=t.n){case 0:if(g){t.n=1;break}return A("Please select a file"),t.a(2);case 1:return j(!0),A(null),t.p=2,(n=new FormData).append("file",g),n.append("category",b),n.append("description",w),t.n=3,e("/api/documents",{method:"POST",body:n});case 3:if(null!=(r=t.v)&&r.ok){t.n=4;break}throw new Error((null==r?void 0:r.error)||"Upload failed");case 4:return p(!1),m(null),k(""),t.n=5,F();case 5:t.n=7;break;case 6:t.p=6,o=t.v,A(o.message);case 7:return t.p=7,j(!1),t.f(7);case 8:return t.a(2)}},t,null,[[2,6,7,8]])}));return function(){return t.apply(this,arguments)}}(),B=function(){var t=Kp(Bp().m(function t(n){var r,o,a,i,s;return Bp().w(function(t){for(;;)switch(t.p=t.n){case 0:return _(n.docId),t.p=1,t.n=2,e("/api/documents/".concat(n.docId,"/download"),{rawResponse:!0});case 2:if(r=t.v){t.n=3;break}throw new Error("No response");case 3:return t.n=4,r.blob();case 4:o=t.v,a=URL.createObjectURL(o),(i=document.createElement("a")).href=a,i.download=n.docFileName,i.click(),URL.revokeObjectURL(a),t.n=6;break;case 5:t.p=5,s=t.v,alert("Download failed: ".concat(s.message));case 6:return t.p=6,_(null),t.f(6);case 7:return t.a(2)}},t,null,[[1,5,6,7]])}));return function(e){return t.apply(this,arguments)}}(),U=function(){var t=Kp(Bp().m(function t(){var n,r;return Bp().w(function(t){for(;;)switch(t.p=t.n){case 0:if(O){t.n=1;break}return t.a(2);case 1:return L(!0),t.p=2,t.n=3,e("/api/documents/".concat(O),{method:"DELETE"});case 3:if(null!=(n=t.v)&&n.ok){t.n=4;break}throw new Error((null==n?void 0:n.error)||"Delete failed");case 4:return R(null),t.n=5,F();case 5:t.n=7;break;case 6:t.p=6,r=t.v,alert("Delete failed: ".concat(r.message));case 7:return t.p=7,L(!1),t.f(7);case 8:return t.a(2)}},t,null,[[2,6,7,8]])}));return function(){return t.apply(this,arguments)}}();return(0,Ac.jsxs)("div",{className:"data-panel",style:{maxWidth:900},children:[(0,Ac.jsxs)("div",{className:"panel-header",children:[(0,Ac.jsxs)("div",{children:[(0,Ac.jsx)("h3",{className:"panel-title",children:"Documents"}),(0,Ac.jsx)("p",{className:"panel-subtitle",children:i?"Loading…":"".concat(n.length," document").concat(1!==n.length?"s":"")})]}),(0,Ac.jsx)("button",{className:"btn-action",onClick:function(){p(!0),A(null)},children:"↑ Upload"})]}),h&&(0,Ac.jsxs)("div",{className:"admin-form",style:{marginBottom:20},children:[(0,Ac.jsx)("div",{className:"form-title",children:"Upload Document"}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{className:"form-label",children:"File"}),(0,Ac.jsxs)("div",{style:{border:"2px dashed ".concat(g?"var(--accent)":"#cbd5e1"),borderRadius:6,padding:"16px 20px",textAlign:"center",cursor:"pointer",background:g?"#eff6ff":"#fff"},onClick:function(){var e;return null===(e=D.current)||void 0===e?void 0:e.click()},children:[g?(0,Ac.jsxs)("div",{style:{color:"var(--accent)",fontWeight:600},children:["📎 ",g.name," ",(0,Ac.jsxs)("span",{style:{color:"#64748b",fontWeight:400},children:["(",Qp(g.size),")"]})]}):(0,Ac.jsx)("div",{style:{color:"#94a3b8"},children:"Click to choose a file"}),(0,Ac.jsx)("input",{ref:D,type:"file",style:{display:"none"},onChange:function(e){var t;return m((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)}})]})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{className:"form-label",children:"Category"}),(0,Ac.jsx)("select",{className:"form-select",value:b,onChange:function(e){return y(e.target.value)},children:Wp.map(function(e){return(0,Ac.jsx)("option",{value:e,children:e},e)})})]}),(0,Ac.jsxs)("div",{className:"form-group",children:[(0,Ac.jsx)("label",{className:"form-label",children:"Description (optional)"}),(0,Ac.jsx)("input",{className:"form-input",type:"text",placeholder:"Brief description…",value:w,onChange:function(e){return k(e.target.value)}})]}),I&&(0,Ac.jsx)("div",{className:"error-message",style:{marginBottom:12},children:I}),(0,Ac.jsxs)("div",{className:"form-buttons",children:[(0,Ac.jsx)("button",{className:"btn-action",onClick:q,disabled:S||!g,children:S?"Uploading…":"Upload"}),(0,Ac.jsx)("button",{className:"btn-cancel",onClick:function(){p(!1),m(null),A(null)},disabled:S,children:"Cancel"})]})]}),i&&(0,Ac.jsx)("div",{className:"loading-message",children:"Loading documents…"}),l&&(0,Ac.jsx)("div",{className:"error-message",children:l}),!i&&!l&&0===n.length&&(0,Ac.jsx)("div",{className:"empty-state",children:"No documents yet. Upload your first document above."}),!i&&!l&&n.length>0&&(0,Ac.jsxs)("table",{className:"data-table",children:[(0,Ac.jsx)("thead",{children:(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("th",{style:{width:36}}),(0,Ac.jsx)("th",{children:"File"}),(0,Ac.jsx)("th",{children:"Category"}),(0,Ac.jsx)("th",{children:"Size"}),(0,Ac.jsx)("th",{children:"Uploaded"}),(0,Ac.jsx)("th",{style:{width:80},children:"Actions"})]})}),(0,Ac.jsx)("tbody",{children:n.map(function(e){return(0,Ac.jsxs)("tr",{children:[(0,Ac.jsx)("td",{style:{textAlign:"center",fontSize:18},children:(0,Ac.jsx)(Yp,{mimeType:e.docMimeType})}),(0,Ac.jsxs)("td",{children:[(0,Ac.jsx)("div",{style:{fontWeight:500,color:"#1e293b"},children:e.docFileName}),e.docDescription&&(0,Ac.jsx)("div",{style:{fontSize:12,color:"#64748b",marginTop:2},children:e.docDescription})]}),(0,Ac.jsx)("td",{children:(0,Ac.jsx)(Jp,{category:e.docCategory})}),(0,Ac.jsx)("td",{style:{color:"#64748b",fontSize:13},children:Qp(e.docFileSize)}),(0,Ac.jsx)("td",{style:{color:"#64748b",fontSize:13},children:(t=e.docUploadedAt,t?new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):"—")}),(0,Ac.jsx)("td",{children:(0,Ac.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,Ac.jsx)("button",{className:"btn-icon",title:"Download",disabled:E===e.docId,onClick:function(){return B(e)},children:E===e.docId?"…":"↓"}),(0,Ac.jsx)("button",{className:"btn-icon btn-icon-danger",title:"Delete",onClick:function(){return R(e.docId)},children:"✕"})]})})]},e.docId);var t})})]}),O&&(0,Ac.jsx)("div",{className:"modal-overlay",children:(0,Ac.jsxs)("div",{className:"modal-box",children:[(0,Ac.jsx)("h4",{className:"modal-title",children:"Delete Document?"}),(0,Ac.jsx)("p",{className:"modal-body",children:"This will permanently remove the document."}),(0,Ac.jsxs)("div",{className:"modal-buttons",children:[(0,Ac.jsx)("button",{className:"btn-danger",onClick:U,disabled:z,children:z?"Deleting…":"Delete"}),(0,Ac.jsx)("button",{className:"btn-cancel",onClick:function(){return R(null)},disabled:z,children:"Cancel"})]})]})})]})}function Zp(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof s?r:s,l=Object.create(c.prototype);return ef(l,"_invoke",function(n,r,o){var a,s,c,l=0,d=o||[],u=!1,h={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,s=0,c=e,h.n=n,i}};function p(n,r){for(s=n,c=r,t=0;!u&&l&&!o&&t<d.length;t++){var o,a=d[t],p=h.p,f=a[2];n>3?(o=f===r)&&(c=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&p<a[1])?(s=0,h.v=r,h.n=a[1]):p<f&&(o=n<3||a[0]>r||r>f)&&(a[4]=n,a[5]=r,h.n=f,s=0))}if(o||n>1)return i;throw u=!0,r}return function(o,d,f){if(l>1)throw TypeError("Generator is already running");for(u&&1===d&&p(d,f),s=d,c=f;(t=s<2?e:c)||!u;){a||(s?s<3?(s>1&&(h.n=-1),p(s,c)):h.n=c:h.v=c);try{if(l=2,a){if(s||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),s=1);a=e}else if((t=(u=h.n<0)?c:n.call(r,h))!==i)break}catch(t){a=e,s=1,c=t}finally{l=1}}return{value:t,done:u}}}(n,o,a),!0),l}var i={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var d=[][r]?t(t([][r]())):(ef(t={},r,function(){return this}),t),u=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,ef(e,o,"GeneratorFunction")),e.prototype=Object.create(u),e}return c.prototype=l,ef(u,"constructor",l),ef(l,"constructor",c),c.displayName="GeneratorFunction",ef(l,o,"GeneratorFunction"),ef(u),ef(u,o,"Generator"),ef(u,r,function(){return this}),ef(u,"toString",function(){return"[object Generator]"}),(Zp=function(){return{w:a,m:h}})()}function ef(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}ef=function(e,t,n,r){function a(t,n){ef(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},ef(e,t,n,r)}function tf(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o)}function nf(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,o,a,i,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(l)throw o}}return s}}(e,t)||function(e,t){if(e){if("string"==typeof e)return rf(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?rf(e,t):void 0}}(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 rf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function of(){nl().sessionToken;var e=nl().apiCall,t=nf((0,r.useState)([]),2),n=t[0],o=t[1],a=nf((0,r.useState)(!0),2),i=a[0],s=a[1],c=nf((0,r.useState)(null),2),l=c[0],d=c[1],u=nf((0,r.useState)(""),2),h=u[0],p=u[1];(0,r.useEffect)(function(){var t;(t=Zp().m(function t(){var n,r;return Zp().w(function(t){for(;;)switch(t.n){case 0:return s(!0),t.n=1,e("".concat(jc,"/api/help/list"),"POST",{includeInactive:!1});case 1:n=t.v,r=Array.isArray(null==n?void 0:n.items)?n.items:Array.isArray(null==n?void 0:n.data)?n.data:[],o(r),s(!1);case 2:return t.a(2)}},t)}),function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){tf(a,r,o,i,s,"next",e)}function s(e){tf(a,r,o,i,s,"throw",e)}i(void 0)})})()},[e]);var f=n.filter(function(e){return!h||(e.title||e.Title||"").toLowerCase().includes(h.toLowerCase())||(e.content||e.Content||"").toLowerCase().includes(h.toLowerCase())});return i?(0,Ac.jsx)("div",{className:"loading-message",children:"Loading help content…"}):(0,Ac.jsxs)("div",{style:{maxWidth:760},children:[(0,Ac.jsx)("h2",{style:{fontSize:20,fontWeight:700,marginBottom:16},children:"Help & FAQs"}),(0,Ac.jsx)("input",{className:"form-input",style:{marginBottom:20,maxWidth:400},placeholder:"Search help articles…",value:h,onChange:function(e){return p(e.target.value)}}),0===f.length?(0,Ac.jsx)("div",{className:"empty-state",children:"No help articles found."}):(0,Ac.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:10},children:f.map(function(e,t){var n=e.helpId||e.HelpId||t,r=e.title||e.Title||"Article",o=e.content||e.Content||"",a=l===n;return(0,Ac.jsxs)("div",{style:{background:"#fff",border:"1px solid #e2e8f0",borderRadius:8,overflow:"hidden"},children:[(0,Ac.jsxs)("button",{onClick:function(){return d(a?null:n)},style:{width:"100%",padding:"14px 18px",display:"flex",justifyContent:"space-between",alignItems:"center",background:"none",border:"none",cursor:"pointer",textAlign:"left"},children:[(0,Ac.jsx)("span",{style:{fontWeight:600,fontSize:14,color:"#0f172a"},children:r}),(0,Ac.jsx)("span",{style:{color:"#94a3b8",fontSize:18,lineHeight:1},children:a?"":"+"})]}),a&&(0,Ac.jsx)("div",{style:{padding:"0 18px 16px",fontSize:14,color:"#475569",lineHeight:1.6},children:o})]},n)})})]})}function af(){var e=nl(),t=e.activeCategory,n=e.activeTab,r=e.tabs,o=e.collapsed,a=e.setActiveCategory,i=e.setActiveTab,s=e.setCollapsed;return(0,Ac.jsxs)("div",{className:"dashboard-layout",children:[(0,Ac.jsx)(cl,{activeCategory:t,onSelectCategory:a,collapsed:o,onToggleCollapse:function(){return s(function(e){return!e})}}),(0,Ac.jsxs)("div",{className:"dashboard-main",children:[(0,Ac.jsxs)("header",{className:"dashboard-header",children:[(0,Ac.jsx)("div",{className:"dashboard-header-top",children:(0,Ac.jsx)("h1",{className:"dashboard-title",children:el[t]||t})}),r.length>1&&(0,Ac.jsx)("div",{className:"dashboard-tabs",children:r.map(function(e){return(0,Ac.jsx)("button",{className:"tab-btn ".concat(n===e.id?"active":""),onClick:function(){return i(e.id)},children:e.label},e.id)})})]}),(0,Ac.jsxs)("div",{className:"dashboard-content",children:["overview"===n&&(0,Ac.jsx)(yl,{}),"myCampaigns"===n&&(0,Ac.jsx)(Ed,{}),"newCampaign"===n&&(0,Ac.jsx)(Xh,{}),"metrics"===n&&(0,Ac.jsx)(Pp,{}),"recommendations"===n&&(0,Ac.jsx)(qp,{}),"myDocuments"===n&&(0,Ac.jsx)(Xp,{}),"help"===n&&(0,Ac.jsx)(of,{}),"invoices"===n&&(0,Ac.jsxs)("div",{className:"placeholder-panel",children:[(0,Ac.jsx)("div",{className:"placeholder-icon",children:"💳"}),(0,Ac.jsx)("h3",{children:"Billing"}),(0,Ac.jsx)("p",{children:"Invoice history and payment management coming soon."})]})]})]})]})}function sf(){switch(Uc().authState){case"active":return(0,Ac.jsx)(rl,{children:(0,Ac.jsx)(af,{})});case"authenticating":return(0,Ac.jsx)(ol,{children:(0,Ac.jsxs)("div",{className:"loading-container",children:[(0,Ac.jsx)("div",{className:"spinner"}),(0,Ac.jsx)("p",{children:"Signing in…"})]})});default:return(0,Ac.jsx)(ol,{children:(0,Ac.jsx)(al,{})})}}var cf=n(72),lf=n.n(cf),df=n(825),uf=n.n(df),hf=n(659),pf=n.n(hf),ff=n(56),gf=n.n(ff),mf=n(159),vf=n.n(mf),bf=n(113),yf=n.n(bf),xf=n(877),wf={};wf.styleTagTransform=yf(),wf.setAttributes=gf(),wf.insert=pf().bind(null,"head"),wf.domAPI=uf(),wf.insertStyleElement=vf(),lf()(xf.A,wf),xf.A&&xf.A.locals&&xf.A.locals;var kf=n(767),Cf={};Cf.styleTagTransform=yf(),Cf.setAttributes=gf(),Cf.insert=pf().bind(null,"head"),Cf.domAPI=uf(),Cf.insertStyleElement=vf(),lf()(kf.A,Cf),kf.A&&kf.A.locals&&kf.A.locals;var Sf=n(671),jf={};jf.styleTagTransform=yf(),jf.setAttributes=gf(),jf.insert=pf().bind(null,"head"),jf.domAPI=uf(),jf.insertStyleElement=vf(),lf()(Sf.A,jf),Sf.A&&Sf.A.locals&&Sf.A.locals;var Tf=n(321),If={};If.styleTagTransform=yf(),If.setAttributes=gf(),If.insert=pf().bind(null,"head"),If.domAPI=uf(),If.insertStyleElement=vf(),lf()(Tf.A,If),Tf.A&&Tf.A.locals&&Tf.A.locals;var Af=n(27),Nf={};Nf.styleTagTransform=yf(),Nf.setAttributes=gf(),Nf.insert=pf().bind(null,"head"),Nf.domAPI=uf(),Nf.insertStyleElement=vf(),lf()(Af.A,Nf),Af.A&&Af.A.locals&&Af.A.locals,(0,o.H)(document.getElementById("root")).render((0,Ac.jsx)(r.StrictMode,{children:(0,Ac.jsx)(Gc,{children:(0,Ac.jsx)(sf,{})})}))})();