PageSourceSearch

https://clinic-calendar-cmw.pages.dev/assets/index-DSx0lpT-.js

js clinic-calendar-cmw.pages.dev collected 2026-10-03 06:38:48 UTC 434,888 bytes, 430 lines download raw bytes

vendor: 5,483 bytes, lines 1-9
1var ap=Object.defineProperty;var lp=(l,o,c)=>o in l?ap(l,o,{enumerable:!0,configurable:!0,writable:!0,value:c}):l[o]=c;var fo=(l,o,c)=>lp(l,typeof o!="symbol"?o+"":o,c);(function(){const o=document.createElement("link").relList;if(o&&o.supports&&o.supports("modulepreload"))return;for(const h of document.querySelectorAll('link[rel="modulepreload"]'))d(h);new MutationObserver(h=>{for(const x of h)if(x.type==="childList")for(const m of x.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&d(m)}).observe(document,{childList:!0,subtree:!0});function c(h){const x={};return h.integrity&&(x.integrity=h.integrity),h.referrerPolicy&&(x.referrerPolicy=h.referrerPolicy),h.crossOrigin==="use-credentials"?x.credentials="include":h.crossOrigin==="anonymous"?x.credentials="omit":x.credentials="same-origin",x}function d(h){if(h.ep)return;h.ep=!0;const x=c(h);fetch(h.href,x)}})();var mo={exports:{}},ea={},po={exports:{}},Ce={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var cd;function ip(){if(cd)return Ce;cd=1;var l=Symbol.for("react.element"),o=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),m=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),j=Symbol.iterator;function N(C){return C===null||typeof C!="object"?null:(C=j&&C[j]||C["@@iterator"],typeof C=="function"?C:null)}var R={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,b={};function v(C,O,ye){this.props=C,this.context=O,this.refs=b,this.updater=ye||R}v.prototype.isReactComponent={},v.prototype.setState=function(C,O){if(typeof C!="object"&&typeof C!="function"&&C!=null)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,C,O,"setState")},v.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function D(){}D.prototype=v.prototype;function _(C,O,ye){this.props=C,this.context=O,this.refs=b,this.updater=ye||R}var z=_.prototype=new D;z.constructor=_,T(z,v.prototype),z.isPureReactComponent=!0;var F=Array.isArray,V=Object.prototype.hasOwnProperty,M={current:null},J={key:!0,ref:!0,__self:!0,__source:!0};function H(C,O,ye){var G,fe={},ke=null,_e=null;if(O!=null)for(G in O.ref!==void 0&&(_e=O.ref),O.key!==void 0&&(ke=""+O.key),O)V.call(O,G)&&!J.hasOwnProperty(G)&&(fe[G]=O[G]);var U=arguments.length-2;if(U===1)fe.children=ye;else if(1<U){for(var te=Array(U),he=0;he<U;he++)te[he]=arguments[he+2];fe.children=te}if(C&&C.defaultProps)for(G in U=C.defaultProps,U)fe[G]===void 0&&(fe[G]=U[G]);return{$$typeof:l,type:C,key:ke,ref:_e,props:fe,_owner:M.current}}function W(C,O){return{$$typeof:l,type:C.type,key:O,ref:C.ref,props:C.props,_owner:C._owner}}function Ne(C){return typeof C=="object"&&C!==null&&C.$$typeof===l}function re(C){var O={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(ye){return O[ye]})}var ee=/\/+/g;function Z(C,O){return typeof C=="object"&&C!==null&&C.key!=null?re(""+C.key):O.toString(36)}function xe(C,O,ye,G,fe){var ke=typeof C;(ke==="undefined"||ke==="boolean")&&(C=null);var _e=!1;if(C===null)_e=!0;else switch(ke){case"string":case"number":_e=!0;break;case"object":switch(C.$$typeof){case l:case o:_e=!0}}if(_e)return _e=C,fe=fe(_e),C=G===""?"."+Z(_e,0):G,F(fe)?(ye="",C!=null&&(ye=C.replace(ee,"$&/")+"/"),xe(fe,O,ye,"",function(he){return he})):fe!=null&&(Ne(fe)&&(fe=W(fe,ye+(!fe.key||_e&&_e.key===fe.key?"":(""+fe.key).replace(ee,"$&/")+"/")+C)),O.push(fe)),1;if(_e=0,G=G===""?".":G+":",F(C))for(var U=0;U<C.length;U++){ke=C[U];var te=G+Z(ke,U);_e+=xe(ke,O,ye,te,fe)}else if(te=N(C),typeof te=="function")for(C=te.call(C),U=0;!(ke=C.next()).done;)ke=ke.value,te=G+Z(ke,U++),_e+=xe(ke,O,ye,te,fe);else if(ke==="object")throw O=String(C),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.");return _e}function be(C,O,ye){if(C==null)return C;var G=[],fe=0;return xe(C,G,"","",function(ke){return O.call(ye,ke,fe++)}),G}function je(C){if(C._status===-1){var O=C._result;O=O(),O.then(function(ye){(C._status===0||C._status===-1)&&(C._status=1,C._result=ye)},function(ye){(C._status===0||C._status===-1)&&(C._status=2,C._result=ye)}),C._status===-1&&(C._status=0,C._result=O)}if(C._status===1)return C._result.default;throw C._result}var ne={current:null},I={transition:null},ie={ReactCurrentDispatcher:ne,ReactCurrentBatchConfig:I,ReactCurrentOwner:M};function B(){throw Error("act(...) is not supported in production builds of React.")}return Ce.Children={map:be,forEach:function(C,O,ye){be(C,function(){O.apply(this,arguments)},ye)},count:function(C){var O=0;return be(C,function(){O++}),O},toArray:function(C){return be(C,function(O){return O})||[]},only:function(C){if(!Ne(C))throw Error("React.Children.only expected to receive a single React element child.");return C}},Ce.Component=v,Ce.Fragment=c,Ce.Profiler=h,Ce.PureComponent=_,Ce.StrictMode=d,Ce.Suspense=w,Ce.__SECRET_INT
vendor: 4,185 bytes, lines 9-25
9ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ie,Ce.act=B,Ce.cloneElement=function(C,O,ye){if(C==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+C+".");var G=T({},C.props),fe=C.key,ke=C.ref,_e=C._owner;if(O!=null){if(O.ref!==void 0&&(ke=O.ref,_e=M.current),O.key!==void 0&&(fe=""+O.key),C.type&&C.type.defaultProps)var U=C.type.defaultProps;for(te in O)V.call(O,te)&&!J.hasOwnProperty(te)&&(G[te]=O[te]===void 0&&U!==void 0?U[te]:O[te])}var te=arguments.length-2;if(te===1)G.children=ye;else if(1<te){U=Array(te);for(var he=0;he<te;he++)U[he]=arguments[he+2];G.children=U}return{$$typeof:l,type:C.type,key:fe,ref:ke,props:G,_owner:_e}},Ce.createContext=function(C){return C={$$typeof:m,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},C.Provider={$$typeof:x,_context:C},C.Consumer=C},Ce.createElement=H,Ce.createFactory=function(C){var O=H.bind(null,C);return O.type=C,O},Ce.createRef=function(){return{current:null}},Ce.forwardRef=function(C){return{$$typeof:p,render:C}},Ce.isValidElement=Ne,Ce.lazy=function(C){return{$$typeof:k,_payload:{_status:-1,_result:C},_init:je}},Ce.memo=function(C,O){return{$$typeof:g,type:C,compare:O===void 0?null:O}},Ce.startTransition=function(C){var O=I.transition;I.transition={};try{C()}finally{I.transition=O}},Ce.unstable_act=B,Ce.useCallback=function(C,O){return ne.current.useCallback(C,O)},Ce.useContext=function(C){return ne.current.useContext(C)},Ce.useDebugValue=function(){},Ce.useDeferredValue=function(C){return ne.current.useDeferredValue(C)},Ce.useEffect=function(C,O){return ne.current.useEffect(C,O)},Ce.useId=function(){return ne.current.useId()},Ce.useImperativeHandle=function(C,O,ye){return ne.current.useImperativeHandle(C,O,ye)},Ce.useInsertionEffect=function(C,O){return ne.current.useInsertionEffect(C,O)},Ce.useLayoutEffect=function(C,O){return ne.current.useLayoutEffect(C,O)},Ce.useMemo=function(C,O){return ne.current.useMemo(C,O)},Ce.useReducer=function(C,O,ye){return ne.current.useReducer(C,O,ye)},Ce.useRef=function(C){return ne.current.useRef(C)},Ce.useState=function(C){return ne.current.useState(C)},Ce.useSyncExternalStore=function(C,O,ye){return ne.current.useSyncExternalStore(C,O,ye)},Ce.useTransition=function(){return ne.current.useTransition()},Ce.version="18.3.1",Ce}var ud;function $o(){return ud||(ud=1,po.exports=ip()),po.exports}/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var dd;function op(){if(dd)return ea;dd=1;var l=$o(),o=Symbol.for("react.element"),c=Symbol.for("react.fragment"),d=Object.prototype.hasOwnProperty,h=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,x={key:!0,ref:!0,__self:!0,__source:!0};function m(p,w,g){var k,j={},N=null,R=null;g!==void 0&&(N=""+g),w.key!==void 0&&(N=""+w.key),w.ref!==void 0&&(R=w.ref);for(k in w)d.call(w,k)&&!x.hasOwnProperty(k)&&(j[k]=w[k]);if(p&&p.defaultProps)for(k in w=p.defaultProps,w)j[k]===void 0&&(j[k]=w[k]);return{$$typeof:o,type:p,key:N,ref:R,props:j,_owner:h.current}}return ea.Fragment=c,ea.jsx=m,ea.jsxs=m,ea}var fd;function cp(){return fd||(fd=1,mo.exports=op()),mo.exports}var n=cp(),f=$o(),gl={},ho={exports:{}},vt={},xo={exports:{}},go={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */var md;function up(){return md||(md=1,(function(l){function o(I,ie){var B=I.length;I.push(ie);e:for(;0<B;){var C=B-1>>>1,O=I[C];if(0<h(O,ie))I[C]=ie,I[B]=O,B=C;else break e}}function c(I){return I.length===0?null:I[0]}function d(I){if(I.length===0)return null;var ie=I[0],B=I.pop();if(B!==ie){I[0]=B;e:for(var C=0,O=I.length,ye=O>>>1;C<ye;){var G=2*(C+1)-1,fe=I[G],ke=G+1,_e=I[ke];if(0>h(fe,B))ke<O&&0>h(_e,fe)?(I[C]=_e,I[ke]=B,C=ke):(I[C]=fe,I[G]=B,C=G);else if(ke<O&&0>h(_e,B))I[C]=_e,I[ke]=B,C=ke;else break e}}return ie}
vendor: 50,496 bytes, lines 25-38
25function h(I,ie){var B=I.sortIndex-ie.sortIndex;return B!==0?B:I.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var x=performance;l.unstable_now=function(){return x.now()}}else{var m=Date,p=m.now();l.unstable_now=function(){return m.now()-p}}var w=[],g=[],k=1,j=null,N=3,R=!1,T=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function z(I){for(var ie=c(g);ie!==null;){if(ie.callback===null)d(g);else if(ie.startTime<=I)d(g),ie.sortIndex=ie.expirationTime,o(w,ie);else break;ie=c(g)}}function F(I){if(b=!1,z(I),!T)if(c(w)!==null)T=!0,je(V);else{var ie=c(g);ie!==null&&ne(F,ie.startTime-I)}}function V(I,ie){T=!1,b&&(b=!1,D(H),H=-1),R=!0;var B=N;try{for(z(ie),j=c(w);j!==null&&(!(j.expirationTime>ie)||I&&!re());){var C=j.callback;if(typeof C=="function"){j.callback=null,N=j.priorityLevel;var O=C(j.expirationTime<=ie);ie=l.unstable_now(),typeof O=="function"?j.callback=O:j===c(w)&&d(w),z(ie)}else d(w);j=c(w)}if(j!==null)var ye=!0;else{var G=c(g);G!==null&&ne(F,G.startTime-ie),ye=!1}return ye}finally{j=null,N=B,R=!1}}var M=!1,J=null,H=-1,W=5,Ne=-1;function re(){return!(l.unstable_now()-Ne<W)}function ee(){if(J!==null){var I=l.unstable_now();Ne=I;var ie=!0;try{ie=J(!0,I)}finally{ie?Z():(M=!1,J=null)}}else M=!1}var Z;if(typeof _=="function")Z=function(){_(ee)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,be=xe.port2;xe.port1.onmessage=ee,Z=function(){be.postMessage(null)}}else Z=function(){v(ee,0)};function je(I){J=I,M||(M=!0,Z())}function ne(I,ie){H=v(function(){I(l.unstable_now())},ie)}l.unstable_IdlePriority=5,l.unstable_ImmediatePriority=1,l.unstable_LowPriority=4,l.unstable_NormalPriority=3,l.unstable_Profiling=null,l.unstable_UserBlockingPriority=2,l.unstable_cancelCallback=function(I){I.callback=null},l.unstable_continueExecution=function(){T||R||(T=!0,je(V))},l.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):W=0<I?Math.floor(1e3/I):5},l.unstable_getCurrentPriorityLevel=function(){return N},l.unstable_getFirstCallbackNode=function(){return c(w)},l.unstable_next=function(I){switch(N){case 1:case 2:case 3:var ie=3;break;default:ie=N}var B=N;N=ie;try{return I()}finally{N=B}},l.unstable_pauseExecution=function(){},l.unstable_requestPaint=function(){},l.unstable_runWithPriority=function(I,ie){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var B=N;N=I;try{return ie()}finally{N=B}},l.unstable_scheduleCallback=function(I,ie,B){var C=l.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?C+B:C):B=C,I){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=B+O,I={id:k++,callback:ie,priorityLevel:I,startTime:B,expirationTime:O,sortIndex:-1},B>C?(I.sortIndex=B,o(g,I),c(w)===null&&I===c(g)&&(b?(D(H),H=-1):b=!0,ne(F,B-C))):(I.sortIndex=O,o(w,I),T||R||(T=!0,je(V))),I},l.unstable_shouldYield=re,l.unstable_wrapCallback=function(I){var ie=N;return function(){var B=N;N=ie;try{return I.apply(this,arguments)}finally{N=B}}}})(go)),go}var pd;function dp(){return pd||(pd=1,xo.exports=up()),xo.exports}/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var hd;function fp(){if(hd)return vt;hd=1;var l=$o(),o=dp();function c(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);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 d=new Set,h={};function x(e,t){m(e,t),m(e+"Capture",t)}function m(e,t){for(h[e]=t,e=0;e<t.length;e++)d.add(t[e])}var p=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),w=Object.prototype.hasOwnProperty,g=/^[: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]*$/,k={},j={};function N(e){return w.call(j,e)?!0:w.call(k,e)?!1:g.test(e)?j[e]=!0:(k[e]=!0,!1)}function R(e,t,r,s){if(r!==null&&r.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:r!==null?!r.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function T(e,t,r,s){if(t===null||typeof t>"u"||R(e,t,r,s))return!0;if(s)return!1;if(r!==null)switch(r.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function b(e,t,r,s,a,i,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=a,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=u}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){v[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];v[t]=new b(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){v[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){v[e]=new b(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){v[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){v[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){v[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){v[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){v[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var D=/[\-:]([a-z])/g;function _(e){return e[1].toUpperCase()}"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(D,_);v[t]=new b(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(D,_);v[t]=new b(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(D,_);v[t]=new b(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){v[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),v.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){v[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});function z(e,t,r,s){var a=v.hasOwnProperty(t)?v[t]:null;(a!==null?a.type!==0:s||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(T(t,r,a,s)&&(r=null),s||a===null?N(t)&&(r===null?e.removeAttribute(t):e.setAttribute(t,""+r)):a.mustUseProperty?e[a.propertyName]=r===null?a.type===3?!1:"":r:(t=a.attributeName,s=a.attributeNamespace,r===null?e.removeAttribute(t):(a=a.type,r=a===3||a===4&&r===!0?"":""+r,s?e.setAttributeNS(s,t,r):e.setAttribute(t,r))))}var F=l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,V=Symbol.for("react.element"),M=Symbol.for("react.portal"),J=Symbol.for("react.fragment"),H=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),Ne=Symbol.for("react.provider"),re=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),xe=Symbol.for("react.suspense_list"),be=Symbol.for("react.memo"),je=Symbol.for("react.lazy"),ne=Symbol.for("react.offscreen"),I=Symbol.iterator;function ie(e){return e===null||typeof e!="object"?null:(e=I&&e[I]||e["@@iterator"],typeof e=="function"?e:null)}var B=Object.assign,C;function O(e){if(C===void 0)try{throw Error()}catch(r){var t=r.stack.trim().match(/\n( *(at )?)/);C=t&&t[1]||""}return`
34`+C+e}var ye=!1;function G(e,t){if(!e||ye)return"";ye=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch($){var s=$}Reflect.construct(e,[],t)}else{try{t.call()}catch($){s=$}e.call(t.prototype)}else{try{throw Error()}catch($){s=$}e()}}catch($){if($&&s&&typeof $.stack=="string"){for(var a=$.stack.split(`
35`),i=s.stack.split(`
36`),u=a.length-1,y=i.length-1;1<=u&&0<=y&&a[u]!==i[y];)y--;for(;1<=u&&0<=y;u--,y--)if(a[u]!==i[y]){if(u!==1||y!==1)do if(u--,y--,0>y||a[u]!==i[y]){var S=`
37`+a[u].replace(" at new "," at ");return e.displayName&&S.includes("<anonymous>")&&(S=S.replace("<anonymous>",e.displayName)),S}while(1<=u&&0<=y);break}}}finally{ye=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?O(e):""}function fe(e){switch(e.tag){case 5:return O(e.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return e=G(e.type,!1),e;case 11:return e=G(e.type.render,!1),e;case 1:return e=G(e.type,!0),e;default:return""}}function ke(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case J:return"Fragment";case M:return"Portal";case W:return"Profiler";case H:return"StrictMode";case Z:return"Suspense";case xe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case re:return(e.displayName||"Context")+".Consumer";case Ne:return(e._context.displayName||"Context")+".Provider";case ee:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case be:return t=e.displayName||null,t!==null?t:ke(e.type)||"Memo";case je:t=e._payload,e=e._init;try{return ke(e(t))}catch{}}return null}function _e(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=t.render,e=e.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 ke(t);case 8:return t===H?"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(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function U(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function he(e){var t=te(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var a=r.get,i=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(u){s=""+u,i.call(this,u)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return s},setValue:function(u){s=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ge(e){e._valueTracker||(e._valueTracker=he(e))}function Pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),s="";return e&&(s=te(e)?e.checked?"true":"false":e.value),e=s,e!==r?(t.setValue(e),!0):!1}function Ge(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Me(e,t){var r=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??e._wrapperState.initialChecked})}function ze(e,t){var r=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;r=U(t.value!=null?t.value:r),e._wrapperState={initialChecked:s,initialValue:r,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Ve(e,t){t=t.checked,t!=null&&z(e,"checked",t,!1)}function Ke(e,t){Ve(e,t);var r=U(t.value),s=t.type;if(r!=null)s==="number"?(r===0&&e.value===""||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?$e(e,t.type,r):t.hasOwnProperty("defaultValue")&&$e(e,t.type,U(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pe(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}r=e.name,r!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,r!==""&&(e.name=r)}function $e(e,t,r){(t!=="number"||Ge(e.ownerDocument)!==e)&&(r==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}var De=Array.isArray;function Xe(e,t,r,s){if(e=e.options,t){t={};for(var a=0;a<r.length;a++)t["$"+r[a]]=!0;for(r=0;r<e.length;r++)a=t.hasOwnProperty("$"+e[r].value),e[r].selected!==a&&(e[r].selected=a),a&&s&&(e[r].defaultSelected=!0)}else{for(r=""+U(r),t=null,a=0;a<e.length;a++){if(e[a].value===r){e[a].selected=!0,s&&(e[a].defaultSelected=!0);return}t!==null||e[a].disabled||(t=e[a])}t!==null&&(t.selected=!0)}}function wt(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(c(91));return B({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function vn(e,t){var r=t.value;if(r==null){if(r=t.children,t=t.defaultValue,r!=null){if(t!=null)throw Error(c(92));if(De(r)){if(1<r.length)throw Error(c(93));r=r[0]}t=r}t==null&&(t=""),r=t}e._wrapperState={initialValue:U(r)}}function st(e,t){var r=U(t.value),s=U(t.defaultValue);r!=null&&(r=""+r,r!==e.value&&(e.value=r),t.defaultValue==null&&e.defaultValue!==r&&(e.defaultValue=r)),s!=null&&(e.defaultValue=""+s)}function gr(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function oa(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 sn(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?oa(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var yr,an=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,r,s,a){MSApp.execUnsafeLocalFunction(function(){return e(t,r,s,a)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(yr=yr||document.createElement("div"),yr.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jt(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=t;return}}e.textContent=t}var Kt={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},ln=["Webkit","ms","Moz","O"];Object.keys(Kt).forEach(function(e){ln.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Kt[t]=Kt[e]})});function wn(e,t,r){return t==null||typeof t=="boolean"||t===""?"":r||typeof t!="number"||t===0||Kt.hasOwnProperty(e)&&Kt[e]?(""+t).trim():t+"px"}function vr(e,t){e=e.style;for(var r in t)if(t.hasOwnProperty(r)){var s=r.indexOf("--")===0,a=wn(r,t[r],s);r==="float"&&(r="cssFloat"),s?e.setProperty(r,a):e[r]=a}}var Ml=B({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 wr(e,t){if(t){if(Ml[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(c(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(c(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(c(61))}if(t.style!=null&&typeof t.style!="object")throw Error(c(62))}}function Pt(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";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 it=null;function Jt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var on=null,Nt=null,St=null;function jr(e){if(e=Os(e)){if(typeof on!="function")throw Error(c(280));var t=e.stateNode;t&&(t=Ma(t),on(e.stateNode,e.type,t))}}function ca(e){Nt?St?St.push(e):St=[e]:Nt=e}function ds(){if(Nt){var e=Nt,t=St;if(St=Nt=null,jr(e),t)for(e=0;e<t.length;e++)jr(t[e])}}function fs(e,t){return e(t)}function ua(){}var qt=!1;function Nr(e,t,r){if(qt)return e(t,r);qt=!0;try{return fs(e,t,r)}finally{qt=!1,(Nt!==null||St!==null)&&(ua(),ds())}}function Jn(e,t){var r=e.stateNode;if(r===null)return null;var s=Ma(r);if(s===null)return null;r=s[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":(s=!s.disabled)||(e=e.type,s=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!s;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(c(231,t,typeof r));return r}var Sr=!1;if(p)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){Sr=!0}}),window.addEventListener("test",jn,jn),window.removeEventListener("test",jn,jn)}catch{Sr=!1}function $l(e,t,r,s,a,i,u,y,S){var $=Array.prototype.slice.call(arguments,3);try{t.apply(r,$)}catch(K){this.onError(K)}}var Gt=!1,Nn=null,kr=!1,br=null,qn={onError:function(e){Gt=!0,Nn=e}};function cn(e,t,r,s,a,i,u,y,S){Gt=!1,Nn=null,$l.apply(qn,arguments)}function Er(e,t,r,s,a,i,u,y,S){if(cn.apply(this,arguments),Gt){if(Gt){var $=Nn;Gt=!1,Nn=null}else throw Error(c(198));kr||(kr=!0,br=$)}}function Xt(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(r=t.return),e=t.return;while(e)}return t.tag===3?r:null}function da(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function ms(e){if(Xt(e)!==e)throw Error(c(188))}function ps(e){var t=e.alternate;if(!t){if(t=Xt(e),t===null)throw Error(c(188));return t!==e?null:e}for(var r=e,s=t;;){var a=r.return;if(a===null)break;var i=a.alternate;if(i===null){if(s=a.return,s!==null){r=s;continue}break}if(a.child===i.child){for(i=a.child;i;){if(i===r)return ms(a),e;if(i===s)return ms(a),t;i=i.sibling}throw Error(c(188))}if(r.return!==s.return)r=a,s=i;else{for(var u=!1,y=a.child;y;){if(y===r){u=!0,r=a,s=i;break}if(y===s){u=!0,s=a,r=i;break}y=y.sibling}if(!u){for(y=i.child;y;){if(y===r){u=!0,r=i,s=a;break}if(y===s){u=!0,s=i,r=a;break}y=y.sibling}if(!u)throw Error(c(189))}}if(r.alternate!==s)throw Error(c(190))}if(r.tag!==3)throw Error(c(188));return r.stateNode.current===r?e:t}function Cr(e){return e=ps(e),e!==null?fa(e):null}function fa(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=fa(e);if(t!==null)return t;e=e.sibling}return null}var hs=o.unstable_scheduleCallback,Gn=o.unstable_cancelCallback,ma=o.unstable_shouldYield,_r=o.unstable_requestPaint,He=o.unstable_now,Dl=o.unstable_getCurrentPriorityLevel,xs=o.unstable_ImmediatePriority,pa=o.unstable_UserBlockingPriority,Tr=o.unstable_NormalPriority,zl=o.unstable_LowPriority,gs=o.unstable_IdlePriority,Lr=null,Mt=null;function Rl(e){if(Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(Lr,e,void 0,(e.current.flags&128)===128)}catch{}}var kt=Math.clz32?Math.clz32:xa,ha=Math.log,Re=Math.LN2;function xa(e){return e>>>=0,e===0?32:31-(ha(e)/Re|0)|0}var Pr=64,Mr=4194304;function Sn(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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function $r(e,t){var r=e.pendingLanes;if(r===0)return 0;var s=0,a=e.suspendedLanes,i=e.pingedLanes,u=r&268435455;if(u!==0){var y=u&~a;y!==0?s=Sn(y):(i&=u,i!==0&&(s=Sn(i)))}else u=r&~a,u!==0?s=Sn(u):i!==0&&(s=Sn(i));if(s===0)return 0;if(t!==0&&t!==s&&(t&a)===0&&(a=s&-s,i=t&-t,a>=i||a===16&&(i&4194240)!==0))return t;if((s&4)!==0&&(s|=r&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0<t;)r=31-kt(t),a=1<<r,s|=e[r],t&=~a;return s}function kn(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;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ys(e,t){for(var r=e.suspendedLanes,s=e.pingedLanes,a=e.expirationTimes,i=e.pendingLanes;0<i;){var u=31-kt(i),y=1<<u,S=a[u];S===-1?((y&r)===0||(y&s)!==0)&&(a[u]=kn(y,t)):S<=t&&(e.expiredLanes|=y),i&=~y}}function vs(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function ws(){var e=Pr;return Pr<<=1,(Pr&4194240)===0&&(Pr=64),e}function Dr(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function bn(e,t,r){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-kt(t),e[t]=r}function js(e,t){var r=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 s=e.eventTimes;for(e=e.expirationTimes;0<r;){var a=31-kt(r),i=1<<a;t[a]=0,s[a]=-1,e[a]=-1,r&=~i}}function A(e,t){var r=e.entangledLanes|=t;for(e=e.entanglements;r;){var s=31-kt(r),a=1<<s;a&t|e[s]&t&&(e[s]|=t),r&=~a}}var Q=0;function ae(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var Ee,Ye,En,Xn,Zn,Ns=!1,ga=[],Cn=null,_n=null,Tn=null,Ss=new Map,ks=new Map,Ln=[],Cf="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 Yo(e,t){switch(e){case"focusin":case"focusout":Cn=null;break;case"dragenter":case"dragleave":_n=null;break;case"mouseover":case"mouseout":Tn=null;break;case"pointerover":case"pointerout":Ss.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ks.delete(t.pointerId)}}function bs(e,t,r,s,a,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:r,eventSystemFlags:s,nativeEvent:i,targetContainers:[a]},t!==null&&(t=Os(t),t!==null&&Ye(t)),e):(e.eventSystemFlags|=s,t=e.targetContainers,a!==null&&t.indexOf(a)===-1&&t.push(a),e)}function _f(e,t,r,s,a){switch(t){case"focusin":return Cn=bs(Cn,e,t,r,s,a),!0;case"dragenter":return _n=bs(_n,e,t,r,s,a),!0;case"mouseover":return Tn=bs(Tn,e,t,r,s,a),!0;case"pointerover":var i=a.pointerId;return Ss.set(i,bs(Ss.get(i)||null,e,t,r,s,a)),!0;case"gotpointercapture":return i=a.pointerId,ks.set(i,bs(ks.get(i)||null,e,t,r,s,a)),!0}return!1}function Qo(e){var t=er(e.target);if(t!==null){var r=Xt(t);if(r!==null){if(t=r.tag,t===13){if(t=da(r),t!==null){e.blockedOn=t,Zn(e.priority,function(){En(r)});return}}else if(t===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ya(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var r=Il(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(r===null){r=e.nativeEvent;var s=new r.constructor(r.type,r);it=s,r.target.dispatchEvent(s),it=null}else return t=Os(r),t!==null&&Ye(t),e.blockedOn=r,!1;t.shift()}return!0}function Ko(e,t,r){ya(e)&&r.delete(t)}function Tf(){Ns=!1,Cn!==null&&ya(Cn)&&(Cn=null),_n!==null&&ya(_n)&&(_n=null),Tn!==null&&ya(Tn)&&(Tn=null),Ss.forEach(Ko),ks.forEach(Ko)}function Es(e,t){e.blockedOn===t&&(e.blockedOn=null,Ns||(Ns=!0,o.unstable_scheduleCallback(o.unstable_NormalPriority,Tf)))}function Cs(e){function t(a){return Es(a,e)}if(0<ga.length){Es(ga[0],e);for(var r=1;r<ga.length;r++){var s=ga[r];s.blockedOn===e&&(s.blockedOn=null)}}for(Cn!==null&&Es(Cn,e),_n!==null&&Es(_n,e),Tn!==null&&Es(Tn,e),Ss.forEach(t),ks.forEach(t),r=0;r<Ln.length;r++)s=Ln[r],s.blockedOn===e&&(s.blockedOn=null);for(;0<Ln.length&&(r=Ln[0],r.blockedOn===null);)Qo(r),r.blockedOn===null&&Ln.shift()}var zr=F.ReactCurrentBatchConfig,va=!0;function Lf(e,t,r,s){var a=Q,i=zr.transition;zr.transition=null;try{Q=1,Al(e,t,r,s)}finally{Q=a,zr.transition=i}}function Pf(e,t,r,s){var a=Q,i=zr.transition;zr.transition=null;try{Q=4,Al(e,t,r,s)}finally{Q=a,zr.transition=i}}function Al(e,t,r,s){if(va){var a=Il(e,t,r,s);if(a===null)ti(e,t,s,wa,r),Yo(e,s);else if(_f(a,e,t,r,s))s.stopPropagation();else if(Yo(e,s),t&4&&-1<Cf.indexOf(e)){for(;a!==null;){var i=Os(a);if(i!==null&&Ee(i),i=Il(e,t,r,s),i===null&&ti(e,t,s,wa,r),i===a)break;a=i}a!==null&&s.stopPropagation()}else ti(e,t,s,null,r)}}var wa=null;function Il(e,t,r,s){if(wa=null,e=Jt(s),e=er(e),e!==null)if(t=Xt(e),t===null)e=null;else if(r=t.tag,r===13){if(e=da(t),e!==null)return e;e=null}else if(r===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return wa=e,null}function Jo(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(Dl()){case xs:return 1;case pa:return 4;case Tr:case zl:return 16;case gs:return 536870912;default:return 16}default:return 16}}var Pn=null,Ol=null,ja=null;function qo(){if(ja)return ja;var e,t=Ol,r=t.length,s,a="value"in Pn?Pn.value:Pn.textContent,i=a.length;for(e=0;e<r&&t[e]===a[e];e++);var u=r-e;for(s=1;s<=u&&t[r-s]===a[i-s];s++);return ja=a.slice(e,1<s?1-s:void 0)}function Na(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Sa(){return!0}function Go(){return!1}function bt(e){function t(r,s,a,i,u){this._reactName=r,this._targetInst=a,this.type=s,this.nativeEvent=i,this.target=u,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(r=e[y],this[y]=r?r(i):i[y]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Sa:Go,this.isPropagationStopped=Go,this}return B(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Sa)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Sa)},persist:function(){},isPersistent:Sa}),t}var Rr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ul=bt(Rr),_s=B({},Rr,{view:0,detail:0}),Mf=bt(_s),Fl,Hl,Ts,ka=B({},_s,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bl,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ts&&(Ts&&e.type==="mousemove"?(Fl=e.screenX-Ts.screenX,Hl=e.screenY-Ts.screenY):Hl=Fl=0,Ts=e),Fl)},movementY:function(e){return"movementY"in e?e.movementY:Hl}}),Xo=bt(ka),$f=B({},ka,{dataTransfer:0}),Df=bt($f),zf=B({},_s,{relatedTarget:0}),Wl=bt(zf),Rf=B({},Rr,{animationName:0,elapsedTime:0,pseudoElement:0}),Af=bt(Rf),If=B({},Rr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Of=bt(If),Uf=B({},Rr,{data:0}),Zo=bt(Uf),Ff={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hf={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"},Wf={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bf(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Wf[e])?!!t[e]:!1}function Bl(){return Bf}var Vf=B({},_s,{key:function(e){if(e.key){var t=Ff[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Na(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Hf[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bl,charCode:function(e){return e.type==="keypress"?Na(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Na(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Yf=bt(Vf),Qf=B({},ka,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ec=bt(Qf),Kf=B({},_s,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bl}),Jf=bt(Kf),qf=B({},Rr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Gf=bt(qf),Xf=B({},ka,{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}),Zf=bt(Xf),em=[9,13,27,32],Vl=p&&"CompositionEvent"in window,Ls=null;p&&"documentMode"in document&&(Ls=document.documentMode);var tm=p&&"TextEvent"in window&&!Ls,tc=p&&(!Vl||Ls&&8<Ls&&11>=Ls),nc=" ",rc=!1;function sc(e,t){switch(e){case"keyup":return em.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ac(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ar=!1;function nm(e,t){switch(e){case"compositionend":return ac(t);case"keypress":return t.which!==32?null:(rc=!0,nc);case"textInput":return e=t.data,e===nc&&rc?null:e;default:return null}}function rm(e,t){if(Ar)return e==="compositionend"||!Vl&&sc(e,t)?(e=qo(),ja=Ol=Pn=null,Ar=!1,e):null;switch(e){case"paste":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 tc&&t.locale!=="ko"?null:t.data;default:return null}}var sm={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 lc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!sm[e.type]:t==="textarea"}function ic(e,t,r,s){ca(s),t=Ta(t,"onChange"),0<t.length&&(r=new Ul("onChange","change",null,r,s),e.push({event:r,listeners:t}))}var Ps=null,Ms=null;function am(e){bc(e,0)}function ba(e){var t=Hr(e);if(Pe(t))return e}function lm(e,t){if(e==="change")return t}var oc=!1;if(p){var Yl;if(p){var Ql="oninput"in document;if(!Ql){var cc=document.createElement("div");cc.setAttribute("oninput","return;"),Ql=typeof cc.oninput=="function"}Yl=Ql}else Yl=!1;oc=Yl&&(!document.documentMode||9<document.documentMode)}function uc(){Ps&&(Ps.detachEvent("onpropertychange",dc),Ms=Ps=null)}function dc(e){if(e.propertyName==="value"&&ba(Ms)){var t=[];ic(t,Ms,e,Jt(e)),Nr(am,t)}}function im(e,t,r){e==="focusin"?(uc(),Ps=t,Ms=r,Ps.attachEvent("onpropertychange",dc)):e==="focusout"&&uc()}function om(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ba(Ms)}function cm(e,t){if(e==="click")return ba(t)}function um(e,t){if(e==="input"||e==="change")return ba(t)}function dm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ut=typeof Object.is=="function"?Object.is:dm;function $s(e,t){if(Ut(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var r=Object.keys(e),s=Object.keys(t);if(r.length!==s.length)return!1;for(s=0;s<r.length;s++){var a=r[s];if(!w.call(t,a)||!Ut(e[a],t[a]))return!1}return!0}function fc(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function mc(e,t){var r=fc(e);e=0;for(var s;r;){if(r.nodeType===3){if(s=e+r.textContent.length,e<=t&&s>=t)return{node:r,offset:t-e};e=s}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=fc(r)}}function pc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function hc(){for(var e=window,t=Ge();t instanceof e.HTMLIFrameElement;){try{var r=typeof t.contentWindow.location.href=="string"}catch{r=!1}if(r)e=t.contentWindow;else break;t=Ge(e.document)}return t}function Kl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function fm(e){var t=hc(),r=e.focusedElem,s=e.selectionRange;if(t!==r&&r&&r.ownerDocument&&pc(r.ownerDocument.documentElement,r)){if(s!==null&&Kl(r)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in r)r.selectionStart=t,r.selectionEnd=Math.min(e,r.value.length);else if(e=(t=r.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=r.textContent.length,i=Math.min(s.start,a);s=s.end===void 0?i:Math.min(s.end,a),!e.extend&&i>s&&(a=s,s=i,i=a),a=mc(r,i);var u=mc(r,s);a&&u&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),i>s?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=r;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r<t.length;r++)e=t[r],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var mm=p&&"documentMode"in document&&11>=document.documentMode,Ir=null,Jl=null,Ds=null,ql=!1;function xc(e,t,r){var s=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;ql||Ir==null||Ir!==Ge(s)||(s=Ir,"selectionStart"in s&&Kl(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),Ds&&$s(Ds,s)||(Ds=s,s=Ta(Jl,"onSelect"),0<s.length&&(t=new Ul("onSelect","select",null,t,r),e.push({event:t,listeners:s}),t.target=Ir)))}function Ea(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Or={animationend:Ea("Animation","AnimationEnd"),animationiteration:Ea("Animation","AnimationIteration"),animationstart:Ea("Animation","AnimationStart"),transitionend:Ea("Transition","TransitionEnd")},Gl={},gc={};p&&(gc=document.createElement("div").style,"AnimationEvent"in window||(delete Or.animationend.animation,delete Or.animationiteration.animation,delete Or.animationstart.animation),"TransitionEvent"in window||delete Or.transitionend.transition);function Ca(e){if(Gl[e])return Gl[e];if(!Or[e])return e;var t=Or[e],r;for(r in t)if(t.hasOwnProperty(r)&&r in gc)return Gl[e]=t[r];return e}var yc=Ca("animationend"),vc=Ca("animationiteration"),wc=Ca("animationstart"),jc=Ca("transitionend"),Nc=new Map,Sc="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 Mn(e,t){Nc.set(e,t),x(t,[e])}for(var Xl=0;Xl<Sc.length;Xl++){var Zl=Sc[Xl],pm=Zl.toLowerCase(),hm=Zl[0].toUpperCase()+Zl.slice(1);Mn(pm,"on"+hm)}Mn(yc,"onAnimationEnd"),Mn(vc,"onAnimationIteration"),Mn(wc,"onAnimationStart"),Mn("dblclick","onDoubleClick"),Mn("focusin","onFocus"),Mn("focusout","onBlur"),Mn(jc,"onTransitionEnd"),m("onMouseEnter",["mouseout","mouseover"]),m("onMouseLeave",["mouseout","mouseover"]),m("onPointerEnter",["pointerout","pointerover"]),m("onPointerLeave",["pointerout","pointerover"]),x("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),x("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),x("onBeforeInput",["compositionend","keypress","textInput","paste"]),x("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),x("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),x("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zs="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(" "),xm=new Set("cancel close invalid load scroll toggle".split(" ").concat(zs));function kc(e,t,r){var s=e.type||"unknown-event";e.currentTarget=r,Er(s,t,void 0,e),e.currentTarget=null}function bc(e,t){t=(t&4)!==0;for(var r=0;r<e.length;r++){var s=e[r],a=s.event;s=s.listeners;e:{var i=void 0;if(t)for(var u=s.length-1;0<=u;u--){var y=s[u],S=y.instance,$=y.currentTarget;if(y=y.listener,S!==i&&a.isPropagationStopped())break e;kc(a,y,$),i=S}else for(u=0;u<s.length;u++){if(y=s[u],S=y.instance,$=y.currentTarget,y=y.listener,S!==i&&a.isPropagationStopped())break e;kc(a,y,$),i=S}}}if(kr)throw e=br,kr=!1,br=null,e}function Ie(e,t){var r=t[ii];r===void 0&&(r=t[ii]=new Set);var s=e+"__bubble";r.has(s)||(Ec(t,e,2,!1),r.add(s))}function ei(e,t,r){var s=0;t&&(s|=4),Ec(r,e,s,t)}var _a="_reactListening"+Math.random().toString(36).slice(2);function Rs(e){if(!e[_a]){e[_a]=!0,d.forEach(function(r){r!=="selectionchange"&&(xm.has(r)||ei(r,!1,e),ei(r,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[_a]||(t[_a]=!0,ei("selectionchange",!1,t))}}function Ec(e,t,r,s){switch(Jo(t)){case 1:var a=Lf;break;case 4:a=Pf;break;default:a=Al}r=a.bind(null,t,r,e),a=void 0,!Sr||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(a=!0),s?a!==void 0?e.addEventListener(t,r,{capture:!0,passive:a}):e.addEventListener(t,r,!0):a!==void 0?e.addEventListener(t,r,{passive:a}):e.addEventListener(t,r,!1)}function ti(e,t,r,s,a){var i=s;if((t&1)===0&&(t&2)===0&&s!==null)e:for(;;){if(s===null)return;var u=s.tag;if(u===3||u===4){var y=s.stateNode.containerInfo;if(y===a||y.nodeType===8&&y.parentNode===a)break;if(u===4)for(u=s.return;u!==null;){var S=u.tag;if((S===3||S===4)&&(S=u.stateNode.containerInfo,S===a||S.nodeType===8&&S.parentNode===a))return;u=u.return}for(;y!==null;){if(u=er(y),u===null)return;if(S=u.tag,S===5||S===6){s=i=u;continue e}y=y.parentNode}}s=s.return}Nr(function(){var $=i,K=Jt(r),q=[];e:{var Y=Nc.get(e);if(Y!==void 0){var se=Ul,ce=e;switch(e){case"keypress":if(Na(r)===0)break e;case"keydown":case"keyup":se=Yf;break;case"focusin":ce="focus",se=Wl;break;case"focusout":ce="blur",se=Wl;break;case"beforeblur":case"afterblur":se=Wl;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=Xo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Df;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=Jf;break;case yc:case vc:case wc:se=Af;break;case jc:se=Gf;break;case"scroll":se=Mf;break;case"wheel":se=Zf;break;case"copy":case"cut":case"paste":se=Of;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=ec}var de=(t&4)!==0,Je=!de&&e==="scroll",L=de?Y!==null?Y+"Capture":null:Y;de=[];for(var E=$,P;E!==null;){P=E;var X=P.stateNode;if(P.tag===5&&X!==null&&(P=X,L!==null&&(X=Jn(E,L),X!=null&&de.push(As(E,X,P)))),Je)break;E=E.return}0<de.length&&(Y=new se(Y,ce,null,r,K),q.push({event:Y,listeners:de}))}}if((t&7)===0){e:{if(Y=e==="mouseover"||e==="pointerover",se=e==="mouseout"||e==="pointerout",Y&&r!==it&&(ce=r.relatedTarget||r.fromElement)&&(er(ce)||ce[un]))break e;if((se||Y)&&(Y=K.window===K?K:(Y=K.ownerDocument)?Y.defaultView||Y.parentWindow:window,se?(ce=r.relatedTarget||r.toElement,se=$,ce=ce?er(ce):null,ce!==null&&(Je=Xt(ce),ce!==Je||ce.tag!==5&&ce.tag!==6)&&(ce=null)):(se=null,ce=$),se!==ce)){if(de=Xo,X="onMouseLeave",L="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(de=ec,X="onPointerLeave",L="onPointerEnter",E="pointer"),Je=se==null?Y:Hr(se),P=ce==null?Y:Hr(ce),Y=new de(X,E+"leave",se,r,K),Y.target=Je,Y.relatedTarget=P,X=null,er(K)===$&&(de=new de(L,E+"enter",ce,r,K),de.target=P,de.relatedTarget=Je,X=de),Je=X,se&&ce)t:{for(de=se,L=ce,E=0,P=de;P;P=Ur(P))E++;for(P=0,X=L;X;X=Ur(X))P++;for(;0<E-P;)de=Ur(de),E--;for(;0<P-E;)L=Ur(L),P--;for(;E--;){if(de===L||L!==null&&de===L.alternate)break t;de=Ur(de),L=Ur(L)}de=null}else de=null;se!==null&&Cc(q,Y,se,de,!1),ce!==null&&Je!==null&&Cc(q,Je,ce,de,!0)}}e:{if(Y=$?Hr($):window,se=Y.nodeName&&Y.nodeName.toLowerCase(),se==="select"||se==="input"&&Y.type==="file")var me=lm;else if(lc(Y))if(oc)me=um;else{me=om;var ve=im}else(se=Y.nodeName)&&se.toLowerCase()==="input"&&(Y.type==="checkbox"||Y.type==="radio")&&(me=cm);if(me&&(me=me(e,$))){ic(q,me,r,K);break e}ve&&ve(e,Y,$),e==="focusout"&&(ve=Y._wrapperState)&&ve.controlled&&Y.type==="number"&&$e(Y,"number",Y.value)}switch(ve=$?Hr($):window,e){case"focusin":(lc(ve)||ve.contentEditable==="true")&&(Ir=ve,Jl=$,Ds=null);break;case"focusout":Ds=Jl=Ir=null;break;case"mousedown":ql=!0;break;case"contextmenu":case"mouseup":case"dragend":ql=!1,xc(q,r,K);break;case"selectionchange":if(mm)break;case"keydown":case"keyup":xc(q,r,K)}var we;if(Vl)e:{switch(e){case"compositionstart":var Se="onCompositionStart";break e;case"compositionend":Se="onCompositionEnd";break e;case"compositionupdate":Se="onCompositionUpdate";break e}Se=void 0}else Ar?sc(e,r)&&(Se="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(Se="onCompositionStart");Se&&(tc&&r.locale!=="ko"&&(Ar||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&Ar&&(we=qo()):(Pn=K,Ol="value"in Pn?Pn.value:Pn.textContent,Ar=!0)),ve=Ta($,Se),0<ve.length&&(Se=new Zo(Se,e,null,r,K),q.push({event:Se,listeners:ve}),we?Se.data=we:(we=ac(r),we!==null&&(Se.data=we)))),(we=tm?nm(e,r):rm(e,r))&&($=Ta($,"onBeforeInput"),0<$.length&&(K=new Zo("onBeforeInput","beforeinput",null,r,K),q.push({event:K,listeners:$}),K.data=we))}bc(q,t)})}function As(e,t,r){return{instance:e,listener:t,currentTarget:r}}function Ta(e,t){for(var r=t+"Capture",s=[];e!==null;){var a=e,i=a.stateNode;a.tag===5&&i!==null&&(a=i,i=Jn(e,r),i!=null&&s.unshift(As(e,i,a)),i=Jn(e,t),i!=null&&s.push(As(e,i,a))),e=e.return}return s}function Ur(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Cc(e,t,r,s,a){for(var i=t._reactName,u=[];r!==null&&r!==s;){var y=r,S=y.alternate,$=y.stateNode;if(S!==null&&S===s)break;y.tag===5&&$!==null&&(y=$,a?(S=Jn(r,i),S!=null&&u.unshift(As(r,S,y))):a||(S=Jn(r,i),S!=null&&u.push(As(r,S,y)))),r=r.return}u.length!==0&&e.push({event:t,listeners:u})}var gm=/\r\n?/g,ym=/\u0000|\uFFFD/g;function _c(e){return(typeof e=="string"?e:""+e).replace(gm,`
38`).replace(ym,"")}function La(e,t,r){if(t=_c(t),_c(e)!==t&&r)throw Error(c(425))}function Pa(){}var ni=null,ri=null;function si(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ai=typeof setTimeout=="function"?setTimeout:void 0,vm=typeof clearTimeout=="function"?clearTimeout:void 0,Tc=typeof Promise=="function"?Promise:void 0,wm=typeof queueMicrotask=="function"?queueMicrotask:typeof Tc<"u"?function(e){return Tc.resolve(null).then(e).catch(jm)}:ai;function jm(e){setTimeout(function(){throw e})}function li(e,t){var r=t,s=0;do{var a=r.nextSibling;if(e.removeChild(r),a&&a.nodeType===8)if(r=a.data,r==="/$"){if(s===0){e.removeChild(a),Cs(t);return}s--}else r!=="$"&&r!=="$?"&&r!=="$!"||s++;r=a}while(r);Cs(t)}function $n(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Lc(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"){if(t===0)return e;t--}else r==="/$"&&t++}e=e.previousSibling}return null}var Fr=Math.random().toString(36).slice(2),Zt="__reactFiber$"+Fr,Is="__reactProps$"+Fr,un="__reactContainer$"+Fr,ii="__reactEvents$"+Fr,Nm="__reactListeners$"+Fr,Sm="__reactHandles$"+Fr;function er(e){var t=e[Zt];if(t)return t;for(var r=e.parentNode;r;){if(t=r[un]||r[Zt]){if(r=t.alternate,t.child!==null||r!==null&&r.child!==null)for(e=Lc(e);e!==null;){if(r=e[Zt])return r;e=Lc(e)}return t}e=r,r=e.parentNode}return null}function Os(e){return e=e[Zt]||e[un],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Hr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(c(33))}function Ma(e){return e[Is]||null}var oi=[],Wr=-1;function Dn(e){return{current:e}}function Oe(e){0>Wr||(e.current=oi[Wr],oi[Wr]=null,Wr--)}function Ae(e,t){Wr++,oi[Wr]=e.current,e.current=t}var zn={},ot=Dn(zn),pt=Dn(!1),tr=zn;function Br(e,t){var r=e.type.contextTypes;if(!r)return zn;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var a={},i;for(i in r)a[i]=t[i];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a
vendor: 9,727 bytes, line 38
38),a}function ht(e){return e=e.childContextTypes,e!=null}function $a(){Oe(pt),Oe(ot)}function Pc(e,t,r){if(ot.current!==zn)throw Error(c(168));Ae(ot,t),Ae(pt,r)}function Mc(e,t,r){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return r;s=s.getChildContext();for(var a in s)if(!(a in t))throw Error(c(108,_e(e)||"Unknown",a));return B({},r,s)}function Da(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||zn,tr=ot.current,Ae(ot,e),Ae(pt,pt.current),!0}function $c(e,t,r){var s=e.stateNode;if(!s)throw Error(c(169));r?(e=Mc(e,t,tr),s.__reactInternalMemoizedMergedChildContext=e,Oe(pt),Oe(ot),Ae(ot,e)):Oe(pt),Ae(pt,r)}var dn=null,za=!1,ci=!1;function Dc(e){dn===null?dn=[e]:dn.push(e)}function km(e){za=!0,Dc(e)}function Rn(){if(!ci&&dn!==null){ci=!0;var e=0,t=Q;try{var r=dn;for(Q=1;e<r.length;e++){var s=r[e];do s=s(!0);while(s!==null)}dn=null,za=!1}catch(a){throw dn!==null&&(dn=dn.slice(e+1)),hs(xs,Rn),a}finally{Q=t,ci=!1}}return null}var Vr=[],Yr=0,Ra=null,Aa=0,$t=[],Dt=0,nr=null,fn=1,mn="";function rr(e,t){Vr[Yr++]=Aa,Vr[Yr++]=Ra,Ra=e,Aa=t}function zc(e,t,r){$t[Dt++]=fn,$t[Dt++]=mn,$t[Dt++]=nr,nr=e;var s=fn;e=mn;var a=32-kt(s)-1;s&=~(1<<a),r+=1;var i=32-kt(t)+a;if(30<i){var u=a-a%5;i=(s&(1<<u)-1).toString(32),s>>=u,a-=u,fn=1<<32-kt(t)+a|r<<a|s,mn=i+e}else fn=1<<i|r<<a|s,mn=e}function ui(e){e.return!==null&&(rr(e,1),zc(e,1,0))}function di(e){for(;e===Ra;)Ra=Vr[--Yr],Vr[Yr]=null,Aa=Vr[--Yr],Vr[Yr]=null;for(;e===nr;)nr=$t[--Dt],$t[Dt]=null,mn=$t[--Dt],$t[Dt]=null,fn=$t[--Dt],$t[Dt]=null}var Et=null,Ct=null,Fe=!1,Ft=null;function Rc(e,t){var r=It(5,null,null,0);r.elementType="DELETED",r.stateNode=t,r.return=e,t=e.deletions,t===null?(e.deletions=[r],e.flags|=16):t.push(r)}function Ac(e,t){switch(e.tag){case 5:var r=e.type;return t=t.nodeType!==1||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,Et=e,Ct=$n(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Et=e,Ct=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(r=nr!==null?{id:fn,overflow:mn}:null,e.memoizedState={dehydrated:t,treeContext:r,retryLane:1073741824},r=It(18,null,null,0),r.stateNode=t,r.return=e,e.child=r,Et=e,Ct=null,!0):!1;default:return!1}}function fi(e){return(e.mode&1)!==0&&(e.flags&128)===0}function mi(e){if(Fe){var t=Ct;if(t){var r=t;if(!Ac(e,t)){if(fi(e))throw Error(c(418));t=$n(r.nextSibling);var s=Et;t&&Ac(e,t)?Rc(s,r):(e.flags=e.flags&-4097|2,Fe=!1,Et=e)}}else{if(fi(e))throw Error(c(418));e.flags=e.flags&-4097|2,Fe=!1,Et=e}}}function Ic(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Et=e}function Ia(e){if(e!==Et)return!1;if(!Fe)return Ic(e),Fe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!si(e.type,e.memoizedProps)),t&&(t=Ct)){if(fi(e))throw Oc(),Error(c(418));for(;t;)Rc(e,t),t=$n(t.nextSibling)}if(Ic(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"){if(t===0){Ct=$n(e.nextSibling);break e}t--}else r!=="$"&&r!=="$!"&&r!=="$?"||t++}e=e.nextSibling}Ct=null}}else Ct=Et?$n(e.stateNode.nextSibling):null;return!0}function Oc(){for(var e=Ct;e;)e=$n(e.nextSibling)}function Qr(){Ct=Et=null,Fe=!1}function pi(e){Ft===null?Ft=[e]:Ft.push(e)}var bm=F.ReactCurrentBatchConfig;function Us(e,t,r){if(e=r.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(r._owner){if(r=r._owner,r){if(r.tag!==1)throw Error(c(309));var s=r.stateNode}if(!s)throw Error(c(147,e));var a=s,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(u){var y=a.refs;u===null?delete y[i]:y[i]=u},t._stringRef=i,t)}if(typeof e!="string")throw Error(c(284));if(!r._owner)throw Error(c(290,e))}return e}function Oa(e,t){throw e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Uc(e){var t=e._init;return t(e._payload)}function Fc(e){function t(L,E){if(e){var P=L.deletions;P===null?(L.deletions=[E],L.flags|=16):P.push(E)}}function r(L,E){if(!e)return null;for(;E!==null;)t(L,E),E=E.sibling;return null}function s(L,E){for(L=new Map;E!==null;)E.key!==null?L.set(E.key,E):L.set(E.index,E),E=E.sibling;return L}function a(L,E){return L=Bn(L,E),L.index=0,L.sibling=null,L}function i(L,E,P){return L.index=P,e?(P=L.alternate,P!==null?(P=P.index,P<E?(L.flags|=2,E):P):(L.flags|=2,E)):(L.flags|=1048576,E)}function u(L){return e&&L.alternate===null&&(L.flags|=2),L}function y(L,E,P,X){return E===null||E.tag!==6?(E=ao(P,L.mode,X),E.return=L,E):(E=a(E,P),E.return=L,E)}function S(L,E,P,X){var me=P.type;return me===J?K(L,E,P.props.children,X,P.key):E!==null&&(E.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===je&&Uc(me)===E.type)?(X=a(E,P.props),X.ref=Us(L,E,P),X.return=L,X):(X=cl(P.type,P.key,P.props,null,L.mode,X),X.ref=Us(L,E,P),X.return=L,X)}function $(L,E,P,X){return E===null||E.tag!==4||E.stateNode.containerInfo!==P.containerInfo||E.stateNode.implementation!==P.implementation?(E=lo(P,L.mode,X),E.return=L,E):(E=a(E,P.children||[]),E.return=L,E)}function K(L,E,P,X,me){return E===null||E.tag!==7?(E=dr(P,L.mode,X,me),E.return=L,E):(E=a(E,P),E.return=L,E)}function q(L,E,P){if(typeof E=="string"&&E!==""||typeof E=="number")return E=ao(""+E,L.mode,P),E.return=L,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case V:return P=cl(E.type,E.key,E.props,null,L.mode,P),P.ref=Us(L,null,E),P.return=L,P;case M:return E=lo(E,L.mode,P),E.return=L,E;case je:var X=E._init;return q(L,X(E._payload),P)}if(De(E)||ie(E))return E=dr(E,L.mode,P,null),E.return=L,E;Oa(L,E)}return null}function Y(L,E,P,X){var me=E!==null?E.key:null;if(typeof P=="string"&&P!==""||typeof P=="number")return me!==null?null:y(L,E,""+P,X);if(typeof P=="object"&&P!==null){switch(P.$$typeof){case V:return P.key===me?S(L,E,P,X):null;case M:return P.key===me?$(L,E,P,X):null;case je:return me=P._init,Y(L,E,me(P._payload),X)}if(De(P)||ie(P))return me!==null?null:K(L,E,P,X,null);Oa(L,P)}return null}function se(L,E,P,X,me){if(typeof X=="string"&&X!==""||typeof X=="number")return L=L.get(P)||null,y(E,L,""+X,me);if(typeof X=="object"&&X!==null){switch(X.$$typeof){case V:return L=L.get(X.key===null?P:X.key)||null,S(E,L,X,me);case M:return L=L.get(X.key===null?P:X.key)||null,$(E,L,X,me);case je:var ve=X._init;return se(L,E,P,ve(X._payload),me)}if(De(X)||ie(X))return L=L.get(P)||null,K(E,L,X,me,null);Oa(E,X)}return null}function ce(L,E,P,X){for(var me=null,ve=null,we=E,Se=E=0,rt=null;we!==null&&Se<P.length;Se++){we.index>Se?(rt=we,we=null):rt=we.sibling;var Le=Y(L,we,P[Se],X);if(Le===null){we===null&&(we=rt);break}e&&we&&Le.alternate===null&&t(L,we),E=i(Le,E,Se),ve===null?me=Le:ve.sibling=Le,ve=Le,we=rt}if(Se===P.length)return r(L,we),Fe&&rr(L,Se),me;if(we===null){for(;Se<P.length;Se++)we=q(L,P[Se],X),we!==null&&(E=i(we,E,Se),ve===null?me=we:ve.sibling=we,ve=we);return Fe&&rr(L,Se),me}for(we=s(L,we);Se<P.length;Se++)rt=se(we,L,Se,P[Se],X),rt!==null&&(e&&rt.alternate!==null&&we.delete(rt.key===null?Se:rt.key),E=i(rt,E,Se),ve===null?me=rt:ve.sibling=rt,ve=rt);return e&&we.forEach(function(Vn){return t(L,Vn)}),Fe&&rr(L,Se),me}function de(L,E,P,X){var me=ie(P);if(typeof me!="function")throw Error(c(150));if(P=me.call(P),P==null)throw Error(c(151));for(var ve=me=null,we=E,Se=E=0,rt=null,Le=P.next();we!==null&&!Le.done;Se++,Le=P.next()){we.index>Se?(rt=we,we=null):rt=we.sibling;var Vn=Y(L,we,Le.value,X);if(Vn===null){we===null&&(we=rt);break}e&&we&&Vn.alternate===null&&t(L,we),E=i(Vn,E,Se),ve===null?me=Vn:ve.sibling=Vn,ve=Vn,we=rt}if(Le.done)return r(L,we),Fe&&rr(L,Se),me;if(we===null){for(;!Le.done;Se++,Le=P.next())Le=q(L,Le.value,X),Le!==null&&(E=i(Le,E,Se),ve===null?me=Le:ve.sibling=Le,ve=Le);return Fe&&rr(L,Se),me}for(we=s(L,we);!Le.done;Se++,Le=P.next())Le=se(we,L,Se,Le.value,X),Le!==null&&(e&&Le.alternate!==null&&we.delete(Le.key===null?Se:Le.key),E=i(Le,E,Se),ve===null?me=Le:ve.sibling=Le,ve=Le);return e&&we.forEach(function(sp){return t(L,sp)}),Fe&&rr(L,Se),me}function Je(L,E,P,X){if(typeof P=="object"&&P!==null&&P.type===J&&P.key===null&&(P=P.props.children),typeof P=="object"&&P!==null){switch(P.$$typeof){case V:e:{for(var me=P.key,ve=E;ve!==null;){if(ve.key===me){if(me=P.type,me===J){if(ve.tag===7){r(L,ve.sibling),E=a(ve,P.props.children),E.return=L,L=E;break e}}else if(ve.elementType===me||typeof me=="object"&&me!==null&&me.$$typeof===je&&Uc(me)===ve.type){r(L,ve.sibling),E=a(ve,P.props),E.ref=Us(L,ve,P),E.return=L,L=E;break e}r(L,ve);break}else t(L,ve);ve=ve.sibling}P.type===J?(E=dr(P.props.children,L.mode,X,P.key),E.return=L,L=E):(X=cl(P.type,P.key,P.props,null,L.mode,X),X.ref=Us(L,E,P),X.return=L,L=X)}return u(L);case M:e:{for(ve=P.key;E!==null;){if(E.key===ve)if(E.tag===4&&E.stateNode.containerInfo===P.containerInfo&&E.stateNode.implementation===P.implementation){r(L,E.sibling),E=a(E,P.children||[]),E.return=L,L=E;break e}else{r(L,E);break}else t(L,E);E=E.sibling}E=lo(P,L.mode,X),E.return=L,L=E}return u(L);case je:return ve=P._init,Je(L,E,ve(P._payload),X)}if(De(P))return ce(L,E,P,X);if(ie(P))return de(L,E,P,X);Oa(L,P)}return typeof P=="string"&&P!==""||typeof P=="number"?(P=""+P,E!==null&&E.tag===6?(r(L,E.sibling),E=a(E,P),E.return=L,L=E):(r(L,E),E=ao(P,L.mode,X),E.return=L,L=E),u(L)):r(L,E)}return Je}var Kr=Fc(!0),Hc=Fc(!1),Ua=Dn(null),Fa=null,Jr=null,hi=null;function xi(){hi=Jr=Fa=null}function gi(e){var t=Ua.current;Oe(Ua),e._currentValue=t}function yi(e,t,r){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===r)break;e=e.return}}
vendor: 6,050 bytes, line 38
38function qr(e,t){Fa=e,hi=Jr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(xt=!0),e.firstContext=null)}function zt(e){var t=e._currentValue;if(hi!==e)if(e={context:e,memoizedValue:t,next:null},Jr===null){if(Fa===null)throw Error(c(308));Jr=e,Fa.dependencies={lanes:0,firstContext:e}}else Jr=Jr.next=e;return t}var sr=null;function vi(e){sr===null?sr=[e]:sr.push(e)}function Wc(e,t,r,s){var a=t.interleaved;return a===null?(r.next=r,vi(t)):(r.next=a.next,a.next=r),t.interleaved=r,pn(e,s)}function pn(e,t){e.lanes|=t;var r=e.alternate;for(r!==null&&(r.lanes|=t),r=e,e=e.return;e!==null;)e.childLanes|=t,r=e.alternate,r!==null&&(r.childLanes|=t),r=e,e=e.return;return r.tag===3?r.stateNode:null}var An=!1;function wi(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Bc(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 hn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function In(e,t,r){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,(Te&2)!==0){var a=s.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t,pn(e,r)}return a=s.interleaved,a===null?(t.next=t,vi(s)):(t.next=a.next,a.next=t),s.interleaved=t,pn(e,r)}function Ha(e,t,r){if(t=t.updateQueue,t!==null&&(t=t.shared,(r&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,A(e,r)}}function Vc(e,t){var r=e.updateQueue,s=e.alternate;if(s!==null&&(s=s.updateQueue,r===s)){var a=null,i=null;if(r=r.firstBaseUpdate,r!==null){do{var u={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};i===null?a=i=u:i=i.next=u,r=r.next}while(r!==null);i===null?a=i=t:i=i.next=t}else a=i=t;r={baseState:s.baseState,firstBaseUpdate:a,lastBaseUpdate:i,shared:s.shared,effects:s.effects},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function Wa(e,t,r,s){var a=e.updateQueue;An=!1;var i=a.firstBaseUpdate,u=a.lastBaseUpdate,y=a.shared.pending;if(y!==null){a.shared.pending=null;var S=y,$=S.next;S.next=null,u===null?i=$:u.next=$,u=S;var K=e.alternate;K!==null&&(K=K.updateQueue,y=K.lastBaseUpdate,y!==u&&(y===null?K.firstBaseUpdate=$:y.next=$,K.lastBaseUpdate=S))}if(i!==null){var q=a.baseState;u=0,K=$=S=null,y=i;do{var Y=y.lane,se=y.eventTime;if((s&Y)===Y){K!==null&&(K=K.next={eventTime:se,lane:0,tag:y.tag,payload:y.payload,callback:y.callback,next:null});e:{var ce=e,de=y;switch(Y=t,se=r,de.tag){case 1:if(ce=de.payload,typeof ce=="function"){q=ce.call(se,q,Y);break e}q=ce;break e;case 3:ce.flags=ce.flags&-65537|128;case 0:if(ce=de.payload,Y=typeof ce=="function"?ce.call(se,q,Y):ce,Y==null)break e;q=B({},q,Y);break e;case 2:An=!0}}y.callback!==null&&y.lane!==0&&(e.flags|=64,Y=a.effects,Y===null?a.effects=[y]:Y.push(y))}else se={eventTime:se,lane:Y,tag:y.tag,payload:y.payload,callback:y.callback,next:null},K===null?($=K=se,S=q):K=K.next=se,u|=Y;if(y=y.next,y===null){if(y=a.shared.pending,y===null)break;Y=y,y=Y.next,Y.next=null,a.lastBaseUpdate=Y,a.shared.pending=null}}while(!0);if(K===null&&(S=q),a.baseState=S,a.firstBaseUpdate=$,a.lastBaseUpdate=K,t=a.shared.interleaved,t!==null){a=t;do u|=a.lane,a=a.next;while(a!==t)}else i===null&&(a.shared.lanes=0);ir|=u,e.lanes=u,e.memoizedState=q}}function Yc(e,t,r){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var s=e[t],a=s.callback;if(a!==null){if(s.callback=null,s=r,typeof a!="function")throw Error(c(191,a));a.call(s)}}}var Fs={},en=Dn(Fs),Hs=Dn(Fs),Ws=Dn(Fs);function ar(e){if(e===Fs)throw Error(c(174));return e}function ji(e,t){switch(Ae(Ws,t),Ae(Hs,e),Ae(en,Fs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:sn(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=sn(t,e)}Oe(en),Ae(en,t)}function Gr(){Oe(en),Oe(Hs),Oe(Ws)}function Qc(e){ar(Ws.current);var t=ar(en.current),r=sn(t,e.type);t!==r&&(Ae(Hs,e),Ae(en,r))}function Ni(e){Hs.current===e&&(Oe(en),Oe(Hs))}var We=Dn(0);function Ba(e){for(var t=e;t!==null;){if(t.tag===13){var r=t.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Si=[];function ki(){for(var e=0;e<Si.length;e++)Si[e]._workInProgressVersionPrimary=null;Si.length=0}var Va=F.ReactCurrentDispatcher,bi=F.ReactCurrentBatchConfig,lr=0,Be=null,Ze=null,tt=null,Ya=!1,Bs=!1,Vs=0,Em=0;function ct(){throw Error(c(321))}function Ei(e,t){if(t===null)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!Ut(e[r],t[r]))return!1;return!0}function Ci(e,t,r,s,a,i){if(lr=i,Be=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Va.current=e===null||e.memoizedState===null?Lm:Pm,e=r(s,a),Bs){i=0;do{if(Bs=!1,Vs=0,25<=i)throw Error(c(301));i+=1,tt=Ze=null,t.updateQueue=null,Va.current=Mm,e=r(s,a)}while(Bs)}if(Va.current=Ja,t=Ze!==null&&Ze.next!==null,lr=0,tt=Ze=Be=null,Ya=!1,t)throw Error(c(300));return e}function _i(){var e=Vs!==0;return Vs=0,e}function tn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return tt===null?Be.memoizedState=tt=e:tt=tt.next=e,tt}function Rt(){if(Ze===null){var e=Be.alternate;e=e!==null?e.memoizedState:null}else e=Ze.next;var t=tt===null?Be.memoizedState:tt.next;if(t!==null)tt=t,Ze=e;else{if(e===null)throw Error(c(310));Ze=e,e={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},tt===null?Be.memoizedState=tt=e:tt=tt.next=e}return tt}function Ys(e,t){return typeof t=="function"?t(e):t}function Ti(e){var t=Rt(),r=t.queue;if(r===null)throw Error(c(311));r.lastRenderedReducer=e;
vendor: 5,701 bytes, line 38
38var s=Ze,a=s.baseQueue,i=r.pending;if(i!==null){if(a!==null){var u=a.next;a.next=i.next,i.next=u}s.baseQueue=a=i,r.pending=null}if(a!==null){i=a.next,s=s.baseState;var y=u=null,S=null,$=i;do{var K=$.lane;if((lr&K)===K)S!==null&&(S=S.next={lane:0,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),s=$.hasEagerState?$.eagerState:e(s,$.action);else{var q={lane:K,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null};S===null?(y=S=q,u=s):S=S.next=q,Be.lanes|=K,ir|=K}$=$.next}while($!==null&&$!==i);S===null?u=s:S.next=y,Ut(s,t.memoizedState)||(xt=!0),t.memoizedState=s,t.baseState=u,t.baseQueue=S,r.lastRenderedState=s}if(e=r.interleaved,e!==null){a=e;do i=a.lane,Be.lanes|=i,ir|=i,a=a.next;while(a!==e)}else a===null&&(r.lanes=0);return[t.memoizedState,r.dispatch]}function Li(e){var t=Rt(),r=t.queue;if(r===null)throw Error(c(311));r.lastRenderedReducer=e;var s=r.dispatch,a=r.pending,i=t.memoizedState;if(a!==null){r.pending=null;var u=a=a.next;do i=e(i,u.action),u=u.next;while(u!==a);Ut(i,t.memoizedState)||(xt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),r.lastRenderedState=i}return[i,s]}function Kc(){}function Jc(e,t){var r=Be,s=Rt(),a=t(),i=!Ut(s.memoizedState,a);if(i&&(s.memoizedState=a,xt=!0),s=s.queue,Pi(Xc.bind(null,r,s,e),[e]),s.getSnapshot!==t||i||tt!==null&&tt.memoizedState.tag&1){if(r.flags|=2048,Qs(9,Gc.bind(null,r,s,a,t),void 0,null),nt===null)throw Error(c(349));(lr&30)!==0||qc(r,t,a)}return a}function qc(e,t,r){e.flags|=16384,e={getSnapshot:t,value:r},t=Be.updateQueue,t===null?(t={lastEffect:null,stores:null},Be.updateQueue=t,t.stores=[e]):(r=t.stores,r===null?t.stores=[e]:r.push(e))}function Gc(e,t,r,s){t.value=r,t.getSnapshot=s,Zc(t)&&eu(e)}function Xc(e,t,r){return r(function(){Zc(t)&&eu(e)})}function Zc(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!Ut(e,r)}catch{return!0}}function eu(e){var t=pn(e,1);t!==null&&Vt(t,e,1,-1)}function tu(e){var t=tn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ys,lastRenderedState:e},t.queue=e,e=e.dispatch=Tm.bind(null,Be,e),[t.memoizedState,e]}function Qs(e,t,r,s){return e={tag:e,create:t,destroy:r,deps:s,next:null},t=Be.updateQueue,t===null?(t={lastEffect:null,stores:null},Be.updateQueue=t,t.lastEffect=e.next=e):(r=t.lastEffect,r===null?t.lastEffect=e.next=e:(s=r.next,r.next=e,e.next=s,t.lastEffect=e)),e}function nu(){return Rt().memoizedState}function Qa(e,t,r,s){var a=tn();Be.flags|=e,a.memoizedState=Qs(1|t,r,void 0,s===void 0?null:s)}function Ka(e,t,r,s){var a=Rt();s=s===void 0?null:s;var i=void 0;if(Ze!==null){var u=Ze.memoizedState;if(i=u.destroy,s!==null&&Ei(s,u.deps)){a.memoizedState=Qs(t,r,i,s);return}}Be.flags|=e,a.memoizedState=Qs(1|t,r,i,s)}function ru(e,t){return Qa(8390656,8,e,t)}function Pi(e,t){return Ka(2048,8,e,t)}function su(e,t){return Ka(4,2,e,t)}function au(e,t){return Ka(4,4,e,t)}function lu(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function iu(e,t,r){return r=r!=null?r.concat([e]):null,Ka(4,4,lu.bind(null,t,e),r)}function Mi(){}function ou(e,t){var r=Rt();t=t===void 0?null:t;var s=r.memoizedState;return s!==null&&t!==null&&Ei(t,s[1])?s[0]:(r.memoizedState=[e,t],e)}function cu(e,t){var r=Rt();t=t===void 0?null:t;var s=r.memoizedState;return s!==null&&t!==null&&Ei(t,s[1])?s[0]:(e=e(),r.memoizedState=[e,t],e)}function uu(e,t,r){return(lr&21)===0?(e.baseState&&(e.baseState=!1,xt=!0),e.memoizedState=r):(Ut(r,t)||(r=ws(),Be.lanes|=r,ir|=r,e.baseState=!0),t)}function Cm(e,t){var r=Q;Q=r!==0&&4>r?r:4,e(!0);var s=bi.transition;bi.transition={};try{e(!1),t()}finally{Q=r,bi.transition=s}}function du(){return Rt().memoizedState}function _m(e,t,r){var s=Hn(e);if(r={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null},fu(e))mu(t,r);else if(r=Wc(e,t,r,s),r!==null){var a=mt();Vt(r,e,s,a),pu(r,t,s)}}function Tm(e,t,r){var s=Hn(e),a={lane:s,action:r,hasEagerState:!1,eagerState:null,next:null};if(fu(e))mu(t,a);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var u=t.lastRenderedState,y=i(u,r);if(a.hasEagerState=!0,a.eagerState=y,Ut(y,u)){var S=t.interleaved;S===null?(a.next=a,vi(t)):(a.next=S.next,S.next=a),t.interleaved=a;return}}catch{}finally{}r=Wc(e,t,a,s),r!==null&&(a=mt(),Vt(r,e,s,a),pu(r,t,s))}}function fu(e){var t=e.alternate;return e===Be||t!==null&&t===Be}function mu(e,t){Bs=Ya=!0;var r=e.pending;r===null?t.next=t:(t.next=r.next,r.next=t),e.pending=t}function pu(e,t,r){if((r&4194240)!==0){var s=t.lanes;s&=e.pendingLanes,r|=s,t.lanes=r,A(e,r)}}var Ja={readContext:zt,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},Lm={readContext:zt,useCallback:function(e,t){return tn().memoizedState=[e,t===void 0?null:t],e},useContext:zt,useEffect:ru,useImperativeHandle:function(e,t,r){return r=r!=null?r.concat([e]):null,Qa(4194308,4,lu.bind(null,t,e),r)},useLayoutEffect:function(e,t){return Qa(4194308,4,e,t)},useInsertionEffect:function(e,t){return Qa(4,2,e,t)},useMemo:function(e,t){var r=tn();return t=t===void 0?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var s=tn();return t=r!==void 0?r(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=_m.bind(null,Be,e),[s.memoizedState,e]}
vendor: 7,454 bytes, lines 38-40
38,useRef:function(e){var t=tn();return e={current:e},t.memoizedState=e},useState:tu,useDebugValue:Mi,useDeferredValue:function(e){return tn().memoizedState=e},useTransition:function(){var e=tu(!1),t=e[0];return e=Cm.bind(null,e[1]),tn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,r){var s=Be,a=tn();if(Fe){if(r===void 0)throw Error(c(407));r=r()}else{if(r=t(),nt===null)throw Error(c(349));(lr&30)!==0||qc(s,t,r)}a.memoizedState=r;var i={value:r,getSnapshot:t};return a.queue=i,ru(Xc.bind(null,s,i,e),[e]),s.flags|=2048,Qs(9,Gc.bind(null,s,i,r,t),void 0,null),r},useId:function(){var e=tn(),t=nt.identifierPrefix;if(Fe){var r=mn,s=fn;r=(s&~(1<<32-kt(s)-1)).toString(32)+r,t=":"+t+"R"+r,r=Vs++,0<r&&(t+="H"+r.toString(32)),t+=":"}else r=Em++,t=":"+t+"r"+r.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Pm={readContext:zt,useCallback:ou,useContext:zt,useEffect:Pi,useImperativeHandle:iu,useInsertionEffect:su,useLayoutEffect:au,useMemo:cu,useReducer:Ti,useRef:nu,useState:function(){return Ti(Ys)},useDebugValue:Mi,useDeferredValue:function(e){var t=Rt();return uu(t,Ze.memoizedState,e)},useTransition:function(){var e=Ti(Ys)[0],t=Rt().memoizedState;return[e,t]},useMutableSource:Kc,useSyncExternalStore:Jc,useId:du,unstable_isNewReconciler:!1},Mm={readContext:zt,useCallback:ou,useContext:zt,useEffect:Pi,useImperativeHandle:iu,useInsertionEffect:su,useLayoutEffect:au,useMemo:cu,useReducer:Li,useRef:nu,useState:function(){return Li(Ys)},useDebugValue:Mi,useDeferredValue:function(e){var t=Rt();return Ze===null?t.memoizedState=e:uu(t,Ze.memoizedState,e)},useTransition:function(){var e=Li(Ys)[0],t=Rt().memoizedState;return[e,t]},useMutableSource:Kc,useSyncExternalStore:Jc,useId:du,unstable_isNewReconciler:!1};function Ht(e,t){if(e&&e.defaultProps){t=B({},t),e=e.defaultProps;for(var r in e)t[r]===void 0&&(t[r]=e[r]);return t}return t}function $i(e,t,r,s){t=e.memoizedState,r=r(s,t),r=r==null?t:B({},t,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var qa={isMounted:function(e){return(e=e._reactInternals)?Xt(e)===e:!1},enqueueSetState:function(e,t,r){e=e._reactInternals;var s=mt(),a=Hn(e),i=hn(s,a);i.payload=t,r!=null&&(i.callback=r),t=In(e,i,a),t!==null&&(Vt(t,e,a,s),Ha(t,e,a))},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var s=mt(),a=Hn(e),i=hn(s,a);i.tag=1,i.payload=t,r!=null&&(i.callback=r),t=In(e,i,a),t!==null&&(Vt(t,e,a,s),Ha(t,e,a))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=mt(),s=Hn(e),a=hn(r,s);a.tag=2,t!=null&&(a.callback=t),t=In(e,a,s),t!==null&&(Vt(t,e,s,r),Ha(t,e,s))}};function hu(e,t,r,s,a,i,u){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(s,i,u):t.prototype&&t.prototype.isPureReactComponent?!$s(r,s)||!$s(a,i):!0}function xu(e,t,r){var s=!1,a=zn,i=t.contextType;return typeof i=="object"&&i!==null?i=zt(i):(a=ht(t)?tr:ot.current,s=t.contextTypes,i=(s=s!=null)?Br(e,a):zn),t=new t(r,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=qa,e.stateNode=t,t._reactInternals=e,s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=a,e.__reactInternalMemoizedMaskedChildContext=i),t}function gu(e,t,r,s){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(r,s),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(r,s),t.state!==e&&qa.enqueueReplaceState(t,t.state,null)}function Di(e,t,r,s){var a=e.stateNode;a.props=r,a.state=e.memoizedState,a.refs={},wi(e);var i=t.contextType;typeof i=="object"&&i!==null?a.context=zt(i):(i=ht(t)?tr:ot.current,a.context=Br(e,i)),a.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&($i(e,t,i,r),a.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof a.getSnapshotBeforeUpdate=="function"||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(t=a.state,typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount(),t!==a.state&&qa.enqueueReplaceState(a,a.state,null),Wa(e,r,a,s),a.state=e.memoizedState),typeof a.componentDidMount=="function"&&(e.flags|=4194308)}function Xr(e,t){try{var r="",s=t;do r+=fe(s),s=s.return;while(s);var a=r}catch(i){a=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:e,source:t,stack:a,digest:null}}function zi(e,t,r){return{value:e,source:null,stack:r??null,digest:t??null}}function Ri(e,t){try{console.error(t.value)}catch(r){setTimeout(function(){throw r})}}var $m=typeof WeakMap=="function"?WeakMap:Map;function yu(e,t,r){r=hn(-1,r),r.tag=3,r.payload={element:null};var s=t.value;return r.callback=function(){rl||(rl=!0,Gi=s),Ri(e,t)},r}function vu(e,t,r){r=hn(-1,r),r.tag=3;var s=e.type.getDerivedStateFromError;if(typeof s=="function"){var a=t.value;r.payload=function(){return s(a)},r.callback=function(){Ri(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(r.callback=function(){Ri(e,t),typeof s!="function"&&(Un===null?Un=new Set([this]):Un.add(this));var u=t.stack;this.componentDidCatch(t.value,{componentStack:u!==null?u:""})}),r}function wu(e,t,r){var s=e.pingCache;if(s===null){s=e.pingCache=new $m;var a=new Set;s.set(t,a)}else a=s.get(t),a===void 0&&(a=new Set,s.set(t,a));a.has(r)||(a.add(r),e=Qm.bind(null,e,t,r),t.then(e,e))}function ju(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Nu(e,t,r,s,a){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(t=hn(-1,1),t.tag=2,In(r,t,1))),r.lanes|=1),e):(e.flags|=65536,e.lanes=a,e)}var Dm=F.ReactCurrentOwner,xt=!1;function ft(e,t,r,s){t.child=e===null?Hc(t,null,r,s):Kr(t,e.child,r,s)}function Su(e,t,r,s,a){r=r.render;var i=t.ref;return qr(t,a),s=Ci(e,t,r,s,i,a),r=_i(),e!==null&&!xt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,xn(e,t,a)):(Fe&&r&&ui(t),t.flags|=1,ft(e,t,s,a),t.child)}function ku(e,t,r,s,a){if(e===null){var i=r.type;return typeof i=="function"&&!so(i)&&i.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(t.tag=15,t.type=i,bu(e,t,i,s,a)):(e=cl(r.type,null,s,t,t.mode,a),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,(e.lanes&a)===0){var u=i.memoizedProps;if(r=r.compare,r=r!==null?r:$s,r(u,s)&&e.ref===t.ref)return xn(e,t,a)}return t.flags|=1,e=Bn(i,s),e.ref=t.ref,e.return=t,t.child=e}function bu(e,t,r,s,a){if(e!==null){var i=e.memoizedProps;if($s(i,s)&&e.ref===t.ref)if(xt=!1,t.pendingProps=s=i,(e.lanes&a)!==0)(e.flags&131072)!==0&&(xt=!0);else return t.lanes=e.lanes,xn(e,t,a)}return Ai(e,t,r,s,a)}function Eu(e,t,r){var s=t.pendingProps,a=s.children,i=e!==null?e.memoizedState:null;if(s.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ae(es,_t),_t|=r;else{if((r&1073741824)===0)return e=i!==null?i.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ae(es,_t),_t|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},s=i!==null?i.baseLanes:r,Ae(es,_t),_t|=s}else i!==null?(s=i.baseLanes|r,t.memoizedState=null):s=r,Ae(es,_t),_t|=s;return ft(e,t,a,r),t.child}function Cu(e,t){var r=t.ref;(e===null&&r!==null||e!==null&&e.ref!==r)&&(t.flags|=512,t.flags|=2097152)}
vendor: 10,646 bytes, line 40
40function Ai(e,t,r,s,a){var i=ht(r)?tr:ot.current;return i=Br(t,i),qr(t,a),r=Ci(e,t,r,s,i,a),s=_i(),e!==null&&!xt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a,xn(e,t,a)):(Fe&&s&&ui(t),t.flags|=1,ft(e,t,r,a),t.child)}function _u(e,t,r,s,a){if(ht(r)){var i=!0;Da(t)}else i=!1;if(qr(t,a),t.stateNode===null)Xa(e,t),xu(t,r,s),Di(t,r,s,a),s=!0;else if(e===null){var u=t.stateNode,y=t.memoizedProps;u.props=y;var S=u.context,$=r.contextType;typeof $=="object"&&$!==null?$=zt($):($=ht(r)?tr:ot.current,$=Br(t,$));var K=r.getDerivedStateFromProps,q=typeof K=="function"||typeof u.getSnapshotBeforeUpdate=="function";q||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(y!==s||S!==$)&&gu(t,u,s,$),An=!1;var Y=t.memoizedState;u.state=Y,Wa(t,s,u,a),S=t.memoizedState,y!==s||Y!==S||pt.current||An?(typeof K=="function"&&($i(t,r,K,s),S=t.memoizedState),(y=An||hu(t,r,y,s,Y,S,$))?(q||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=s,t.memoizedState=S),u.props=s,u.state=S,u.context=$,s=y):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),s=!1)}else{u=t.stateNode,Bc(e,t),y=t.memoizedProps,$=t.type===t.elementType?y:Ht(t.type,y),u.props=$,q=t.pendingProps,Y=u.context,S=r.contextType,typeof S=="object"&&S!==null?S=zt(S):(S=ht(r)?tr:ot.current,S=Br(t,S));var se=r.getDerivedStateFromProps;(K=typeof se=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(y!==q||Y!==S)&&gu(t,u,s,S),An=!1,Y=t.memoizedState,u.state=Y,Wa(t,s,u,a);var ce=t.memoizedState;y!==q||Y!==ce||pt.current||An?(typeof se=="function"&&($i(t,r,se,s),ce=t.memoizedState),($=An||hu(t,r,$,s,Y,ce,S)||!1)?(K||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(s,ce,S),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(s,ce,S)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),t.memoizedProps=s,t.memoizedState=ce),u.props=s,u.state=ce,u.context=S,s=$):(typeof u.componentDidUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&Y===e.memoizedState||(t.flags|=1024),s=!1)}return Ii(e,t,r,s,i,a)}function Ii(e,t,r,s,a,i){Cu(e,t);var u=(t.flags&128)!==0;if(!s&&!u)return a&&$c(t,r,!1),xn(e,t,i);s=t.stateNode,Dm.current=t;var y=u&&typeof r.getDerivedStateFromError!="function"?null:s.render();return t.flags|=1,e!==null&&u?(t.child=Kr(t,e.child,null,i),t.child=Kr(t,null,y,i)):ft(e,t,y,i),t.memoizedState=s.state,a&&$c(t,r,!0),t.child}function Tu(e){var t=e.stateNode;t.pendingContext?Pc(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Pc(e,t.context,!1),ji(e,t.containerInfo)}function Lu(e,t,r,s,a){return Qr(),pi(a),t.flags|=256,ft(e,t,r,s),t.child}var Oi={dehydrated:null,treeContext:null,retryLane:0};function Ui(e){return{baseLanes:e,cachePool:null,transitions:null}}function Pu(e,t,r){var s=t.pendingProps,a=We.current,i=!1,u=(t.flags&128)!==0,y;if((y=u)||(y=e!==null&&e.memoizedState===null?!1:(a&2)!==0),y?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(a|=1),Ae(We,a&1),e===null)return mi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(u=s.children,e=s.fallback,i?(s=t.mode,i=t.child,u={mode:"hidden",children:u},(s&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=u):i=ul(u,s,0,null),e=dr(e,s,r,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ui(r),t.memoizedState=Oi,e):Fi(t,u));if(a=e.memoizedState,a!==null&&(y=a.dehydrated,y!==null))return zm(e,t,u,s,y,a,r);if(i){i=s.fallback,u=t.mode,a=e.child,y=a.sibling;var S={mode:"hidden",children:s.children};return(u&1)===0&&t.child!==a?(s=t.child,s.childLanes=0,s.pendingProps=S,t.deletions=null):(s=Bn(a,S),s.subtreeFlags=a.subtreeFlags&14680064),y!==null?i=Bn(y,i):(i=dr(i,u,r,null),i.flags|=2),i.return=t,s.return=t,s.sibling=i,t.child=s,s=i,i=t.child,u=e.child.memoizedState,u=u===null?Ui(r):{baseLanes:u.baseLanes|r,cachePool:null,transitions:u.transitions},i.memoizedState=u,i.childLanes=e.childLanes&~r,t.memoizedState=Oi,s}return i=e.child,e=i.sibling,s=Bn(i,{mode:"visible",children:s.children}),(t.mode&1)===0&&(s.lanes=r),s.return=t,s.sibling=null,e!==null&&(r=t.deletions,r===null?(t.deletions=[e],t.flags|=16):r.push(e)),t.child=s,t.memoizedState=null,s}function Fi(e,t){return t=ul({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Ga(e,t,r,s){return s!==null&&pi(s),Kr(t,e.child,null,r),e=Fi(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function zm(e,t,r,s,a,i,u){if(r)return t.flags&256?(t.flags&=-257,s=zi(Error(c(422))),Ga(e,t,u,s)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=s.fallback,a=t.mode,s=ul({mode:"visible",children:s.children},a,0,null),i=dr(i,a,u,null),i.flags|=2,s.return=t,i.return=t,s.sibling=i,t.child=s,(t.mode&1)!==0&&Kr(t,e.child,null,u),t.child.memoizedState=Ui(u),t.memoizedState=Oi,i);if((t.mode&1)===0)return Ga(e,t,u,null);if(a.data==="$!"){if(s=a.nextSibling&&a.nextSibling.dataset,s)var y=s.dgst;return s=y,i=Error(c(419)),s=zi(i,s,void 0),Ga(e,t,u,s)}if(y=(u&e.childLanes)!==0,xt||y){if(s=nt,s!==null){switch(u&-u){case 4:a=2;break;case 16:a=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:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(s.suspendedLanes|u))!==0?0:a,a!==0&&a!==i.retryLane&&(i.retryLane=a,pn(e,a),Vt(s,e,a,-1))}return ro(),s=zi(Error(c(421))),Ga(e,t,u,s)}return a.data==="$?"?(t.flags|=128,t.child=e.child,t=Km.bind(null,e),a._reactRetry=t,null):(e=i.treeContext,Ct=$n(a.nextSibling),Et=t,Fe=!0,Ft=null,e!==null&&($t[Dt++]=fn,$t[Dt++]=mn,$t[Dt++]=nr,fn=e.id,mn=e.overflow,nr=t),t=Fi(t,s.children),t.flags|=4096,t)}function Mu(e,t,r){e.lanes|=t;var s=e.alternate;s!==null&&(s.lanes|=t),yi(e.return,t,r)}function Hi(e,t,r,s,a){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:s,tail:r,tailMode:a}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=s,i.tail=r,i.tailMode=a)}function $u(e,t,r){var s=t.pendingProps,a=s.revealOrder,i=s.tail;if(ft(e,t,s.children,r),s=We.current,(s&2)!==0)s=s&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Mu(e,r,t);else if(e.tag===19)Mu(e,r,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}s&=1}if(Ae(We,s),(t.mode&1)===0)t.memoizedState=null;else switch(a){case"forwards":for(r=t.child,a=null;r!==null;)e=r.alternate,e!==null&&Ba(e)===null&&(a=r),r=r.sibling;r=a,r===null?(a=t.child,t.child=null):(a=r.sibling,r.sibling=null),Hi(t,!1,a,r,i);break;case"backwards":for(r=null,a=t.child,t.child=null;a!==null;){if(e=a.alternate,e!==null&&Ba(e)===null){t.child=a;break}e=a.sibling,a.sibling=r,r=a,a=e}Hi(t,!0,r,null,i);break;case"together":Hi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Xa(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function xn(e,t,r){if(e!==null&&(t.dependencies=e.dependencies),ir|=t.lanes,(r&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,r=Bn(e,e.pendingProps),t.child=r,r.return=t;e.sibling!==null;)e=e.sibling,r=r.sibling=Bn(e,e.pendingProps),r.return=t;r.sibling=null}return t.child}function Rm(e,t,r){switch(t.tag){case 3:Tu(t),Qr();break;case 5:Qc(t);break;case 1:ht(t.type)&&Da(t);break;case 4:ji(t,t.stateNode.containerInfo);break;case 10:var s=t.type._context,a=t.memoizedProps.value;Ae(Ua,s._currentValue),s._currentValue=a;break;case 13:if(s=t.memoizedState,s!==null)return s.dehydrated!==null?(Ae(We,We.current&1),t.flags|=128,null):(r&t.child.childLanes)!==0?Pu(e,t,r):(Ae(We,We.current&1),e=xn(e,t,r),e!==null?e.sibling:null);Ae(We,We.current&1);break;case 19:if(s=(r&t.childLanes)!==0,(e.flags&128)!==0){if(s)return $u(e,t,r);t.flags|=128}if(a=t.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),Ae(We,We.current),s)break;return null;case 22:case 23:return t.lanes=0,Eu(e,t,r)}return xn(e,t,r)}var Du,Wi,zu,Ru;Du=function(e,t){for(var r=t.child;r!==null;){if(r.tag===5||r.tag===6)e.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===t)break;for(;r.sibling===null;){if(r.return===null||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Wi=function(){},zu=function(e,t,r,s){var a=e.memoizedProps;if(a!==s){e=t.stateNode,ar(en.current);var i=null;switch(r){case"input":a=Me(e,a),s=Me(e,s),i=[];break;case"select":a=B({},a,{value:void 0}),s=B({},s,{value:void 0}),i=[];break;case"textarea":a=wt(e,a),s=wt(e,s),i=[];break;default:typeof a.onClick!="function"&&typeof s.onClick=="function"&&(e.onclick=Pa)}wr(r,s);var u;r=null;for($ in a)if(!s.hasOwnProperty($)&&a.hasOwnProperty($)&&a[$]!=null)if($==="style"){var y=a[$];for(u in y)y.hasOwnProperty(u)&&(r||(r={}),r[u]="")}else $!=="dangerouslySetInnerHTML"&&$!=="children"&&$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&$!=="autoFocus"&&(h.hasOwnProperty($)?i||(i=[]):(i=i||[]).push($,null));for($ in s){var S=s[$];if(y=a!=null?a[$]:void 0,s.hasOwnProperty($)&&S!==y&&(S!=null||y!=null))if($==="style")if(y){for(u in y)!y.hasOwnProperty(u)||S&&S.hasOwnProperty(u)||(r||(r={}),r[u]="");for(u in S)S.hasOwnProperty(u)&&y[u]!==S[u]&&(r||(r={}),r[u]=S[u])}else r||(i||(i=[]),i.push($,r)),r=S;else $==="dangerouslySetInnerHTML"?(S=S?S.__html:void 0,y=y?y.__html:void 0,S!=null&&y!==S&&(i=i||[]).push($,S)):$==="children"?typeof S!="str
40ing"&&typeof S!="number"||(i=i||[]).push($,""+S):$!=="suppressContentEditableWarning"&&$!=="suppressHydrationWarning"&&(h.hasOwnProperty($)?(S!=null&&$==="onScroll"&&Ie("scroll",e),i||y===S||(i=[])):(i=i||[]).push($,S))}r&&(i=i||[]).push("style",r);var $=i;(t.updateQueue=$)&&(t.flags|=4)}},Ru=function(e,t,r,s){r!==s&&(t.flags|=4)};function Ks(e,t){if(!Fe)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var s=null;r!==null;)r.alternate!==null&&(s=r),r=r.sibling;s===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:s.sibling=null}}function ut(e){var t=e.alternate!==null&&e.alternate.child===e.child,r=0,s=0;if(t)for(var a=e.child;a!==null;)r|=a.lanes|a.childLanes,s|=a.subtreeFlags&14680064,s|=a.flags&14680064,a.return=e,a=a.sibling;else for(a=e.child;a!==null;)r|=a.lanes|a.childLanes,s|=a.subtreeFlags,s|=a.flags,a.return=e,a=a.sibling;return e.subtreeFlags|=s,e.childLanes=r,t}function Am(e,t,r){var s=t.pendingProps;switch(di(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ut(t),null;case 1:return ht(t.type)&&$a(),ut(t),null;case 3:return s=t.stateNode,Gr(),Oe(pt),Oe(ot),ki(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(e===null||e.child===null)&&(Ia(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Ft!==null&&(eo(Ft),Ft=null))),Wi(e,t),ut(t),null;case 5:Ni(t);var a=ar(Ws.current);if(r=t.type,e!==null&&t.stateNode!=null)zu(e,t,r,s,a),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!s){if(t.stateNode===null)throw Error(c(166));return ut(t),null}if(e=ar(en.current),Ia(t)){s=t.stateNode,r=t.type;var i=t.memoizedProps;switch(s[Zt]=t,s[Is]=i,e=(t.mode&1)!==0,r){case"dialog":Ie("cancel",s),Ie("close",s);break;case"iframe":case"object":case"embed":Ie("load",s);break;case"video":case"audio":for(a=0;a<zs.length;a++)Ie(zs[a],s);break;case"source":Ie("error",s);break;case"img":case"image":case"link":Ie("error",s),Ie("load",s);break;case"details":Ie("toggle",s);break;case"input":ze(s,i),Ie("invalid",s);break;case"select":s._wrapperState={wasMultiple:!!i.multiple},Ie("invalid",s);break;case"textarea":vn(s,i),Ie("invalid",s)}wr(r,i),a=null;for(var u in i)if(i.hasOwnProperty(u)){var y=i[u];u==="children"?typeof y=="string"?s.textContent!==y&&(i.suppressHydrationWarning!==!0&&La(s.textContent,y,e),a=["children",y]):typeof y=="number"&&s.textContent!==""+y&&(i.suppressHydrationWarning!==!0&&La(s.textContent,y,e),a=["children",""+y]):h.hasOwnProperty(u)&&y!=null&&u==="onScroll"&&Ie("scroll",s)}switch(r){case"input":ge(s),pe(s,i,!0);break;case"textarea":ge(s),gr(s);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(s.onclick=Pa)}s=a,t.updateQueue=s,s!==null&&(t.flags|=4)}else{u=a.nodeType===9?a:a.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=oa(r)),e==="http://www.w3.org/1999/xhtml"?r==="script"?(e=u.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=u.createElement(r,{is:s.is}):(e=u.createElement(r),r==="select"&&(u=e,s.multiple?u.multiple=!0:s.size&&(u.size=s.size))):e=u.createElementNS(e,r),e[Zt]=t,e[Is]=s,Du(e,t,!1,!1),t.stateNode=e;e:{switch(u=Pt(r,s),r){case"dialog":Ie("cancel",e),Ie("close",e),a=s;break;case"iframe":case"object":case"embed":Ie("load",e),a=s;break;case"video":case"audio":for(a=0;a<zs.length;a++)Ie(zs[a],e);a=s;break;case"source":Ie("error",e),a=s;break;case"img":case"image":case"link":Ie("error",e),Ie("load",e),a=s;break;case"details":Ie("toggle",e),a=s;break;case"input":ze(e,s),a=Me(e,s),Ie("invalid",e);break;case"option":a=s;break;case"select":e._wrapperState={wasMultiple:!!s.multiple},a=B({},s,{value:void 0}),Ie("invalid",e);break;case"textarea":vn(e,s),a=wt(e,s),Ie("invalid",e);break;default:a=s}wr(r,a),y=a;for(i in y)if(y.hasOwnProperty(i)){var S=y[i];i==="style"?vr(e,S):i==="dangerouslySetInnerHTML"?(S=S?S.__html:void 0,S!=null&&an(e,S)):i==="children"?typeof S=="string"?(r!=="textarea"||S!=="")&&jt(e,S):typeof S=="number"&&jt(e,""+S):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(h.hasOwnProperty(i)?S!=null&&i==="onScroll"&&Ie("scroll",e):S!=null&&z(e,i,S,u))}switch(r){case"input":ge(e),pe(e,s,!1);break;case"textarea":ge(e),gr(e);break;case"option":s.value!=null&&e.setAttribute("value",""+U(s.value));break;case"select":e.multiple=!!s.multiple,i=s.value,i!=null?Xe(e,!!s.multiple,i,!1):s.defaultValue!=null&&Xe(e,!!s.multiple,s.defaultValue,!0);break;default:typeof a.onClick=="function"&&(e.onclick=Pa)}switch(r){case"button":case"input":case"select":case"textarea":s=!!s.autoFocus;break e;case"img":s=!0;break e;default:s=!1}}s&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}
vendor: 19,498 bytes, line 40
40return ut(t),null;case 6:if(e&&t.stateNode!=null)Ru(e,t,e.memoizedProps,s);else{if(typeof s!="string"&&t.stateNode===null)throw Error(c(166));if(r=ar(Ws.current),ar(en.current),Ia(t)){if(s=t.stateNode,r=t.memoizedProps,s[Zt]=t,(i=s.nodeValue!==r)&&(e=Et,e!==null))switch(e.tag){case 3:La(s.nodeValue,r,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&La(s.nodeValue,r,(e.mode&1)!==0)}i&&(t.flags|=4)}else s=(r.nodeType===9?r:r.ownerDocument).createTextNode(s),s[Zt]=t,t.stateNode=s}return ut(t),null;case 13:if(Oe(We),s=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Fe&&Ct!==null&&(t.mode&1)!==0&&(t.flags&128)===0)Oc(),Qr(),t.flags|=98560,i=!1;else if(i=Ia(t),s!==null&&s.dehydrated!==null){if(e===null){if(!i)throw Error(c(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(c(317));i[Zt]=t}else Qr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;ut(t),i=!1}else Ft!==null&&(eo(Ft),Ft=null),i=!0;if(!i)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=r,t):(s=s!==null,s!==(e!==null&&e.memoizedState!==null)&&s&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(We.current&1)!==0?et===0&&(et=3):ro())),t.updateQueue!==null&&(t.flags|=4),ut(t),null);case 4:return Gr(),Wi(e,t),e===null&&Rs(t.stateNode.containerInfo),ut(t),null;case 10:return gi(t.type._context),ut(t),null;case 17:return ht(t.type)&&$a(),ut(t),null;case 19:if(Oe(We),i=t.memoizedState,i===null)return ut(t),null;if(s=(t.flags&128)!==0,u=i.rendering,u===null)if(s)Ks(i,!1);else{if(et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Ba(e),u!==null){for(t.flags|=128,Ks(i,!1),s=u.updateQueue,s!==null&&(t.updateQueue=s,t.flags|=4),t.subtreeFlags=0,s=r,r=t.child;r!==null;)i=r,e=s,i.flags&=14680066,u=i.alternate,u===null?(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=u.childLanes,i.lanes=u.lanes,i.child=u.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=u.memoizedProps,i.memoizedState=u.memoizedState,i.updateQueue=u.updateQueue,i.type=u.type,e=u.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return Ae(We,We.current&1|2),t.child}e=e.sibling}i.tail!==null&&He()>ts&&(t.flags|=128,s=!0,Ks(i,!1),t.lanes=4194304)}else{if(!s)if(e=Ba(u),e!==null){if(t.flags|=128,s=!0,r=e.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),Ks(i,!0),i.tail===null&&i.tailMode==="hidden"&&!u.alternate&&!Fe)return ut(t),null}else 2*He()-i.renderingStartTime>ts&&r!==1073741824&&(t.flags|=128,s=!0,Ks(i,!1),t.lanes=4194304);i.isBackwards?(u.sibling=t.child,t.child=u):(r=i.last,r!==null?r.sibling=u:t.child=u,i.last=u)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=He(),t.sibling=null,r=We.current,Ae(We,s?r&1|2:r&1),t):(ut(t),null);case 22:case 23:return no(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&(t.mode&1)!==0?(_t&1073741824)!==0&&(ut(t),t.subtreeFlags&6&&(t.flags|=8192)):ut(t),null;case 24:return null;case 25:return null}throw Error(c(156,t.tag))}function Im(e,t){switch(di(t),t.tag){case 1:return ht(t.type)&&$a(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Gr(),Oe(pt),Oe(ot),ki(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ni(t),null;case 13:if(Oe(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));Qr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Oe(We),null;case 4:return Gr(),null;case 10:return gi(t.type._context),null;case 22:case 23:return no(),null;case 24:return null;default:return null}}var Za=!1,dt=!1,Om=typeof WeakSet=="function"?WeakSet:Set,oe=null;function Zr(e,t){var r=e.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(s){Qe(e,t,s)}else r.current=null}function Bi(e,t,r){try{r()}catch(s){Qe(e,t,s)}}var Au=!1;function Um(e,t){if(ni=va,e=hc(),Kl(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var s=r.getSelection&&r.getSelection();if(s&&s.rangeCount!==0){r=s.anchorNode;var a=s.anchorOffset,i=s.focusNode;s=s.focusOffset;try{r.nodeType,i.nodeType}catch{r=null;break e}var u=0,y=-1,S=-1,$=0,K=0,q=e,Y=null;t:for(;;){for(var se;q!==r||a!==0&&q.nodeType!==3||(y=u+a),q!==i||s!==0&&q.nodeType!==3||(S=u+s),q.nodeType===3&&(u+=q.nodeValue.length),(se=q.firstChild)!==null;)Y=q,q=se;for(;;){if(q===e)break t;if(Y===r&&++$===a&&(y=u),Y===i&&++K===s&&(S=u),(se=q.nextSibling)!==null)break;q=Y,Y=q.parentNode}q=se}r=y===-1||S===-1?null:{start:y,end:S}}else r=null}r=r||{start:0,end:0}}else r=null;for(ri={focusedElem:e,selectionRange:r},va=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var ce=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ce!==null){var de=ce.memoizedProps,Je=ce.memoizedState,L=t.stateNode,E=L.getSnapshotBeforeUpdate(t.elementType===t.type?de:Ht(t.type,de),Je);L.__reactInternalSnapshotBeforeUpdate=E}break;case 3:var P=t.stateNode.containerInfo;P.nodeType===1?P.textContent="":P.nodeType===9&&P.documentElement&&P.removeChild(P.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(X){Qe(t,t.return,X)}if(e=t.sibling,e!==null){e.return=t.return,oe=e;break}oe=t.return}return ce=Au,Au=!1,ce}function Js(e,t,r){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&e)===e){var i=a.destroy;a.destroy=void 0,i!==void 0&&Bi(t,r,i)}a=a.next}while(a!==s)}}function el(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var r=t=t.next;do{if((r.tag&e)===e){var s=r.create;r.destroy=s()}r=r.next}while(r!==t)}}function Vi(e){var t=e.ref;if(t!==null){var r=e.stateNode;switch(e.tag){case 5:e=r;break;default:e=r}typeof t=="function"?t(e):t.current=e}}function Iu(e){var t=e.alternate;t!==null&&(e.alternate=null,Iu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Zt],delete t[Is],delete t[ii],delete t[Nm],delete t[Sm])),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 Ou(e){return e.tag===5||e.tag===3||e.tag===4}function Uu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ou(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Yi(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.nodeType===8?r.parentNode.insertBefore(e,t):r.insertBefore(e,t):(r.nodeType===8?(t=r.parentNode,t.insertBefore(e,r)):(t=r,t.appendChild(e)),r=r._reactRootContainer,r!=null||t.onclick!==null||(t.onclick=Pa));else if(s!==4&&(e=e.child,e!==null))for(Yi(e,t,r),e=e.sibling;e!==null;)Yi(e,t,r),e=e.sibling}function Qi(e,t,r){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?r.insertBefore(e,t):r.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(Qi(e,t,r),e=e.sibling;e!==null;)Qi(e,t,r),e=e.sibling}var at=null,Wt=!1;function On(e,t,r){for(r=r.child;r!==null;)Fu(e,t,r),r=r.sibling}function Fu(e,t,r){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(Lr,r)}catch{}switch(r.tag){case 5:dt||Zr(r,t);case 6:var s=at,a=Wt;at=null,On(e,t,r),at=s,Wt=a,at!==null&&(Wt?(e=at,r=r.stateNode,e.nodeType===8?e.parentNode.removeChild(r):e.removeChild(r)):at.removeChild(r.stateNode));break;case 18:at!==null&&(Wt?(e=at,r=r.stateNode,e.nodeType===8?li(e.parentNode,r):e.nodeType===1&&li(e,r),Cs(e)):li(at,r.stateNode));break;case 4:s=at,a=Wt,at=r.stateNode.containerInfo,Wt=!0,On(e,t,r),at=s,Wt=a;break;case 0:case 11:case 14:case 15:if(!dt&&(s=r.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){a=s=s.next;do{var i=a,u=i.destroy;i=i.tag,u!==void 0&&((i&2)!==0||(i&4)!==0)&&Bi(r,t,u),a=a.next}while(a!==s)}On(e,t,r);break;case 1:if(!dt&&(Zr(r,t),s=r.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=r.memoizedProps,s.state=r.memoizedState,s.componentWillUnmount()}catch(y){Qe(r,t,y)}On(e,t,r);break;case 21:On(e,t,r);break;case 22:r.mode&1?(dt=(s=dt)||r.memoizedState!==null,On(e,t,r),dt=s):On(e,t,r);break;default:On(e,t,r)}}function Hu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var r=e.stateNode;r===null&&(r=e.stateNode=new Om),t.forEach(function(s){var a=Jm.bind(null,e,s);r.has(s)||(r.add(s),s.then(a,a))})}}function Bt(e,t){var r=t.deletions;if(r!==null)for(var s=0;s<r.length;s++){var a=r[s];try{var i=e,u=t,y=u;e:for(;y!==null;){switch(y.tag){case 5:at=y.stateNode,Wt=!1;break e;case 3:at=y.stateNode.containerInfo,Wt=!0;break e;case 4:at=y.stateNode.containerInfo,Wt=!0;break e}y=y.return}if(at===null)throw Error(c(160));Fu(i,u,a),at=null,Wt=!1;var S=a.alternate;S!==null&&(S.return=null),a.return=null}catch($){Qe(a,t,$)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Wu(t,e),t=t.sibling}function Wu(e,t){var r=e.alternate,s=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Bt(t,e),nn(e),s&4){try{Js(3,e,e.return),el(3,e)}catch(de){Qe(e,e.return,de)}try{Js(5,e,e.return)}catch(de){Qe(e,e.return,de)}}break;case 1:Bt(t,e),nn(e),s&512&&r!==null&&Zr(r,r.return);break;case 5:if(Bt(t,e),nn(e),s&512&&r!==null&&Zr(r,r.return),e.flags&32){var a=e.stateNode;try{jt(a,"")}catch(de){Qe(e,e.return,de)}}if(s&4&&(a=e.stateNode,a!=null)){var i=e.memoizedProps,u=r!==null?r.memoizedProps:i,y=e.type,S=e.updateQueue;if(e.updateQueue=null,S!==null)try{y==="input"&&i.type==="radio"&&i.name!=null&&Ve(a,i),Pt(y,u);var $=Pt(y,i);for(u=0;u<S.length;u+=2){var K=S[u],q=S[u+1];K==="style"?vr(a,q):K==="dangerouslySetInnerHTML"?an(a,q):K==="children"?jt(a,q):z(a,K,q,$)}switch(y){case"input":Ke(a,i);break;case"textarea":st(a,i);break;case"select":var Y=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!i.multiple;var se=i.value;se!=null?Xe(a,!!i.multiple,se,!1):Y!==!!i.multiple&&(i.defaultValue!=null?Xe(a,!!i.multiple,i.defaultValue,!0):Xe(a,!!i.multiple,i.multiple?[]:"",!1))}a[Is]=i}catch(de){Qe(e,e.return,de)}}break;case 6:if(Bt(t,e),nn(e),s&4){if(e.stateNode===null)throw Error(c(162));a=e.stateNode,i=e.memoizedProps;try{a.nodeValue=i}catch(de){Qe(e,e.return,de)}}break;case 3:if(Bt(t,e),nn(e),s&4&&r!==null&&r.memoizedState.isDehydrated)try{Cs(t.containerInfo)}catch(de){Qe(e,e.return,de)}break;case 4:Bt(t,e),nn(e);break;case 13:Bt(t,e),nn(e),a=e.child,a.flags&8192&&(i=a.memoizedState!==null,a.stateNode.isHidden=i,!i||a.alternate!==null&&a.alternate.memoizedState!==null||(qi=He())),s&4&&Hu(e);break;case 22:if(K=r!==null&&r.memoizedState!==null,e.mode&1?(dt=($=dt)||K,Bt(t,e),dt=$):Bt(t,e),nn(e),s&8192){if($=e.memoizedState!==null,(e.stateNode.isHidden=$)&&!K&&(e.mode&1)!==0)for(oe=e,K=e.child;K!==null;){for(q=oe=K;oe!==null;){switch(Y=oe,se=Y.child,Y.tag){case 0:case 11:case 14:case 15:Js(4,Y,Y.return);break;case 1:Zr(Y,Y.return);var ce=Y.stateNode;if(typeof ce.componentWillUnmount=="function"){s=Y,r=Y.return;try{t=s,ce.props=t.memoizedProps,ce.state=t.memoizedState,ce.componentWillUnmount()}catch(de){Qe(s,r,de)}}break;case 5:Zr(Y,Y.return);break;case 22:if(Y.memoizedState!==null){Yu(q);continue}}se!==null?(se.return=Y,oe=se):Yu(q)}K=K.sibling}e:for(K=null,q=e;;){if(q.tag===5){if(K===null){K=q;try{a=q.stateNode,$?(i=a.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(y=q.stateNode,S=q.memoizedProps.style,u=S!=null&&S.hasOwnProperty("display")?S.display:null,y.style.display=wn("display",u))}catch(de){Qe(e,e.return,de)}}}else if(q.tag===6){if(K===null)try{q.stateNode.nodeValue=$?"":q.memoizedProps}catch(de){Qe(e,e.return,de)}}else if((q.tag!==22&&q.tag!==23||q.memoizedState===null||q===e)&&q.child!==null){q.child.return=q,q=q.child;continue}if(q===e)break e;for(;q.sibling===null;){if(q.return===null||q.return===e)break e;K===q&&(K=null),q=q.return}K===q&&(K=null),q.sibling.return=q.return,q=q.sibling}}break;case 19:Bt(t,e),nn(e),s&4&&Hu(e);break;case 21:break;default:Bt(t,e),nn(e)}}function nn(e){var t=e.flags;if(t&2){try{e:{for(var r=e.return;r!==null;){if(Ou(r)){var s=r;break e}r=r.return}throw Error(c(160))}switch(s.tag){case 5:var a=s.stateNode;s.flags&32&&(jt(a,""),s.flags&=-33);var i=Uu(e);Qi(e,i,a);break;case 3:case 4:var u=s.stateNode.containerInfo,y=Uu(e);Yi(e,y,u);break;default:throw Error(c(161))}}catch(S){Qe(e,e.return,S)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fm(e,t,r){oe=e,Bu(e)}function Bu(e,t,r){for(var s=(e.mode&1)!==0;oe!==null;){var a=oe,i=a.child;if(a.tag===22&&s){var u=a.memoizedState!==null||Za;if(!u){var y=a.alternate,S=y!==null&&y.memoizedState!==null||dt;y=Za;var $=dt;if(Za=u,(dt=S)&&!$)for(oe=a;oe!==null;)u=oe,S=u.child,u.tag===22&&u.memoizedState!==null?Qu(a):S!==null?(S.return=u,oe=S):Qu(a);for(;i!==null;)oe=i,Bu(i),i=i.sibling;oe=a,Za=y,dt=$}Vu(e)}else(a.subtreeFlags&8772)!==0&&i!==null?(i.return=a,oe=i):Vu(e)}}function Vu(e){for(;oe!==null;){var t=oe;if((t.flags&8772)!==0){var r=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:dt||el(5,t);break;case 1:var s=t.stateNode;if(t.flags&4&&!dt)if(r===null)s.componentDidMount();else{var a=t.elementType===t.type?r.memoizedProps:Ht(t.type,r.memoizedProps);s.componentDidUpdate(a,r.memoizedState,s.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Yc(t,i,s);break;case 3:var u=t.updateQueue;if(u!==null){if(r=null,t.child!==null)switch(t.child.tag){case 5:r=t.child.stateNode;break;case 1:r=t.child.stateNode}Yc(t,u,r)}break;case 5:var y=t.stateNode;if(r===null&&t.flags&4){r=y;var S=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":S.autoFocus&&r.focus();break;case"img":S.src&&(r.src=S.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var $=t.alternate;if($!==null){var K=$.memoizedState;if(K!==null){var q=K.dehydrated;q!==null&&Cs(q)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(c(163))}dt||t.flags&512&&Vi(t)}catch(Y){Qe(t,t.return,Y)}}if(t===e){oe=null;break}if(r=t.sibling,r!==null){r.return=t.return,oe=r;break}oe=t.return}}function Yu(e){for(;oe!==null;){var t=oe;if(t===e){oe=null;break}var r=t.sibling;if(r!==null){r.return=t.return,oe=r;break}oe=t.return}}function Qu(e){for(;oe!==null;){var t=oe;try{switch(t.tag){case 0:case 11:case 15:var r=t.return;try{el(4,t)}catch(S){Qe(t,r,S)}break;case 1:var s=t.stateNode;if(typeof s.componentDidMount=="function"){var a=t.return;try{s.componentDidMount()}catch(S){Qe(t,a,S)}}var i=t.return;try{Vi(t)}catch(S){Qe(t,i,S)}break;case 5:var u=t.return;try{Vi(t)}catch(S){Qe(t,u,S)}}}catch(S){Qe(t,t.return,S)}if(t===e){oe=null;break}var y=t.sibling;if(y!==null){y.return=t.return,oe=y;break}oe=t.return}}var Hm=Math.ceil,tl=F.ReactCurrentDispatcher,Ki=F.ReactCurrentOwner,At=F.ReactCurrentBatchConfig,Te=0,nt=null,qe=null,lt=0,_t=0,es=Dn(0),et=0,qs=null,ir=0,nl=0,Ji=0,Gs=null,gt=null,qi=0,ts=1/0,gn=null,rl=!1,Gi=null,Un=null,sl=!1,Fn=null,al=0,Xs=0,Xi=null,ll=-1,il=0;function mt(){return(Te&6)!==0?He():ll!==-1?ll:ll=He()}function Hn(e){return(e.mode&1)===0?1:(Te&2)!==0&&lt!==0?lt&-lt:bm.transition!==null?(il===0&&(il=ws()),il):(e=Q,e!==0||(e=window.event,e=e===void 0?16:Jo(e.type)),e)}function Vt(e,t,r,s){if(50<Xs)throw Xs=0,Xi=null,Error(c(185));bn(e,r,s),((Te&2)===0||e!==nt)&&(e===nt&&((Te&2)===0&&(nl|=r),et===4&&Wn(e,lt)),yt(e,s),r===1&&Te===0&&(t.mode&1)===0&&(ts=He()+500,za&&Rn()))}function yt(e,t){var r=e.callbackNode;ys(e,t);var s=$r(e,e===nt?lt:0);if(s===0)r!==null&&Gn(r),e.callbackNode=null,e.callbackPriority=0;else if(t=s&-s,e.callbackPriority!==t){if(r!=null&&Gn(r),t===1)e.tag===0?km(Ju.bind(null,e)):Dc(Ju.bind(null,e)),wm(function(){(Te&6)===0&&Rn()}),r=null;else{switch(ae(s)){case 1:r=xs;break;case 4:r=pa;break;case 16:r=Tr;break;case 536870912:r=gs;break;default:r=Tr}r=rd(r,Ku.bind(null,e))}e.callbackPriority=t,e.callbackNode=r}}function Ku(e,t){if(ll=-1,il=0,(Te&6)!==0)throw Error(c(327));var r=e.callbackNode;if(ns()&&e.callbackNode!==r)return null;var s=$r(e,e===nt?lt:0);if(s===0)return null;if((s&30)!==0||(s&e.expiredLanes)!==0||t)t=ol(e,s);else{t=s;var a=Te;Te|=2;var i=Gu();(nt!==e||lt!==t)&&(gn=null,ts=He()+500,cr(e,t));do try{Vm();break}catch(y){qu(e,y)}while(!0);xi(),tl.current=i,Te=a,qe!==null?t=0:(nt=null,lt=0,t=et)}if(t!==0){if(t===2&&(a=vs(e),a!==0&&(s=a,t=Zi(e,a))),t===1)throw r=qs,cr(e,0),Wn(e,s),yt(e,He()),r;if(t===6)Wn(e,s);else{if(a=e.current.alternate,(s&30)===0&&!Wm(a)&&(t=ol(e,s),t===2&&(i=vs(e),i!==0&&(s=i,t=Zi(e,i))),t===1))throw r=qs,cr(e,0),Wn(e,s),yt(e,He()),r;switch(e.finishedWork=a,e.finishedLanes=s,t){case 0:case 1:throw Error(c(345));case 2:ur(e,gt,gn);break;case 3:if(Wn(e,s),(s&130023424)===s&&(t=qi+500-He(),10<t)){if($r(e,0)!==0)break;if(a=e.suspendedLanes,(a&s)!==s){mt(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=ai(ur.bind(null,e,gt,gn),t);break}ur(e,gt,gn);break;case 4:if(Wn(e,s),(s&4194240)===s)break;for(t=e.eventTimes,a=-1;0<s;){var u=31-kt(s);i=1<<u,u=t[u],u>a&&(a=u),s&=~i}if(s=a,s=He()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*Hm(s/1960))-s,10<s){e.timeoutHandle=ai(ur.bind(null,e,gt,gn),s);break}ur(e,gt,gn);break;case 5:ur(e,gt,gn);break;default:throw Error(c(329))}}}return yt(e,He()),e.callbackNode===r?Ku.bind(null,e):null}function Zi(e,t){var r=Gs;return e.current.memoizedState.isDehydrated&&(cr(e,t).flags|=256),e=ol(e,t),e!==2&&(t=gt,gt=r,t!==null&&eo(t)),e}function eo(e){gt===null?gt=e:gt.push.apply(gt,e)}function Wm(e){for(var t=e;;){if(t.flags&16384){var r=t.updateQueue;if(r!==null&&(r=r.stores,r!==null))for(var s=0;s<r.length;s++){var a=r[s],i=a.getSnapshot;a=a.value;try{if(!Ut(i(),a))return!1}catch{return!1}}}if(r=t.child,t.subtreeFlags&16384&&r!==null)r.return=t,t=r;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Wn(e,t){for(t&=~Ji,t&=~nl,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-kt(t),s=1<<r;e[r]=-1,t&=~s}}function Ju(e){if((Te&6)!==0)throw Error(c(327));ns();var t=$r(e,0);if((t&1)===0)return yt(e,He()),null;var r=ol(e,t);if(e.tag!==0&&r===2){var s=vs(e);s!==0&&(t=s,r=Zi(e,s))}if(r===1)throw r=qs,cr(e,0),Wn(e,t),yt(e,He()),r;if(r===6)throw Error(c(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ur(e,gt,gn),yt(e,He()),null}function to(e,t){var r=Te;Te|=1;try{return e(t)}finally{Te=r,Te===0&&(ts=He()+500,za&&Rn())}}function or(e){Fn!==null&&Fn.tag===0&&(Te&6)===0&&ns();var t=Te;Te|=1;var r=At.transition,s=Q;try{if(At.transition=null,Q=1,e)return e()}finally{Q=s,At.transition=r,Te=t,(Te&6)===0&&Rn()}}function no(){_t=es.current,Oe(es)}function cr(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(r!==-1&&(e.timeoutHandle=-1,vm(r)),qe!==null)for(r=qe.return;r!==null;){var s=r;switch(di(s),s.tag){case 1:s=s.type.childContextTypes,s!=null&&$a();break;case 3:Gr(),Oe(pt),Oe(ot),ki();break;case 5:Ni(s);break;case 4:Gr();break;case 13:Oe(We);break;case 19:Oe(We);break;case 10:gi(s.type._context);break;case 22:case 23:no()}r=r.return}if(nt=e,qe=e=Bn(e.current,null),lt=_t=t,et=0,qs=null,Ji=nl=ir=0,gt=Gs=null,sr!==null){for(t=0;t<sr.length;t++)if(r=sr[t],s=r.interleaved,s!==null){r.interleaved=null;
vendor: 6,402 bytes, line 40
40var a=s.next,i=r.pending;if(i!==null){var u=i.next;i.next=a,s.next=u}r.pending=s}sr=null}return e}function qu(e,t){do{var r=qe;try{if(xi(),Va.current=Ja,Ya){for(var s=Be.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}Ya=!1}if(lr=0,tt=Ze=Be=null,Bs=!1,Vs=0,Ki.current=null,r===null||r.return===null){et=1,qs=t,qe=null;break}e:{var i=e,u=r.return,y=r,S=t;if(t=lt,y.flags|=32768,S!==null&&typeof S=="object"&&typeof S.then=="function"){var $=S,K=y,q=K.tag;if((K.mode&1)===0&&(q===0||q===11||q===15)){var Y=K.alternate;Y?(K.updateQueue=Y.updateQueue,K.memoizedState=Y.memoizedState,K.lanes=Y.lanes):(K.updateQueue=null,K.memoizedState=null)}var se=ju(u);if(se!==null){se.flags&=-257,Nu(se,u,y,i,t),se.mode&1&&wu(i,$,t),t=se,S=$;var ce=t.updateQueue;if(ce===null){var de=new Set;de.add(S),t.updateQueue=de}else ce.add(S);break e}else{if((t&1)===0){wu(i,$,t),ro();break e}S=Error(c(426))}}else if(Fe&&y.mode&1){var Je=ju(u);if(Je!==null){(Je.flags&65536)===0&&(Je.flags|=256),Nu(Je,u,y,i,t),pi(Xr(S,y));break e}}i=S=Xr(S,y),et!==4&&(et=2),Gs===null?Gs=[i]:Gs.push(i),i=u;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var L=yu(i,S,t);Vc(i,L);break e;case 1:y=S;var E=i.type,P=i.stateNode;if((i.flags&128)===0&&(typeof E.getDerivedStateFromError=="function"||P!==null&&typeof P.componentDidCatch=="function"&&(Un===null||!Un.has(P)))){i.flags|=65536,t&=-t,i.lanes|=t;var X=vu(i,y,t);Vc(i,X);break e}}i=i.return}while(i!==null)}Zu(r)}catch(me){t=me,qe===r&&r!==null&&(qe=r=r.return);continue}break}while(!0)}function Gu(){var e=tl.current;return tl.current=Ja,e===null?Ja:e}function ro(){(et===0||et===3||et===2)&&(et=4),nt===null||(ir&268435455)===0&&(nl&268435455)===0||Wn(nt,lt)}function ol(e,t){var r=Te;Te|=2;var s=Gu();(nt!==e||lt!==t)&&(gn=null,cr(e,t));do try{Bm();break}catch(a){qu(e,a)}while(!0);if(xi(),Te=r,tl.current=s,qe!==null)throw Error(c(261));return nt=null,lt=0,et}function Bm(){for(;qe!==null;)Xu(qe)}function Vm(){for(;qe!==null&&!ma();)Xu(qe)}function Xu(e){var t=nd(e.alternate,e,_t);e.memoizedProps=e.pendingProps,t===null?Zu(e):qe=t,Ki.current=null}function Zu(e){var t=e;do{var r=t.alternate;if(e=t.return,(t.flags&32768)===0){if(r=Am(r,t,_t),r!==null){qe=r;return}}else{if(r=Im(r,t),r!==null){r.flags&=32767,qe=r;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{et=6,qe=null;return}}if(t=t.sibling,t!==null){qe=t;return}qe=t=e}while(t!==null);et===0&&(et=5)}function ur(e,t,r){var s=Q,a=At.transition;try{At.transition=null,Q=1,Ym(e,t,r,s)}finally{At.transition=a,Q=s}return null}function Ym(e,t,r,s){do ns();while(Fn!==null);if((Te&6)!==0)throw Error(c(327));r=e.finishedWork;var a=e.finishedLanes;if(r===null)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(c(177));e.callbackNode=null,e.callbackPriority=0;var i=r.lanes|r.childLanes;if(js(e,i),e===nt&&(qe=nt=null,lt=0),(r.subtreeFlags&2064)===0&&(r.flags&2064)===0||sl||(sl=!0,rd(Tr,function(){return ns(),null})),i=(r.flags&15990)!==0,(r.subtreeFlags&15990)!==0||i){i=At.transition,At.transition=null;var u=Q;Q=1;var y=Te;Te|=4,Ki.current=null,Um(e,r),Wu(r,e),fm(ri),va=!!ni,ri=ni=null,e.current=r,Fm(r),_r(),Te=y,Q=u,At.transition=i}else e.current=r;if(sl&&(sl=!1,Fn=e,al=a),i=e.pendingLanes,i===0&&(Un=null),Rl(r.stateNode),yt(e,He()),t!==null)for(s=e.onRecoverableError,r=0;r<t.length;r++)a=t[r],s(a.value,{componentStack:a.stack,digest:a.digest});if(rl)throw rl=!1,e=Gi,Gi=null,e;return(al&1)!==0&&e.tag!==0&&ns(),i=e.pendingLanes,(i&1)!==0?e===Xi?Xs++:(Xs=0,Xi=e):Xs=0,Rn(),null}function ns(){if(Fn!==null){var e=ae(al),t=At.transition,r=Q;try{if(At.transition=null,Q=16>e?16:e,Fn===null)var s=!1;else{if(e=Fn,Fn=null,al=0,(Te&6)!==0)throw Error(c(331));var a=Te;for(Te|=4,oe=e.current;oe!==null;){var i=oe,u=i.child;if((oe.flags&16)!==0){var y=i.deletions;if(y!==null){for(var S=0;S<y.length;S++){var $=y[S];for(oe=$;oe!==null;){var K=oe;switch(K.tag){case 0:case 11:case 15:Js(8,K,i)}var q=K.child;if(q!==null)q.return=K,oe=q;else for(;oe!==null;){K=oe;var Y=K.sibling,se=K.return;if(Iu(K),K===$){oe=null;break}if(Y!==null){Y.return=se,oe=Y;break}oe=se}}}var ce=i.alternate;if(ce!==null){var de=ce.child;if(de!==null){ce.child=null;do{var Je=de.sibling;de.sibling=null,de=Je}while(de!==null)}}oe=i}}if((i.subtreeFlags&2064)!==0&&u!==null)u.return=i,oe=u;else e:for(;oe!==null;){if(i=oe,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:Js(9,i,i.return)}var L=i.sibling;if(L!==null){L.return=i.return,oe=L;break e}oe=i.return}}var E=e.current;for(oe=E;oe!==null;){u=oe;var P=u.child;if((u.subtreeFlags&2064)!==0&&P!==null)P.return=u,oe=P;else e:for(u=E;oe!==null;){if(y=oe,(y.flags&2048)!==0)try{switch(y.tag){case 0:case 11:case 15:el(9,y)}}catch(me){Qe(y,y.return,me)}if(y===u){oe=null;break e}var X=y.sibling;if(X!==null){X.return=y.return,oe=X;break e}oe=y.return}}if(Te=a,Rn(),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(Lr,e)}catch{}s=!0}return s}finally{Q=r,At.transition=t}}return!1}function ed(e,t,r){t=Xr(r,t),t=yu(e,t,1),e=In(e,t,1),t=mt(),e!==null&&(bn(e,1,t),yt(e,t))}function Qe(e,t,r){if(e.tag===3)ed(e,e,r);else for(;t!==null;){if(t.tag===3){ed(t,e,r);break}else if(t.tag===1){var s=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof s.componentDidCatch=="function"&&(Un===null||!Un.has(s))){e=Xr(r,e),e=vu(t,e,1),t=In(t,e,1),e=mt(),t!==null&&(bn(t,1,e),yt(t,e));break}}t=t.return}}function Qm(e,t,r){var s=e.pingCache;s!==null&&s.delete(t),t=mt(),e.pingedLanes|=e.suspendedLanes&r,nt===e&&(lt&r)===r&&(et===4||et===3&&(lt&130023424)===lt&&500>He()-qi?cr(e,0):Ji|=r),yt(e,t)}function td(e,t){t===0&&((e.mode&1)===0?t=1:(t=Mr,Mr<<=1,(Mr&130023424)===0&&(Mr=4194304)));var r=mt();e=pn(e,t),e!==null&&(bn(e,t,r),yt(e,r))}function Km(e){var t=e.memoizedState,r=0;t!==null&&(r=t.retryLane),td(e,r)}function Jm(e,t){var r=0;switch(e.tag){case 13:var s=e.stateNode,a=e.memoizedState;a!==null&&(r=a.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(c(314))}s!==null&&s.delete(t),td(e,r)}var nd;nd=function(e,t,r){if(e!==null)if(e.memoizedProps!==t.pendingProps||pt.current)xt=!0;else{if((e.lanes&r)===0&&(t.flags&128)===0)return xt=!1,Rm(e,t,r);xt=(e.flags&131072)!==0}else xt=!1,Fe&&(t.flags&1048576)!==0&&zc(t,Aa,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;Xa(e,t),e=t.pendingProps;var a=Br(t,ot.current);qr(t,r),a=Ci(null,t,s,e,a,r);
vendor: 8,982 bytes, line 40
40var i=_i();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ht(s)?(i=!0,Da(t)):i=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,wi(t),a.updater=qa,t.stateNode=a,a._reactInternals=t,Di(t,s,e,r),t=Ii(null,t,s,!0,i,r)):(t.tag=0,Fe&&i&&ui(t),ft(null,t,a,r),t=t.child),t;case 16:s=t.elementType;e:{switch(Xa(e,t),e=t.pendingProps,a=s._init,s=a(s._payload),t.type=s,a=t.tag=Gm(s),e=Ht(s,e),a){case 0:t=Ai(null,t,s,e,r);break e;case 1:t=_u(null,t,s,e,r);break e;case 11:t=Su(null,t,s,e,r);break e;case 14:t=ku(null,t,s,Ht(s.type,e),r);break e}throw Error(c(306,s,""))}return t;case 0:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Ht(s,a),Ai(e,t,s,a,r);case 1:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Ht(s,a),_u(e,t,s,a,r);case 3:e:{if(Tu(t),e===null)throw Error(c(387));s=t.pendingProps,i=t.memoizedState,a=i.element,Bc(e,t),Wa(t,s,null,r);var u=t.memoizedState;if(s=u.element,i.isDehydrated)if(i={element:s,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){a=Xr(Error(c(423)),t),t=Lu(e,t,s,r,a);break e}else if(s!==a){a=Xr(Error(c(424)),t),t=Lu(e,t,s,r,a);break e}else for(Ct=$n(t.stateNode.containerInfo.firstChild),Et=t,Fe=!0,Ft=null,r=Hc(t,null,s,r),t.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Qr(),s===a){t=xn(e,t,r);break e}ft(e,t,s,r)}t=t.child}return t;case 5:return Qc(t),e===null&&mi(t),s=t.type,a=t.pendingProps,i=e!==null?e.memoizedProps:null,u=a.children,si(s,a)?u=null:i!==null&&si(s,i)&&(t.flags|=32),Cu(e,t),ft(e,t,u,r),t.child;case 6:return e===null&&mi(t),null;case 13:return Pu(e,t,r);case 4:return ji(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=Kr(t,null,s,r):ft(e,t,s,r),t.child;case 11:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Ht(s,a),Su(e,t,s,a,r);case 7:return ft(e,t,t.pendingProps,r),t.child;case 8:return ft(e,t,t.pendingProps.children,r),t.child;case 12:return ft(e,t,t.pendingProps.children,r),t.child;case 10:e:{if(s=t.type._context,a=t.pendingProps,i=t.memoizedProps,u=a.value,Ae(Ua,s._currentValue),s._currentValue=u,i!==null)if(Ut(i.value,u)){if(i.children===a.children&&!pt.current){t=xn(e,t,r);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var y=i.dependencies;if(y!==null){u=i.child;for(var S=y.firstContext;S!==null;){if(S.context===s){if(i.tag===1){S=hn(-1,r&-r),S.tag=2;var $=i.updateQueue;if($!==null){$=$.shared;var K=$.pending;K===null?S.next=S:(S.next=K.next,K.next=S),$.pending=S}}i.lanes|=r,S=i.alternate,S!==null&&(S.lanes|=r),yi(i.return,r,t),y.lanes|=r;break}S=S.next}}else if(i.tag===10)u=i.type===t.type?null:i.child;else if(i.tag===18){if(u=i.return,u===null)throw Error(c(341));u.lanes|=r,y=u.alternate,y!==null&&(y.lanes|=r),yi(u,r,t),u=i.sibling}else u=i.child;if(u!==null)u.return=i;else for(u=i;u!==null;){if(u===t){u=null;break}if(i=u.sibling,i!==null){i.return=u.return,u=i;break}u=u.return}i=u}ft(e,t,a.children,r),t=t.child}return t;case 9:return a=t.type,s=t.pendingProps.children,qr(t,r),a=zt(a),s=s(a),t.flags|=1,ft(e,t,s,r),t.child;case 14:return s=t.type,a=Ht(s,t.pendingProps),a=Ht(s.type,a),ku(e,t,s,a,r);case 15:return bu(e,t,t.type,t.pendingProps,r);case 17:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:Ht(s,a),Xa(e,t),t.tag=1,ht(s)?(e=!0,Da(t)):e=!1,qr(t,r),xu(t,s,a),Di(t,s,a,r),Ii(null,t,s,!0,e,r);case 19:return $u(e,t,r);case 22:return Eu(e,t,r)}throw Error(c(156,t.tag))};function rd(e,t){return hs(e,t)}function qm(e,t,r,s){this.tag=e,this.key=r,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=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function It(e,t,r,s){return new qm(e,t,r,s)}function so(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Gm(e){if(typeof e=="function")return so(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===be)return 14}return 2}function Bn(e,t){var r=e.alternate;return r===null?(r=It(e.tag,t,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&14680064,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function cl(e,t,r,s,a,i){var u=2;if(s=e,typeof e=="function")so(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case J:return dr(r.children,a,i,t);case H:u=8,a|=8;break;case W:return e=It(12,r,t,a|2),e.elementType=W,e.lanes=i,e;case Z:return e=It(13,r,t,a),e.elementType=Z,e.lanes=i,e;case xe:return e=It(19,r,t,a),e.elementType=xe,e.lanes=i,e;case ne:return ul(r,a,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ne:u=10;break e;case re:u=9;break e;case ee:u=11;break e;case be:u=14;break e;case je:u=16,s=null;break e}throw Error(c(130,e==null?e:typeof e,""))}return t=It(u,r,t,a),t.elementType=e,t.type=s,t.lanes=i,t}function dr(e,t,r,s){return e=It(7,e,s,t),e.lanes=r,e}function ul(e,t,r,s){return e=It(22,e,s,t),e.elementType=ne,e.lanes=r,e.stateNode={isHidden:!1},e}function ao(e,t,r){return e=It(6,e,null,t),e.lanes=r,e}function lo(e,t,r){return t=It(4,e.children!==null?e.children:[],e.key,t),t.lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Xm(e,t,r,s,a){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=Dr(0),this.expirationTimes=Dr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dr(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function io(e,t,r,s,a,i,u,y,S){return e=new Xm(e,t,r,y,S),t===1?(t=1,i===!0&&(t|=8)):t=0,i=It(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:s,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},wi(i),e}function Zm(e,t,r){var s=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:M,key:s==null?null:""+s,children:e,containerInfo:t,implementation:r}}function sd(e){if(!e)return zn;e=e._reactInternals;e:{if(Xt(e)!==e||e.tag!==1)throw Error(c(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ht(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(c(171))}if(e.tag===1){var r=e.type;if(ht(r))return Mc(e,r,t)}return t}function ad(e,t,r,s,a,i,u,y,S){return e=io(r,s,!0,e,a,i,u,y,S),e.context=sd(null),r=e.current,s=mt(),a=Hn(r),i=hn(s,a),i.callback=t??null,In(r,i,a),e.current.lanes=a,bn(e,a,s),yt(e,s),e}function dl(e,t,r,s){var a=t.current,i=mt(),u=Hn(a);return r=sd(r),t.context===null?t.context=r:t.pendingContext=r,t=hn(i,u),t.payload={element:e},s=s===void 0?null:s,s!==null&&(t.callback=s),e=In(a,t,u),e!==null&&(Vt(e,a,u,i),Ha(e,a,u)),u}function fl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function ld(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<t?r:t}}function oo(e,t){ld(e,t),(e=e.alternate)&&ld(e,t)}function ep(){return null}var id=typeof reportError=="function"?reportError:function(e){console.error(e)};function co(e){this._internalRoot=e}ml.prototype.render=co.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));dl(e,t,null,null)},ml.prototype.unmount=co.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;or(function(){dl(null,e,null,null)}),t[un]=null}};function ml(e){this._internalRoot=e}ml.prototype.unstable_scheduleHydration=function(e){if(e){var t=Xn();e={blockedOn:null,target:e,priority:t};for(var r=0;r<Ln.length&&t!==0&&t<Ln[r].priority;r++);Ln.splice(r,0,e),r===0&&Qo(e)}};function uo(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function pl(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function od(){}function tp(e,t,r,s,a){if(a){if(typeof s=="function"){var i=s;s=function(){var $=fl(u);i.call($)}}var u=ad(t,s,e,0,null,!1,!1,"",od);return e._reactRootContainer=u,e[un]=u.current,Rs(e.nodeType===8?e.parentNode:e),or(),u}for(;
vendor: 7,670 bytes, lines 40-79
40a=e.lastChild;)e.removeChild(a);if(typeof s=="function"){var y=s;s=function(){var $=fl(S);y.call($)}}var S=io(e,0,!1,null,null,!1,!1,"",od);return e._reactRootContainer=S,e[un]=S.current,Rs(e.nodeType===8?e.parentNode:e),or(function(){dl(t,S,r,s)}),S}function hl(e,t,r,s,a){var i=r._reactRootContainer;if(i){var u=i;if(typeof a=="function"){var y=a;a=function(){var S=fl(u);y.call(S)}}dl(t,u,e,a)}else u=tp(r,t,e,a,s);return fl(u)}Ee=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var r=Sn(t.pendingLanes);r!==0&&(A(t,r|1),yt(t,He()),(Te&6)===0&&(ts=He()+500,Rn()))}break;case 13:or(function(){var s=pn(e,1);if(s!==null){var a=mt();Vt(s,e,1,a)}}),oo(e,1)}},Ye=function(e){if(e.tag===13){var t=pn(e,134217728);if(t!==null){var r=mt();Vt(t,e,134217728,r)}oo(e,134217728)}},En=function(e){if(e.tag===13){var t=Hn(e),r=pn(e,t);if(r!==null){var s=mt();Vt(r,e,t,s)}oo(e,t)}},Xn=function(){return Q},Zn=function(e,t){var r=Q;try{return Q=e,t()}finally{Q=r}},on=function(e,t,r){switch(t){case"input":if(Ke(e,r),t=r.name,r.type==="radio"&&t!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var s=r[t];if(s!==e&&s.form===e.form){var a=Ma(s);if(!a)throw Error(c(90));Pe(s),Ke(s,a)}}}break;case"textarea":st(e,r);break;case"select":t=r.value,t!=null&&Xe(e,!!r.multiple,t,!1)}},fs=to,ua=or;var np={usingClientEntryPoint:!1,Events:[Os,Hr,Ma,ca,ds,to]},Zs={findFiberByHostInstance:er,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},rp={bundleType:Zs.bundleType,version:Zs.version,rendererPackageName:Zs.rendererPackageName,rendererConfig:Zs.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:F.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Cr(e),e===null?null:e.stateNode},findFiberByHostInstance:Zs.findFiberByHostInstance||ep,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var xl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!xl.isDisabled&&xl.supportsFiber)try{Lr=xl.inject(rp),Mt=xl}catch{}}return vt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=np,vt.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!uo(t))throw Error(c(200));return Zm(e,t,null,r)},vt.createRoot=function(e,t){if(!uo(e))throw Error(c(299));var r=!1,s="",a=id;return t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=io(e,1,!1,null,null,r,!1,s,a),e[un]=t.current,Rs(e.nodeType===8?e.parentNode:e),new co(t)},vt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=Cr(t),e=e===null?null:e.stateNode,e},vt.flushSync=function(e){return or(e)},vt.hydrate=function(e,t,r){if(!pl(t))throw Error(c(200));return hl(null,e,t,!0,r)},vt.hydrateRoot=function(e,t,r){if(!uo(e))throw Error(c(405));var s=r!=null&&r.hydratedSources||null,a=!1,i="",u=id;if(r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(i=r.identifierPrefix),r.onRecoverableError!==void 0&&(u=r.onRecoverableError)),t=ad(t,null,e,1,r??null,a,!1,i,u),e[un]=t.current,Rs(e),s)for(e=0;e<s.length;e++)r=s[e],a=r._getVersion,a=a(r._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[r,a]:t.mutableSourceEagerHydrationData.push(r,a);return new ml(t)},vt.render=function(e,t,r){if(!pl(t))throw Error(c(200));return hl(null,e,t,!1,r)},vt.unmountComponentAtNode=function(e){if(!pl(e))throw Error(c(40));return e._reactRootContainer?(or(function(){hl(null,null,e,!1,function(){e._reactRootContainer=null,e[un]=null})}),!0):!1},vt.unstable_batchedUpdates=to,vt.unstable_renderSubtreeIntoContainer=function(e,t,r,s){if(!pl(r))throw Error(c(200));if(e==null||e._reactInternals===void 0)throw Error(c(38));return hl(e,t,r,!1,s)},vt.version="18.3.1-next-f1338f8080-20240426",vt}var xd;function Xd(){if(xd)return ho.exports;xd=1;function l(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(l)}catch(o){console.error(o)}}return l(),ho.exports=fp(),ho.exports}var gd;function mp(){if(gd)return gl;gd=1;var l=Xd();return gl.createRoot=l.createRoot,gl.hydrateRoot=l.hydrateRoot,gl}var pp=mp();/**
41 * @license lucide-react v0.468.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */const hp=l=>l.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Zd=(...l)=>l.filter((o,c,d)=>!!o&&o.trim()!==""&&d.indexOf(o)===c).join(" ").trim();/**
46 * @license lucide-react v0.468.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */var xp={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
51 * @license lucide-react v0.468.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const gp=f.forwardRef(({color:l="currentColor",size:o=24,strokeWidth:c=2,absoluteStrokeWidth:d,className:h="",children:x,iconNode:m,...p},w)=>f.createElement("svg",{ref:w,...xp,width:o,height:o,stroke:l,strokeWidth:d?Number(c)*24/Number(o):c,className:Zd("lucide",h),...p},[...m.map(([g,k])=>f.createElement(g,k)),...Array.isArray(x)?x:[x]]));/**
56 * @license lucide-react v0.468.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const ue=(l,o)=>{const c=f.forwardRef(({className:d,...h},x)=>f.createElement(gp,{ref:x,iconNode:o,className:Zd(`lucide-${hp(l)}`,d),...h}));return c.displayName=`${l}`,c};/**
61 * @license lucide-react v0.468.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const wl=ue("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
66 * @license lucide-react v0.468.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const yp=ue("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
71 * @license lucide-react v0.468.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const vp=ue("BellRing",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]]);/**
76 * @license lucide-react v0.468.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const wp=ue("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/**
81 * @license lucide-react v0.468.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const jp=ue("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
86 * @license lucide-react v0.468.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const Cl=ue("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
91 * @license lucide-react v0.468.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const Np=ue("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
96 * @license lucide-react v0.468.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const Sp=ue("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
101 * @license lucide-react v0.468.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const _l=ue("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/**
106 * @license lucide-react v0.468.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const ef=ue("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/**
111 * @license lucide-react v0.468.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const kp=ue("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/**
116 * @license lucide-react v0.468.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const Do=ue("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
121 * @license lucide-react v0.468.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const yd=ue("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
126 * @license lucide-react v0.468.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const Tl=ue("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
131 * @license lucide-react v0.468.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const is=ue("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
136 * @license lucide-react v0.468.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const pr=ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
141 * @license lucide-react v0.468.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const zo=ue("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
146 * @license lucide-react v0.468.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const Yt=ue("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
151 * @license lucide-react v0.468.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const Ot=ue("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
156 * @license lucide-react v0.468.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const tf=ue("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
161 * @license lucide-react v0.468.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const bp=ue("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
166 * @license lucide-react v0.468.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const Ro=ue("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
171 * @license lucide-react v0.468.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const ra=ue("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
176 * @license lucide-react v0.468.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const Ep=ue("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
181 * @license lucide-react v0.468.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const as=ue("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
186 * @license lucide-react v0.468.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const nf=ue("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
191 * @license lucide-react v0.468.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const jl=ue("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
196 * @license lucide-react v0.468.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const Ao=ue("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
201 * @license lucide-react v0.468.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const Cp=ue("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
206 * @license lucide-react v0.468.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const vd=ue("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
211 * @license lucide-react v0.468.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const rf=ue("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
216 * @license lucide-react v0.468.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const sf=ue("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
221 * @license lucide-react v0.468.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const Lt=ue("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
226 * @license lucide-react v0.468.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const _p=ue("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
231 * @license lucide-react v0.468.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const af=ue("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
236 * @license lucide-react v0.468.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const Io=ue("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
241 * @license lucide-react v0.468.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const _o=ue("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
246 * @license lucide-react v0.468.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const Tp=ue("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/**
251 * @license lucide-react v0.468.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const os=ue("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/**
256 * @license lucide-react v0.468.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const Oo=ue("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
261 * @license lucide-react v0.468.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const lf=ue("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
266 * @license lucide-react v0.468.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const of=ue("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
271 * @license lucide-react v0.468.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const cs=ue("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
276 * @license lucide-react v0.468.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const To=ue("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
281 * @license lucide-react v0.468.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const Lp=ue("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
286 * @license lucide-react v0.468.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const Yn=ue("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
291 * @license lucide-react v0.468.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const Ll=ue("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
296 * @license lucide-react v0.468.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const ss=ue("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
301 * @license lucide-react v0.468.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const Pp=ue("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
306 * @license lucide-react v0.468.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const Mp=ue("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
310y:"oel41y"}]]);/**
311 * @license lucide-react v0.468.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const $p=ue("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/**
316 * @license lucide-react v0.468.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const Dp=ue("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
321 * @license lucide-react v0.468.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const Uo=ue("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
326 * @license lucide-react v0.468.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const cf=ue("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
331 * @license lucide-react v0.468.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const hr=ue("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
336 * @license lucide-react v0.468.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const xr=ue("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
341 * @license lucide-react v0.468.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const zp=ue("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
346 * @license lucide-react v0.468.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const Rp=ue("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
351 * @license lucide-react v0.468.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const Fo=ue("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
356 * @license lucide-react v0.468.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const Ap=ue("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
361 * @license lucide-react v0.468.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const wd=ue("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
366 * @license lucide-react v0.468.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const Ip=ue("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/**
371 * @license lucide-react v0.468.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const mr=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
375],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Op=["settings","doctors","weekly","exceptions","announcement","delivery","scheduledLine","pendingMessages"],Up={clinicSettings:"settings",doctors:"doctors",weeklySchedule:"weekly",exceptions:"exceptions",announcement:"announcement",delivery:"delivery",scheduledLine:"scheduledLine",pendingMessages:"pendingMessages"},ta={clinicSettings:{name:"東小金井小児神経・脳神経内科クリニック",amStart:"09:00",amEnd:"11:30",pmStart:"13:00",pmEnd:"17:30"},doctors:[{id:"1",name:"生田",color:"blue"},{id:"2",name:"宮奈",color:"green"},{id:"3",name:"鈴木",color:"purple"},{id:"4",name:"佐久間",color:"orange"}],weeklySchedule:{0:{am:{isOpen:!1,doctors:[]},pm:{isOpen:!1,doctors:[]}},1:{am:{isOpen:!0,doctors:["1"]},pm:{isOpen:!0,doctors:["1"]}},2:{am:{isOpen:!0,doctors:["2"]},pm:{isOpen:!0,doctors:["2"]}},3:{am:{isOpen:!0,doctors:["3"]},pm:{isOpen:!1,doctors:[]}},4:{am:{isOpen:!0,doctors:["2"]},pm:{isOpen:!0,doctors:["2"]}},5:{am:{isOpen:!0,doctors:["1"]},pm:{isOpen:!0,doctors:["1"]}},6:{am:{isOpen:!1,doctors:[]},pm:{isOpen:!1,doctors:[]}}},exceptions:[],announcement:"",deliverySettings:{notifyDay:25},linePrompt:`- 400文字以内で作成する
376- 絵文字を2〜3個使い、患者さんやご家族に親しみやすい口調で書く
377- 臨時休診・担当医変更など重要事項は必ず明記する
378- てんかん・神経・発達に関わる患者さんへの配慮を感じる文体にする
379- 最後に「詳しくはホームページをご確認ください」のような一文を入れる
380- 受診を促すメッセージを自然な形で含める`,wpPrompt:`- 記事タイトルは <h2> タグで記述する
381- 「診療カレンダー概要」「臨時スケジュール」「お知らせ」「受診のご案内」の4セクションで構成する
382- 各セクションは <h3> タグで見出しをつける
383- 箇条書きは <ul><li> を使用する
384- 重要な日付や注意事項は <strong> タグで強調する
385- 末尾に受診相談や予約を促すCTAの段落を入れる
386- HTMLのみ出力する(\`\`\`html などのコードブロック記法は不要)`},jd="clinicCalendarData_v6";function Fp(){const[l,o]=f.useState(ta),[c,d]=f.useState(!1),[h,x]=f.useState("idle"),[m,p]=f.useState(""),[w,g]=f.useState(null),[k,j]=f.useState(ta.clinicSettings),[N,R]=f.useState(ta.announcement),[T,b]=f.useState(!1),v=f.useRef(null),D=f.useRef(!1),_=f.useRef(Object.fromEntries(Op.map(U=>[U,0]))),z=f.useRef(l);f.useEffect(()=>{z.current=l});const F=c&&JSON.stringify(l.clinicSettings)!==JSON.stringify(k),V=c&&l.announcement!==N,M=F||V,J=f.useRef({settings:!1,announcement:!1});f.useEffect(()=>{J.current={settings:F,announcement:V}}),f.useEffect(()=>{try{const U=localStorage.getItem(jd);if(U){const te=JSON.parse(U),he=te.data;if(he){const ge={...ta,...he,clinicSettings:{...ta.clinicSettings,...he.clinicSettings??{}}};o(ge);const Pe=te.dirty===!0;D.current=Pe,Pe||(j(ge.clinicSettings),R(ge.announcement))}}}catch(U){console.warn("cache load failed",U)}d(!0)},[]),f.useEffect(()=>{if(c)try{const U={data:l,dirty:M};localStorage.setItem(jd,JSON.stringify(U))}catch{}},[l,c,M]),f.useEffect(()=>{c&&window.dispatchEvent(new CustomEvent("cc:dirty-change",{detail:{isDirty:M}}))},[M,c]);const H=f.useRef(!1);f.useEffect(()=>{const U=()=>{H.current=!0};return window.addEventListener("cc:suppress-unload-guard",U),()=>window.removeEventListener("cc:suppress-unload-guard",U)},[]),f.useEffect(()=>{if(!M)return;const U=te=>{H.current||(te.preventDefault(),te.returnValue="")};return window.addEventListener("beforeunload",U),()=>window.removeEventListener("beforeunload",U)},[M]);const W=async()=>{const U=await fetch("/api/data",{credentials:"same-origin"});if(U.status===401)return null;if(U.status===404){const Pe=await U.json().catch(()=>null);return Pe!=null&&Pe.revs&&(_.current=Pe.revs),null}if(!U.ok)return null;const te=await U.json(),{revs:he,...ge}=te;return{data:ge,revs:he}},Ne=async()=>{x("loading"),p("");try{const U=await W();if(!U){x("idle");return}const te=D.current||J.current.settings||J.current.announcement;if(D.current=!1,te){const he=z.current;JSON.stringify(U.data.clinicSettings)!==JSON.stringify(he.clinicSettings)||U.data.announcement!==he.announcement?(o({...U.data,clinicSettings:he.clinicSettings,announcement:he.announcement}),j(U.data.clinicSettings),R(U.data.announcement),v.current={clinicSettings:U.data.clinicSettings,announcement:U.data.announcement},b(!0)):(o(U.data),j(U.data.clinicSettings),R(U.data.announcement))}else o(U.data),j(U.data.clinicSettings),R(U.data.announcement);_.current=U.revs,x("idle")}catch(U){console.warn("loadFromServer failed",U),x("idle")}},re=()=>{b(!1),v.current=null},ee=()=>{const U=v.current;U&&(o(te=>({...te,...U})),j(U.clinicSettings),R(U.announcement)),b(!1),v.current=null},Z=async(U,te)=>{const ge=Object.keys(U).map(Me=>Up[Me]),Pe=te??_.current,Ge={};for(const Me of ge)Ge[Me]=Pe[Me];try{const Me=await fetch("/api/data",{method:"PATCH",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseRevs:Ge,patch:U})}),ze=await Me.json().catch(()=>null);if(Me.status===409&&ze&&"conflicts"in ze){const Ve={..._.current};for(const Ke of ge)Ve[Ke]=ze.revs[Ke];return _.current=Ve,{ok:!1,error:"conflict",conflicts:ze.conflicts}}if(!Me.ok)return{ok:!1,error:ze&&"error"in ze&&ze.error?ze.error:`HTTP ${Me.status}`};if(ze&&"ok"in ze&&ze.ok){const Ve={..._.current};for(const Ke of ge)Ve[Ke]=ze.revs[Ke];_.current=Ve}return g(Date.now()),{ok:!0}}catch(Me){return{ok:!1,error:Me instanceof Error?Me.message:"ネットワークエラーが発生しました"}}},xe=async U=>{const te=z.current.exceptions,he=typeof U=="function"?U(te):U;o(Pe=>({...Pe,exceptions:he}));const ge=await Z({exceptions:he});return ge.ok||o(Pe=>({...Pe,exceptions:te})),ge},be=async U=>{const te=z.current.weeklySchedule;o(ge=>({...ge,weeklySchedule:U}));const he=await Z({weeklySchedule:U});return he.ok||o(ge=>({...ge,weeklySchedule:te})),he},je=async U=>{const te=z.current.doctors;o(ge=>({...ge,doctors:U}));const he=await Z({doctors:U});return he.ok||o(ge=>({...ge,doctors:te})),he},ne=async U=>{const te=async()=>{const ge=await W();if(!ge)return{ok:!1,error:"最新データの取得に失敗しました"};const Pe=ge.data.doctors.filter(Ve=>Ve.id!==U),Ge={};for(const[Ve,Ke]of Object.entries(ge.data.weeklySchedule))Ge[Number(Ve)]={am:{...Ke.am,doctors:Ke.am.doctors.filter(pe=>pe!==U)},pm:{...Ke.pm,doctors:Ke.pm.doctors.filter(pe=>pe!==U)}};const Me=ge.data.exceptions.map(Ve=>({...Ve,doctors:Ve.doctors.filter(Ke=>Ke!==U)}));_.current=ge.revs;const ze=await Z({doctors:Pe,weeklySchedule:Ge,exceptions:Me},ge.revs);return ze.ok&&o(Ve=>({...Ve,doctors:Pe,weeklySchedule:Ge,exceptions:Me})),ze};let he=await te();return!he.ok&&he.error==="conflict"&&(he=await te()),he},I=U=>o(te=>({...te,clinicSettings:U})),ie=async()=>{const U=z.current.clinicSettings,te=await Z({clinicSettings:U});return te.ok&&j(U),te},B=U=>o(te=>({...te,announcement:U})),C=async()=>{const U=z.current.announcement,te=await Z({announcement:U});return te.ok&&R(U),te},O=U=>o(te=>({...te,linePrompt:U})),ye=U=>o(te=>({...te,wpPrompt:U})),G=U=>o(te=>({...te,deliverySettings:U})),fe=async()=>{const U=z.current;return Z({delivery:{linePrompt:U.linePrompt,wpPrompt:U.wpPrompt,deliverySettings:U.deliverySettings}})}
386,ke=async()=>{const U=await W(),te=(U==null?void 0:U.data.pendingMessages)??z.current.pendingMessages;U&&(o(ge=>({...ge,pendingMessages:U.data.pendingMessages})),_.current=U.revs),o(ge=>({...ge,pendingMessages:void 0}));const he=await Z({pendingMessages:null});return he.ok||o(ge=>({...ge,pendingMessages:te})),he},_e=async U=>{const te=await W(),he=(te==null?void 0:te.data.scheduledLine)??z.current.scheduledLine;te&&(o(Pe=>({...Pe,scheduledLine:te.data.scheduledLine})),_.current=te.revs),o(Pe=>({...Pe,scheduledLine:U}));const ge=await Z({scheduledLine:U??null});return ge.ok||o(Pe=>({...Pe,scheduledLine:he})),ge};return f.useEffect(()=>{const U=()=>{(async()=>{let te=!0;J.current.settings&&((await ie()).ok||(te=!1)),J.current.announcement&&((await C()).ok||(te=!1)),window.dispatchEvent(new CustomEvent("cc:save-result",{detail:{success:te}}))})()};return window.addEventListener("cc:request-save",U),()=>window.removeEventListener("cc:request-save",U)},[]),{data:l,loaded:c,syncStatus:h,syncError:m,lastSavedAt:w,isDirty:M,isClinicSettingsDirty:F,isAnnouncementDirty:V,showRestoreBanner:T,restoreDraft:re,discardDraft:ee,loadFromServer:Ne,setClinicSettings:I,saveClinicSettings:ie,setAnnouncement:B,saveAnnouncement:C,saveExceptions:xe,saveWeeklySchedule:be,saveDoctors:je,deleteDoctorCascade:ne,setLinePrompt:O,setWpPrompt:ye,setDeliverySettings:G,saveDelivery:fe,clearPendingMessages:ke,setScheduledLine:_e}}const Nd="holidaysCache",Sd="holidaysCacheDate";function Hp(){const[l,o]=f.useState({});return f.useEffect(()=>{const c=new Date().toISOString().slice(0,10),d=localStorage.getItem(Sd),h=localStorage.getItem(Nd);if(h&&d===c)try{o(JSON.parse(h));return}catch{}fetch("https://holidays-jp.github.io/api/v1/date.json").then(x=>x.json()).then(x=>{o(x),localStorage.setItem(Nd,JSON.stringify(x)),localStorage.setItem(Sd,c)}).catch(x=>console.error("Failed to fetch holidays",x))},[]),l}function Wp({clinicName:l}){return n.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center p-4",children:n.jsxs("div",{className:"bg-white p-8 rounded-2xl shadow-lg w-full max-w-sm border border-gray-100",children:[n.jsx("img",{src:"/app-icon.svg",alt:"","aria-hidden":"true",className:"w-14 h-14 rounded-xl mx-auto mb-4"}),n.jsx("h2",{className:"text-xl font-bold text-gray-800 mb-1 text-center leading-tight",children:l}),n.jsx("p",{className:"text-base text-gray-500 font-medium mb-8 text-center",children:"外来診療予定&お知らせ管理"}),n.jsxs("a",{href:"/api/auth/google/start",className:"w-full flex items-center justify-center gap-3 border border-gray-300 rounded-lg py-3 font-bold text-gray-700 hover:bg-gray-50 transition-colors shadow-sm",children:[n.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 48 48","aria-hidden":"true",children:[n.jsx("path",{fill:"#EA4335",d:"M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"}),n.jsx("path",{fill:"#4285F4",d:"M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"}),n.jsx("path",{fill:"#FBBC05",d:"M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"}),n.jsx("path",{fill:"#34A853",d:"M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"})]}),"Google でログイン"]}),n.jsxs("p",{className:"mt-6 text-xs text-gray-500 text-center leading-relaxed",children:["かけはしの許可されたアカウント",n.jsx("br",{}),"(@kakehashi-mc.jp)のみご利用いただけます"]})]})})}const Bp={primary:"bg-accent hover:bg-accent-hover text-on-accent",secondary:"bg-gray-100 hover:bg-gray-200 text-gray-700 border border-gray-200",danger:"bg-semantic-error hover:bg-rose-800 text-white",ghost:"bg-transparent hover:bg-gray-50 text-gray-600 border border-gray-300"},Vp={sm:"px-3.5 py-1.5 text-[13px]",md:"px-[18px] py-2 text-[13px]",lg:"px-6 py-2.5 text-[13px]"},le=f.forwardRef(function({variant:o="primary",size:c="md",className:d="",disabled:h,...x},m){return n.jsx("button",{ref:m,disabled:h,className:["inline-flex items-center justify-center gap-2 rounded-full font-bold transition-colors","disabled:opacity-50 disabled:cursor-not-allowed",Bp[o],Vp[c],d].join(" "),...x})});function Qt({children:l,className:o="",fadeFrom:c="from-white"}){const d=f.useRef(null),[h,x]=f.useState(!1);return f.useEffect(()=>{var g;const m=((g=d.current)==null?void 0:g.querySelector(".overflow-x-auto"))??d.current;if(!m)return;const p=()=>x(m.scrollWidth>m.clientWidth+1);p();const w=new ResizeObserver(p);return w.observe(m),m.addEventListener("scroll",p,{passive:!0}),()=>{w.disconnect(),m.removeEventListener("scroll",p)}},[]),n.jsxs("div",{ref:d,className:`relative ${o}`,children:[l,h&&n.jsx("div",{className:`pointer-events-none absolute inset-y-0 right-0 w-8 rounded-r-lg bg-gradient-to-l ${c} to-transparent`,"aria-hidden":"true"})]})}const uf=f.createContext(null);function rn(){const l=f.useContext(uf);if(!l)throw new Error("useToast must be used within ToastProvider");return l}const sa=["blue","green","purple","orange","pink","gray"],yn={blue:{label:"ブルー",classes:"bg-blue-100 text-blue-800 border-blue-200",css:{bg:"#dbeafe",text:"#1e40af",border:"#bfdbfe"}},green:{label:"グリーン",classes:"bg-green-100 text-green-800 border-green-200",css:{bg:"#dcfce7",text:"#166534",border:"#bbf7d0"}},purple:{label:"パープル",classes:"bg-purple-100 text-purple-800 border-purple-200",css:{bg:"#f3e8ff",text:"#6b21a8",border:"#e9d5ff"}},orange:{label:"オレンジ",classes:"bg-orange-100 text-orange-800 border-orange-200",css:{bg:"#ffedd5",text:"#9a3412",border:"#fed7aa"}},pink:{label:"ピンク",classes:"bg-pink-100 text-pink-800 border-pink-200",css:{bg:"#fce7f3",text:"#9d174d",border:"#fbcfe8"}},gray:{label:"グレー",classes:"bg-gray-100 text-gray-800 border-gray-200",css:{bg:"#f3f4f6",text:"#1f2937",border:"#e5e7eb"}}},Yp=Object.assign(Object.create(null),Object.fromEntries(sa.map(l
386=>[yn[l].classes,l])));function us(l){const o=(l??"").trim();if(sa.includes(o))return o;const c=Yp[o];return c||(console.warn(`normalizeDoctorColor: 未知の色値のため gray にフォールバック: ${JSON.stringify(l)}`),"gray")}var Ho=Xd();function Qn({title:l,icon:o,onClose:c,children:d,footer:h,widthClassName:x="max-w-md"}){const m=f.useRef(null),p=f.useRef(!1);return f.useEffect(()=>{const w=g=>{g.key==="Escape"&&c()};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[c]),f.useEffect(()=>{var j;const w=m.current;if(!w)return;const g=w.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');(j=g[0])==null||j.focus();const k=N=>{if(N.key!=="Tab"||g.length===0)return;const R=g[0],T=g[g.length-1];N.shiftKey&&document.activeElement===R?(N.preventDefault(),T.focus()):!N.shiftKey&&document.activeElement===T&&(N.preventDefault(),R.focus())};return w.addEventListener("keydown",k),()=>w.removeEventListener("keydown",k)},[]),Ho.createPortal(n.jsx("div",{className:"fixed inset-0 z-[100] bg-black/50 backdrop-blur-sm flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":"cc-modal-title",onMouseDown:w=>{p.current=w.target===w.currentTarget},onMouseUp:w=>{p.current&&w.target===w.currentTarget&&c(),p.current=!1},children:n.jsxs("div",{ref:m,className:`bg-white rounded-xl shadow-xl w-full ${x} max-h-[90vh] flex flex-col`,children:[n.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-gray-100 flex-shrink-0",children:[n.jsxs("h3",{id:"cc-modal-title",className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[o,l]}),n.jsx("button",{type:"button",onClick:c,"aria-label":"閉じる",className:"p-3.5 -m-0.5 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full",children:n.jsx(mr,{className:"w-4 h-4","aria-hidden":!0})})]}),n.jsx("div",{className:"p-5 overflow-y-auto",children:d}),h&&n.jsx("div",{className:"px-5 py-4 border-t border-gray-100 flex justify-end gap-3 flex-shrink-0",children:h})]})}),document.body)}function Qp({initialData:l,initialDate:o,initialTime:c,initialType:d,initialDoctors:h,exceptions:x,saveExceptions:m,doctors:p,onClose:w}){const[g,k]=f.useState({id:(l==null?void 0:l.id)??null,date:(l==null?void 0:l.date)??o??"",type:(l==null?void 0:l.type)??d??"open",time:(l==null?void 0:l.time)??c??"ALL",doctors:(l==null?void 0:l.doctors)??h??[],note:(l==null?void 0:l.note)??"",staffClosed:(l==null?void 0:l.staffClosed)??!1}),[j,N]=f.useState(""),[R,T]=f.useState(!1),b=async()=>{if(N(""),!g.date){N("日付を選択してください。");return}if(x.some(F=>g.id&&F.id===g.id||F.date!==g.date?!1:F.time==="ALL"||g.time==="ALL"||F.time===g.time)){N("この日時の臨時スケジュールは既に設定されています。");return}const _={...g,id:g.id??Date.now().toString(),doctors:g.type==="closed"?[]:g.doctors,staffClosed:g.type==="closed"?g.staffClosed:!1};T(!0);const z=g.id?await m(F=>F.map(V=>V.id===_.id?_:V)):await m(F=>[...F,_].sort((V,M)=>V.date.localeCompare(M.date)));if(T(!1),!z.ok){N(z.error==="conflict"?"他の変更と競合しました。もう一度お試しください。":`保存に失敗しました: ${z.error}`);return}w()},v=D=>k(_=>({..._,doctors:_.doctors.includes(D)?_.doctors.filter(z=>z!==D):[..._.doctors,D]}));return n.jsx(Qn,{title:g.id?"臨時スケジュールの編集":"臨時スケジュールの追加",icon:n.jsx(_l,{className:"w-5 h-5 text-accent-fg","aria-hidden":!0}),onClose:w,widthClassName:"max-w-lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",onClick:w,disabled:R,children:"キャンセル"}),n.jsx(le,{variant:"primary",onClick:()=>void b(),disabled:R,children:R?"保存中…":g.id?"更新する":"追加する"})]}),children:n.jsxs("div",{className:"space-y-4",children:[j&&n.jsxs("div",{className:"flex items-center gap-2 text-red-600 bg-red-50 p-3 rounded text-sm border border-red-200",children:[n.jsx(Yt,{className:"w-4 h-4 flex-shrink-0"})," ",j]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"日にち"}),n.jsx("input",{type:"date",value:g.date,onChange:D=>k(_=>({..._,date:D.target.value})),className:"w-full border rounded p-2 focus:ring-2 focus:ring-accent outline-none bg-white"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"種類"}
386),n.jsxs("select",{value:g.type,onChange:D=>k(_=>({..._,type:D.target.value})),className:"w-full border rounded p-2 focus:ring-2 focus:ring-accent outline-none bg-white",children:[n.jsx("option",{value:"open",children:"臨時診療"}),n.jsx("option",{value:"closed",children:"臨時休診"}),n.jsx("option",{value:"change",children:"担当医変更"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"時間帯"}),n.jsxs("select",{value:g.time,onChange:D=>k(_=>({..._,time:D.target.value})),className:"w-full border rounded p-2 focus:ring-2 focus:ring-accent outline-none bg-white",children:[n.jsx("option",{value:"ALL",children:"終日"}),n.jsx("option",{value:"AM",children:"午前のみ"}),n.jsx("option",{value:"PM",children:"午後のみ"})]})]})]}),g.type==="closed"&&n.jsx("div",{className:"p-4 border rounded-lg bg-amber-50 border-amber-200",children:n.jsxs("label",{className:"flex items-start gap-2 cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:g.staffClosed,onChange:D=>k(_=>({..._,staffClosed:D.target.checked})),className:"w-4 h-4 mt-0.5 text-amber-600 rounded"}),n.jsxs("span",{className:"text-sm text-gray-800",children:[n.jsx("span",{className:"font-bold",children:"休業日(全職員休業)"}),n.jsxs("span",{className:"block text-xs text-gray-600 mt-0.5",children:["夏季休業・年末年始など、在宅診療部も外来もスタッフが不在の休業のときにチェックします。 電話は業者対応可能なら業者へ、対応できない時間帯は自動音声案内になります。",n.jsx("br",{}),n.jsx("span",{className:"text-amber-800",children:"チェックしない場合"}),"は「外来のみ休診・在宅診療部スタッフは通常どおり出勤」として、電話は通常どおり在宅診療部へ転送されます。"]})]})]})}),g.type!=="closed"&&n.jsxs("div",{className:"p-4 border rounded-lg bg-gray-50",children:[n.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-2",children:g.type==="change"?"変更後の担当医":"診療担当医"}),n.jsxs("div",{className:"flex flex-wrap gap-3",children:[p.map(D=>{const _=g.doctors.includes(D.id);return n.jsxs("label",{className:`flex items-center gap-2 p-2 border rounded cursor-pointer bg-white transition-colors
387                        ${_?"border-accent ring-1 ring-accent":"hover:bg-gray-50"}`,children:[n.jsx("input",{type:"checkbox",checked:_,onChange:()=>v(D.id),className:"w-4 h-4 text-accent-fg rounded"}),n.jsx("span",{className:`text-sm px-1.5 py-0.5 border rounded ${yn[us(D.color)].classes}`,children:D.name})]},D.id)}),p.length===0&&n.jsx("span",{className:"text-sm text-semantic-error",children:"先に「基本設定」で担当医を追加してください"})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"メモ(任意)"}),n.jsx("input",{type:"text",value:g.note,onChange:D=>k(_=>({..._,note:D.target.value})),placeholder:"例:学会出張のため",className:"w-full border rounded p-2 focus:ring-2 focus:ring-accent outline-none bg-white text-sm"})]})]})})}function Ue({title:l,icon:o,description:c,headerExtra:d,children:h,className:x=""}){return n.jsxs("section",{className:`bg-white p-6 rounded-xl shadow-sm border border-gray-100 ${x}`,children:[n.jsxs("div",{className:"flex items-center justify-between mb-4 border-b pb-2 gap-2",children:[n.jsxs("h2",{className:"text-lg font-bold text-gray-800 flex items-center gap-2",children:[o&&n.jsx(o,{className:"w-5 h-5 text-accent-fg"}),l]}),d]}),c&&n.jsx("p",{className:"text-sm text-gray-600 mb-4",children:c}),h]})}const df=f.createContext(null);function Kn(){const l=f.useContext(df);if(!l)throw new Error("useConfirm must be used within ConfirmProvider");return l}function Kp(l){const o=new Date(l),c=new Date(o.getTime()+540*60*1e3),d=c.getUTCFullYear(),h=String(c.getUTCMonth()+1).padStart(2,"0"),x=String(c.getUTCDate()).padStart(2,"0"),m=String(c.getUTCHours()).padStart(2,"0"),p=String(c.getUTCMinutes()).padStart(2,"0");return`${d}/${h}/${x} ${m}:${p}`}const kd={closed:"臨時休診",open:"臨時診療",change:"担当医変更"},Jp={closed:"bg-red-100 text-red-700",open:"bg-green-100 text-green-700",change:"bg-orange-100 text-orange-700"},bd={ALL:"終日",AM:"午前のみ",PM:"午後のみ"},qp=[10,25,50,100];function Gp({exceptions:l,saveExceptions:o,doctors:c,onOpenModal:d,userRole:h}){const[x,m]=f.useState(1),[p,w]=f.useState(10),[g,k]=f.useState(null),[j,N]=f.useState(null),[R,T]=f.useState(!1),b=Kn(),v=rn(),D=async H=>{const W=H.doctors.map(Z=>{var xe;return(xe=c.find(be=>be.id===Z))==null?void 0:xe.name}).filter(Z=>!!Z).join("・");if(!await b({title:"臨時スケジュールの削除",message:`${H.date}(${kd[H.type]}・${bd[H.time]}${W?`・担当: ${W}`:""})を削除しますか?削除すると患者向けHP・電話の振り分けにも反映されます。`,confirmLabel:"削除する"}))return;const re=l.find(Z=>Z.id===H.id),ee=await o(Z=>Z.filter(xe=>xe.id!==H.id));if(!ee.ok){v(ee.error==="conflict"?"他の変更と競合しました。もう一度お試しください":`削除に失敗しました: ${ee.error}`,"error");return}v("削除しました","success",{durationMs:8e3,action:re?{label:"元に戻す",onClick:()=>{o(Z=>[...Z,re].sort((xe,be)=>
387xe.date.localeCompare(be.date))).then(Z=>{Z.ok||v(Z.error==="conflict"?"元に戻せませんでした(他の変更と競合しました)":`元に戻せませんでした: ${Z.error}`,"error")})}}:void 0})};f.useEffect(()=>{h==="admin"&&fetch("/api/admin/sync-gbp",{credentials:"same-origin"}).then(H=>H.ok?H.json():null).then(H=>{H&&k(H.latest)}).catch(()=>{})},[h]);const _=async()=>{T(!0),N(null);try{const H=await fetch("/api/admin/sync-gbp",{method:"POST",credentials:"same-origin"}),W=await H.json();!H.ok&&!W.status?N({status:"error",count:0,message:W.error??`HTTP ${H.status}`,syncedAt:Date.now()}):(N(W),k({synced_at:W.syncedAt,status:W.status,count:W.count,message:W.message}))}catch(H){N({status:"error",count:0,message:H instanceof Error?H.message:String(H),syncedAt:Date.now()})}finally{T(!1)}},z=[...l].sort((H,W)=>W.date.localeCompare(H.date)),F=Math.max(1,Math.ceil(z.length/p)),V=Math.min(x,F),M=z.slice((V-1)*p,V*p),J=H=>{w(H),m(1)};return n.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",children:[n.jsxs(Ue,{title:"臨時休診・担当医変更・臨時診療 一覧",icon:_l,children:[l.length===0?n.jsx("p",{className:"text-gray-500 text-center py-8 bg-gray-50 rounded-lg border border-dashed",children:"設定されている臨時スケジュールはありません。"}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"flex items-center justify-between mb-3 text-sm text-gray-500",children:[n.jsxs("span",{children:["全 ",n.jsx("span",{className:"font-semibold text-gray-700",children:l.length})," 件"]}),n.jsxs("label",{className:"flex items-center gap-2",children:[n.jsx("span",{children:"表示件数"}),n.jsx("select",{value:p,onChange:H=>J(Number(H.target.value)),className:"border border-gray-200 rounded px-2 py-1 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-accent",children:qp.map(H=>n.jsxs("option",{value:H,children:[H,"件"]},H))})]})]}),n.jsx(Qt,{className:"mb-4",children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-left border-collapse text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"bg-gray-50 border-b",children:[n.jsx("th",{className:"p-3 font-medium text-gray-600",children:"日付"}),n.jsx("th",{className:"p-3 font-medium text-gray-600",children:"種類"}),n.jsx("th",{className:"p-3 font-medium text-gray-600",children:"時間帯"}),n.jsx("th",{className:"p-3 font-medium text-gray-600",children:"対象医師"}),n.jsx("th",{className:"p-3 font-medium text-gray-600",children:"メモ"}),n.jsx("th",{className:"p-3 font-medium text-gray-600 text-right",children:"操作"})]})}),n.jsx("tbody",{className:"divide-y",children:M.map(H=>n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsx("td",{className:"p-3 text-gray-800 font-medium whitespace-nowrap",children:H.date}),n.jsx("td",{className:"p-3",children:n.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded text-xs font-bold ${Jp[H.type]}`,children:kd[H.type]})}),n.jsx("td",{className:"p-3 text-gray-600 whitespace-nowrap",children:bd[H.time]}),n.jsx("td",{className:"p-3",children:H.doctors.length>0?n.jsx("div",{className:"flex flex-wrap gap-1",children:H.doctors.map(W=>{const Ne=c.find(re=>re.id===W);return Ne?n.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${yn[us(Ne.color)].classes}`,children:Ne.name},W):null})}):n.jsx("span",{className:"text-gray-500 text-xs italic",children:H.type==="closed"?"クリニック全体":"指定なし"})}),n.jsx("td",{className:"p-3 text-gray-500 text-xs",children:H.note??""}),n.jsxs("td",{className:"p-3 text-right whitespace-nowrap",children:[n.jsx("button",{onClick:()=>d({initialData:H}),"aria-label":"編集",className:"text-accent-fg hover:bg-accent-subtle p-3.5 -m-0.5 rounded mr-1",children:n.jsx(os,{className:"w-4 h-4","aria-hidden":!0})}),n.jsx("button",{onClick:()=>void D(H),"aria-label":"削除",className:"text-semantic-error hover:bg-red-50 p-3.5 -m-0.5 rounded",children:n.jsx(hr,{className:"w-4 h-4","aria-hidden":!0})})]})]},H.id))})]})})}),F>1&&n.jsxs("div",{className:"flex items-center justify-center gap-2 mb-6",children:[n.jsx("button",{onClick:()=>m(H=>Math.max(1,H-1)),disabled:V===1,"aria-label":"前へ",className:"p-3.5 -m-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed",children:n.jsx(is,{className:"w-4 h-4","aria-hidden":!0})}),Array.from({length:F},(H,W)=>W+1).map(H=>n.jsx("button",{onClick:()=>m(H),"aria-current":H===V?"page":void 0,className:`w-11 h-11 rounded text-sm font-medium transition-colors
388                      ${H===V?"bg-accent text-on-accent":"text-gray-600 hover:bg-gray-100"}`,children:H},H)),n.jsx("button",{onClick:()=>m(H=>Math.min(F,H+1)),disabled:V===F,"aria-label":"次へ",className:"p-3.5 -m-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed",children:n.jsx(pr,{className:"w-4 h-4","aria-hidden":!0})})]})]}),n.jsx("div",{className:"flex justify-center",children:n.jsxs(le,{variant:"secondary",onClick:()=>d({initialDate:"",initialTime:"ALL"}),children:[n.jsx(cs,{className:"w-4 h-4","aria-hidden":!0})," 新しい臨時日程を追加"]})})]}),h==="admin"&&n.jsxs(Ue,{title:"Google ビジネスプロフィール 休業日同期",icon:To,children:[n.jsxs("div",{className:"text-sm text-gray-600 mb-4 space-y-1",children:[n.jsx("p",{children:"カレンダーの臨時休診・臨時診療(終日/午前/午後)と祝日を Google ビジネスプロフィールの「特別営業時間」に反映します。"}),n.jsx("p",{className:"text-xs text-gray-500",children:"・対象期間: 今日から先 60 日 ・対象種別: 臨時休診/臨時診療(終日・午前・午後)+祝日 ・毎朝 9:00 に自動同期されます"})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[n.jsxs(le,{variant:"primary",onClick:()=>void _(),disabled:R,children:[n.jsx(To,{className:`w-4 h-4 ${R?"animate-spin":""}`,"aria-hidden":!0}),R?"同期中…":"今すぐ同期する"]}),g&&n.jsxs("span",{className:"text-xs text-gray-500",children:["最終同期: ",Kp(g.synced_at),"(",g.status==="success"?"成功":g.status==="skip"?"差分なし":"エラー",")"]})]}),j&&n.jsxs("div",{className:`flex items-start gap-2 p-3 rounded-lg text-sm border
389              ${j.status==="success"?"bg-green-50 border-green-200 text-green-800":j.status==="skip"?"bg-gray-50 border-gray-200 text-gray-700":"bg-red-50 border-red-200 text-red-800"}`,children:[j.status==="success"?n.jsx(tf,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}):j.status==="skip"?n.jsx(bp,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}):n.jsx(Ro,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),n.jsx("div",{className:"whitespace-pre-wrap",children:j.message})]})]})]})}function Xp({announcement:l,setAnnouncement:o,saveAnnouncement:c,isAnnouncementDirty:d}){const[h,x]=f.useState(!1),[m,p]=f.useState(""),w=rn(),g=async()=>{x(!0),p("");const k=await c();x(!1),k.ok?w("お知らせを保存して公開しました","success"):p(k.error==="conflict"?"他の変更と競合しました。もう一度お試しください。":k.error)};return n.jsx("div",{className:"space-y-6 animate-in fade-in duration-300",children:n.jsxs(Ue,{title:"次回配信お知らせメモ",icon:af,description:"公式LINEやホームページで次回月次配信する際に伝えたい内容のメモを入力してください。このメモと翌月の臨時スケジュールをもとに、「配信管理」タブでClaudeがメッセージを自動生成します。",children:[n.jsx("textarea",{value:l,onCh
389ange:k=>o(k.target.value),placeholder:`例:6月よりインフルエンザワクチンの予約を開始します。詳細はホームページをご確認ください。
390また、6/15(月)は院内研修のため午後休診となります。`,className:"w-full h-64 border border-gray-300 rounded-lg p-4 focus:ring-2 focus:ring-accent outline-none resize-y bg-white text-sm leading-relaxed"}),n.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[n.jsxs("p",{className:"text-xs text-gray-500",children:[l.length,"文字"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[d&&n.jsx("span",{className:"text-xs font-medium text-amber-700 bg-amber-50 border border-amber-200 rounded-full px-2.5 py-1",children:"未保存の変更あり"}),m&&n.jsx("span",{className:"text-xs text-red-600",children:m}),n.jsx(le,{variant:"primary",size:"sm",onClick:()=>void g(),disabled:h||!d,children:h?"保存中…":"保存して公開"})]})]})]})})}const Zp=["日","月","火","水","木","金","土"];function eh(l,o,c,d,h,x){const m=th(l,o+1,c),p=new Date(l,o,c).getDay(),w={am:{isOpen:d[p].am.isOpen,type:"regular",docs:[...d[p].am.doctors]},pm:{isOpen:d[p].pm.isOpen,type:"regular",docs:[...d[p].pm.doctors]}};if(x[m]){const g=x[m];w.am={isOpen:!1,type:"holiday",docs:[],holidayName:g},w.pm={isOpen:!1,type:"holiday",docs:[],holidayName:g}}for(const g of h.filter(k=>k.date===m)){const k=g.time==="ALL"||g.time==="AM",j=g.time==="ALL"||g.time==="PM";if(g.type==="closed"){const N=R=>{if(g.doctors.length>0){const T=R.docs.filter(b=>!g.doctors.includes(b));return T.length===0&&R.isOpen?{isOpen:!1,type:"temp_closed",docs:[]}:{...R,docs:T}}return{isOpen:!1,type:"temp_closed",docs:[]}};k&&(w.am=N(w.am)),j&&(w.pm=N(w.pm))}else{const N=()=>({isOpen:!0,type:g.type==="change"?"temp_change":"temp_open",docs:g.doctors});k&&(w.am=N()),j&&(w.pm=N())}}return w}function th(l,o,c){return`${l}-${String(o).padStart(2,"0")}-${String(c).padStart(2,"0")}`}function nh(l){const[o,c,d]=l.split("-").map(Number),h=new Date(o,c-1,d).getDay();return`${o}年${c}月${d}日(${Zp[h]})`}function rh(l){return l.getUTCMonth()===11?{year:l.getUTCFullYear()+1,month:0}:{year:l.getUTCFullYear(),month:l.getUTCMonth()+1}}function sh(l,o,c){const d=`${o}-${String(c+1).padStart(2,"0")}`;return l.filter(h=>h.date.startsWith(d))}function ah(l,o,c,d,h){var T,b;const x=d.filter(v=>v.date===l),m=x.find(v=>v.time===o)??(o!=="ALL"?x.find(v=>v.time==="ALL"):void 0)??(o==="ALL"&&x.length===1?x[0]:void 0);if(m)return{existing:m,type:m.type,doctors:m.doctors};const[p,w,g]=l.split("-").map(Number),k=new Date(p,w-1,g).getDay(),j=c[k],N=o==="PM"?j==null?void 0:j.pm:o==="AM"?j==null?void 0:j.am:(T=j==null?void 0:j.am)!=null&&T.isOpen?j.am:(b=j==null?void 0:j.pm)!=null&&b.isOpen?j.pm:j==null?void 0:j.am;return!h[l]&&!!(N!=null&&N.isOpen)?{type:"change",doctors:[...(N==null?void 0:N.doctors)??[]]}:{type:"open",doctors:[]}}const lh=["日","月","火","水","木","金","土"];function ih({slot:l,doctors:o}){if(!l.isOpen)return l.type==="temp_closed"?n.jsx("div",{className:"text-red-600 font-bold text-[10px] bg-red-100 px-1 py-0.5 rounded text-center",children:"臨時休診"}):l.type==="holiday"?n.jsx("div",{className:"text-semantic-error font-bold text-[10px] bg-red-50 px-1 py-0.5 rounded text-center",children:"祝日"}):n.jsx("div",{className:"text-gray-500 text-center font-bold text-sm",children:"ー"});const c=l.type==="temp_open"?"text-semantic-success":l.type==="temp_change"?"text-orange-700":"text-accent-fg",d=l.type==="temp_open"?"(臨)":l.type==="temp_change"?"(変)":"";return n.jsxs("div",{className:"flex flex-col gap-0.5",children:[n.jsxs("div",{className:`font-bold text-center text-xs leading-none ${c}`,children:["◯ ",n.jsx("span",{className:"text-[10px] font-normal",children:d})]}),n.jsx("div",{className:"flex flex-wrap gap-0.5 justify-center",children:l.docs.map(h=>{const x=o.find(m=>m.id===h);return x?n.jsx("span",{className:`text-[10px] px-1 py-0.5 rounded border leading-none ${yn[us(x.color)].classes}`,children:x.name},h):null})})]})}function oh({year:l,month:o,onPrev:c,onNext:d,weeklySchedule:h,exceptions:x,doctors:m,clinicSettings:p,holidays:w,onDateClick:g,readOnly:k=!1}){const j=new Date(l,o+1,0).getDate(),N=new Date(l,o,1).getDay();return n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-3",children:[n.jsxs("h2",{className:"text-lg font-bold text-gray-800 bg-gray-50 px-4 py-2 rounded-lg border",children:[l,"年 ",o+1,"月"]}),(c||d)&&n.jsxs("div",{className:"flex gap-2",children:[c&&n.jsx("button",{onClick:c,"aria-label":"前の月",className:"p-2 border rounded hover:bg-gray-100",children:n.jsx(is,{className:"w-5 h-5 text-gray-600","aria-hidden":!0})}),d&&n.jsx("button",{onClick:d,"aria-label":"次の月",className:"p-2 border rounded hover:bg-gray-100",children:n.jsx(pr,{className:"w-5 h-5 text-gray-600","aria-hidden":!0})})]})]}),!k&&n.jsxs("div",{className:"text-xs text-accent-fg mb-3 bg-accent-subtle p-2.5 rounded border border-accent-subtle-2 flex items-center gap-2",children:[n.jsx(_l,{className:"w-4 h-4 flex-shrink-0"}),"日付をクリックして臨時休診・担当医変更などを直接設定できます"]}),n.jsxs("div",{className:"grid grid-cols-7 border-t border-l bg-white",children:[lh.map((R,T)=>n.jsx("div",{className:`p-2 text-center border-b border-r font-bold text-sm
391              ${T===0?"text-semantic-error bg-red-50/50":T===6?"text-accent-fg bg-
391accent-subtle/50":"text-gray-700 bg-gray-50"}`,children:R},R)),Array.from({length:N}).map((R,T)=>n.jsx("div",{className:"border-b border-r bg-gray-50/30 min-h-[110px]"},`e${T}`)),Array.from({length:j}).map((R,T)=>{const b=T+1,v=`${l}-${String(o+1).padStart(2,"0")}-${String(b).padStart(2,"0")}`,D=eh(l,o,b,h,x,w),_=new Date(l,o,b).getDay(),z=!!w[v],F=D.am.type.startsWith("temp")||D.pm.type.startsWith("temp");return n.jsxs("div",{className:`p-1 border-b border-r min-h-[110px] flex flex-col
392                ${F?"bg-yellow-50/40":z?"bg-red-50/20":""}`,children:[n.jsxs("div",{onClick:()=>!k&&(g==null?void 0:g(v,"ALL")),className:`flex justify-between items-center text-xs mb-1 px-1 rounded
393                  ${k?"":"cursor-pointer hover:bg-accent-subtle-2 transition-colors"}
394                  ${_===0||z?"text-semantic-error font-bold":_===6?"text-accent-fg font-bold":"text-gray-700 font-bold"}`,children:[n.jsx("span",{className:"text-[10px] truncate max-w-[65%] text-semantic-error font-normal",children:z?w[v]:""}),n.jsx("span",{children:b})]}),n.jsx("div",{className:"flex-grow flex flex-col gap-0.5",children:["am","pm"].map(V=>n.jsxs("div",{onClick:()=>!k&&(g==null?void 0:g(v,V==="am"?"AM":"PM")),className:`flex-1 bg-gray-50/80 rounded p-1 flex flex-col
395                      ${k?"":"cursor-pointer hover:bg-accent-subtle hover:shadow-inner transition-all"}`,children:[n.jsxs("span",{className:"text-[10px] text-gray-500 mb-0.5 font-medium flex justify-between",children:[n.jsx("span",{children:V==="am"?"午前":"午後"}),n.jsx("span",{className:"text-[10px] text-gray-500",children:V==="am"?`${p.amStart}-${p.amEnd}`:`${p.pmStart}-${p.pmEnd}`})]}),n.jsx(ih,{slot:D[V],doctors:m})]},V))})]},b)})]})]})}function ch({weeklySchedule:l,exceptions:o,doctors:c,clinicSettings:d,holidays:h,currentDate:x,setCurrentDate:m,onDateClick:p}){const w=x.getFullYear(),g=x.getMonth();return n.jsx("div",{className:"animate-in fade-in duration-300",children:n.jsx("section",{className:"bg-white p-6 rounded-xl shadow-sm border border-gray-100",children:n.jsx(oh,{year:w,month:g,onPrev:()=>m(new Date(w,g-1,1)),onNext:()=>m(new Date(w,g+1,1)),weeklySchedule:l,exceptions:o,doctors:c,clinicSettings:d,holidays:h,onDateClick:p})})})}let ff=[],mf=0,Wo={page:1,pageSize:10},yo=0;const Lo=new Set,uh=()=>Lo.forEach(l=>l());function pf(l){const o=new URL("/api/sent-notices",window.location.origin);return o.searchParams.set("page",String(l.page)),o.searchParams.set("pageSize",String(l.pageSize)),l.q&&o.searchParams.set("q",l.q),l.from&&o.searchParams.set("from",l.from),l.to&&o.searchParams.set("to",l.to),o.toString()}const Bo=async l=>
395{const o=++yo,c=await fetch(pf(l),{credentials:"same-origin"});if(o!==yo)return;if(!c.ok){if(c.status===401)return;throw new Error(`HTTP ${c.status}`)}const d=await c.json();o===yo&&(ff=d.notices??[],mf=d.total??0,d.page??l.page,d.pageSize??l.pageSize,Wo=l,uh())},dh=l=>(Lo.add(l),()=>{Lo.delete(l)}),Ed=()=>[...ff],Cd=()=>mf,fh=async l=>{try{const o=await fetch(pf({page:1,pageSize:l}),{credentials:"same-origin"});return o.ok?(await o.json()).notices??[]:[]}catch{return[]}},na=async l=>{const o=await fetch("/api/sent-notices",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});if(!o.ok){const d=await o.json().catch(()=>({}));throw new Error(d.error??`HTTP ${o.status}`)}const c=await o.json();return await Bo(Wo).catch(d=>console.warn("sentNoticeRepository: post-save refresh failed",d)),c.notice},mh=async l=>{const o=await fetch(`/api/sent-notices/${encodeURIComponent(l)}`,{method:"DELETE",credentials:"same-origin"});if(!o.ok){const c=await o.json().catch(()=>({}));throw new Error(c.error??`HTTP ${o.status}`)}await Bo(Wo).catch(c=>console.warn("sentNoticeRepository: post-delete refresh failed",c))},ph="clinic-calendar-widget";function hh(l){const o=l.indexOf(ph);if(o===-1)return l.trim();const c=l.lastIndexOf("<div",o),d=c===-1?o:c;let h=l.slice(0,d);return h=h.replace(/<h3>[^<]*?月の診療カレンダー<\/h3>\s*$/,""),h.trim()}const hf="年頭の挨拶",xh=/年頭の挨拶|新年のご挨拶/,Po="▼年頭のご挨拶(ホームページ)";function la(l){return/^\d{4}-01$/.test(l)}function xf(l){return/^\d{4}年1月$/.test(l)}function rs(l){return`new-year-${l}`}function gh(l,o){const c=l.replace(new RegExp("(?:https?:\\/\\/|(?<![\\w@.])www\\.)[\\x21-\\x7e]+","gi"),"").split(/\r?\n/).filter(h=>h.trim()!==Po).join(`
396`).replace(/[ \t]+$/gm,"").replace(/\n{3,}/g,`
397
398`).trim(),d=`${Po}
399${o}`;return c?`${c}
400
401${d}`:d}const yh=/https:\/\/[^\s/]+\/new-year-\d{4}(?:-\d+)?(?![\w-])/g;function Nl(l){return gf(l)[0]??null}function gf(l){return[...new Set(l.match(yh)??[])]}function vh(l){try{const o=new URL(l),c=o.pathname.match(/^\/(new-year-(\d{4})(?:-\d+)?)$/);return c?{origin:o.origin,slug:c[1],year:Number(c[2])}:null}catch{return null}}function Vo(l){return Nl(l)!==null||l.includes(Po)}function yf(l,o){return xh.test(l)||Vo(o)}function wh(l,o){try{return`${new URL(l).origin}/${o}`}catch{return null}}const jh="【1月の診療予定】",Nh={closed:"休診",open:"臨時診療",change:"担当医変更"},Sh={ALL:"",AM:"午前",PM:"午後"},_d={ALL:0,AM:1,PM:2},Td={closed:0,open:1,change:2},kh=["日","月","火","水","木","金","土"];function bh(l){if(!l||typeof l!="object")return!1;const o=l;if(typeof o.date!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(o.date))return!1;const[c,d,h]=o.date.split("-").map(Number),x=new Date(Date.UTC(c,d-1,h));return x.getUTCFullYear()!==c||x.getUTCMonth()!==d-1||x.getUTCDate()!==h?!1:(o.type==="closed"||o.type==="open"||o.type==="change")&&(o.time==="ALL"||o.time==="AM"||o.time==="PM")}function Eh(l,o){const c=`${o}-01-`,d=l.filter(bh).filter(x=>x.date.startsWith(c));d.sort((x,m)=>x.date.localeCompare(m.date)||_d[x.time]-_d[m.time]||Td[x.type]-Td[m.type]);const h=d.map(x=>{const[m,p,w]=x.date.split("-").map(Number),g=kh[new Date(Date.UTC(m,p-1,w)).getUTCDay()],k=Sh[x.time];return`${p}月${w}日(${g}) ${k?`${k} `:""}${Nh[x.type]}`});return[...new Set(h)]}function Ch(l){const o=l.replace(/\r\n?/g,`
402`).split(`
403`).map(m=>m.trim()),c=Sl(jh),d=o.findIndex(m=>Sl(m)===c);if(d===-1)return null;const h=[];let x=d+1;for(;x<o.length&&o[x]==="";)x++;for(;x<o.length&&/^[・・·•]/.test(o[x]);x++)h.push(o[x].slice(1).trim());return h}function Sl(l){return l.normalize("NFKC").replace(/\s/g,"")}function _h(l,o){return l.length===o.length&&l.every((c,d)=>Sl(c)===Sl(o[d]))}function Th(l){const o=Array.isArray(l.doctors)&&l.doctors.length>0;return{date:l.date,type:l.type==="closed"&&o?"change":l.type,time:l.time}}const Pl=5,vf=async l=>(await fh(l*3)).filter(c=>!yf(c.title,c.body)).slice(0,l),wf=async(l=Pl)=>{const o=await vf(l);return o.length===0?"":["---","以下は過去に実際に配信したお知らせの例です。","文体・トーン・表現スタイルを参考に、一貫性のある文章を生成してください。","",...o.map((d,h)=>{const x=new Date(d.sent_at).toLocaleDateString("ja-JP",{year:"numeric",month:"long",day:"numeric"});return[`【過去の配信例 ${h+1}】(${x} 配信)`,`タイトル: ${d.title}`,"本文:",hh(d.body)].join(`
404`)}),"---"].join(`
405`)},Lh=async(l,o=Pl)=>{const c=await wf(o);return c?[l,"",c].join(`
406`).trimStart():l},Ph=async(l,o=Pl)=>{const c=await wf(o);return c?[l,"",c].join(`
407`).trimStart():l},Mh=async(l=Pl)=>(await vf(l)).length,$h=10,Dh=300;function zh(){const[l,o]=f.useState(Ed()),[c,d]=f.useState(Cd()),[h,x]=f.useState(1),[m,p]=f.useState($h),[w,g]=f.useState(""),[k,j]=f.useState(""),[N,R]=f.useState(""),[T,b]=f.useState(""),[v,D]=f.useState(!1),[_,z]=f.useState("");f.useEffect(()=>dh(()=>{o(Ed()),d(Cd())}),[]),f.useEffect(()=>{const re=setTimeout(()=>j(w),Dh);return()=>clearTimeout(re)},[w]);const F=f.useCallback(async()=>{D(!0),z("");try{await Bo({page:h,pageSize:m,q:k||void 0,from:N||void 0,to:T||void 0})}catch(re){z(re instanceof Error?re.message:String(re))}finally{D(!1)}},[h,m,k,N,T]);f.useEffect(()=>{F()},[F]),f.useEffect(()=>{const re=Math.max(1,Math.ceil(c/m));h>re&&x(re)},[c,m,h]);const V=re=>{g(re),x(1)},M=re=>{R(re),x(1)},J=re=>{b(re),x(1)},H=re=>{p(re),x(1)},W=f.useCallback(async re=>na(re),[]),Ne=f.useCallback(async re=>mh(re),[]);return{notices:l,total:c,page:h,setPage:x,pageSize:m,setPageSize:H,query:w,setQuery:V,fromDate:N,setFromDate:M,toDate:T,setToDate:J,save:W,softDelete:Ne,reload:F,loading:v,error:_}}const Rh=[10,25,50,100];function Ah({query:l,setQuery:o,fromDate:c,setFromDate:d,toDate:h,setToDate:x,pageSize:m,setPageSize:p,total:w}){const g=l.trim()!==""||c!==""||h!=="",k=()=>{o(""),d(""),x("")};return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Ll,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500 pointer-events-none"}
407),n.jsx("input",{type:"text",value:l,onChange:j=>o(j.target.value),placeholder:"タイトル・本文で検索...",className:"w-full border border-gray-300 rounded-lg pl-9 pr-9 py-2 text-sm focus:ring-2 focus:ring-accent outline-none bg-white"}),l&&n.jsx("button",{onClick:()=>o(""),className:"absolute right-0 top-1/2 -translate-y-1/2 p-3.5 text-gray-500 hover:text-gray-600","aria-label":"検索をクリア",children:n.jsx(mr,{className:"w-4 h-4","aria-hidden":!0})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[n.jsx("span",{className:"text-gray-500 whitespace-nowrap",children:"配信日:"}),n.jsx("input",{type:"date",value:c,onChange:j=>d(j.target.value),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:ring-2 focus:ring-accent outline-none","aria-label":"開始日"}),n.jsx("span",{className:"text-gray-500",children:"〜"}),n.jsx("input",{type:"date",value:h,onChange:j=>x(j.target.value),min:c||void 0,className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:ring-2 focus:ring-accent outline-none","aria-label":"終了日"}),g&&n.jsxs(le,{variant:"ghost",size:"sm",onClick:k,children:[n.jsx(mr,{className:"w-3.5 h-3.5","aria-hidden":!0})," フィルターをクリア"]})]}),n.jsxs("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[n.jsxs("p",{children:[g?"該当":"全"," ",n.jsx("span",{className:"font-semibold text-gray-700",children:w})," 件"]}),n.jsxs("label",{className:"flex items-center gap-2",children:[n.jsx("span",{children:"表示件数"}),n.jsx("select",{value:m,onChange:j=>p(Number(j.target.value)),className:"border border-gray-200 rounded px-2 py-1 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-accent",children:Rh.map(j=>n.jsxs("option",{value:j,children:[j,"件"]},j))})]})]})]})}const Ih={all:"全患者",group:"グループ"},Oh=l=>Ih[l]??l,Uh=(l,o)=>l.length>o?l.slice(0,o)+"…":l;function Fh({notice:l,onViewDetail:o,onUseAsTemplate:c}){const d=new Date(l.sent_at).toLocaleDateString("ja-JP",{year:"numeric",month:"long",day:"numeric"});return n.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 hover:shadow-md hover:border-accent-border transition-all duration-150",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[n.jsx("h3",{className:"font-bold text-gray-800 text-sm leading-snug line-clamp-2 flex-1",children:l.title}),n.jsxs("div",{className:"flex items-center gap-1 text-xs text-gray-500 whitespace-nowrap flex-shrink-0",children:[n.jsx(Do,{className:"w-3.5 h-3.5"}),d]})]}),n.jsx("p",{className:"text-sm text-gray-600 leading-relaxed mb-3 whitespace-pre-wrap",children:Uh(l.body,100)}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-gray-500 mb-3",children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(cf,{className:"w-3 h-3"}),Oh(l.target)]}),n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Fo,{className:"w-3 h-3"}),l.created_by]})]}),n.jsxs("div",{className:"flex items-center gap-2 pt-3 border-t border-gray-100",children:[n.jsxs(le,{variant:"ghost",size:"sm",onClick:()=>o(l),children:[n.jsx(Ao,{className:"w-3.5 h-3.5","aria-hidden":!0})," 詳細を見る"]}),n.jsxs(le,{variant:"primary",size:"sm",onClick:()=>c(l),children:[n.jsx(as,{className:"w-3.5 h-3.5","aria-hidden":!0})," テンプレートとして使用"]})]})]})}const Hh={all:"全患者",group:"グループ"},Wh=l=>Hh[l]??l;function Bh({notice:l,onClose:o,onUseAsTemplate:c}){const[d,h]=f.useState(!1),x=new Date(l.sent_at).toLocaleString("ja-JP",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"}),m=()=>{navigator.clipboard.writeText(l.body).catch(()=>{const p=document.createElement("textarea");p.value=l.body,document.body.appendChild(p),p.select(),document.execCommand("copy"),document.body.removeChild(p)}),h(!0),setTimeout(()=>h(!1),2500)};return n.jsx(Qn,{title:"配信済みお知らせ詳細",icon:n.jsx(wl,{className:"w-5 h-5 text-accent-fg","aria-hidden":!0}),onClose:o,widthClassName:"max-w-2xl",footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",onClick:o,children:"閉じる"}),n.jsxs(le,{variant:"primary",onClick:()=>{c(l),o()},children:[n.jsx(as,{className:"w-4 h-4","aria-hidden":!0}),"テンプレートとして使用"]})]}),children:n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide mb-1",children:"タイトル"}),n.jsx("p",{className:"text-base font-bold text-gray-800 leading-snug",children:l.title})]}),n.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4 bg-gray-50 rounded-lg p-4 text-sm",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Do,{
407className:"w-4 h-4 text-gray-500 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-gray-500 mb-0.5",children:"配信日時"}),n.jsx("p",{className:"text-gray-700 font-medium leading-snug",children:x})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(cf,{className:"w-4 h-4 text-gray-500 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-gray-500 mb-0.5",children:"配信対象"}),n.jsx("p",{className:"text-gray-700 font-medium",children:Wh(l.target)})]})]}),n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Fo,{className:"w-4 h-4 text-gray-500 flex-shrink-0 mt-0.5"}),n.jsxs("div",{children:[n.jsx("p",{className:"text-xs text-gray-500 mb-0.5",children:"作成者"}),n.jsx("p",{className:"text-gray-700 font-medium",children:l.created_by})]})]})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsx("p",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wide",children:"本文"}),n.jsx("button",{onClick:m,className:`flex items-center gap-1.5 text-xs px-2.5 py-1.5 rounded border transition-all
408                  ${d?"bg-green-50 border-green-300 text-green-700":"border-gray-300 text-gray-500 hover:bg-gray-50 hover:text-gray-700"}`,children:d?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-3.5 h-3.5"})," コピー完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(as,{className:"w-3.5 h-3.5"})," 本文をコピー"]})})]}),n.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-4 text-sm text-gray-700 leading-relaxed whitespace-pre-wrap max-h-64 overflow-y-auto",children:l.body})]}),n.jsxs("p",{className:"text-[10px] text-gray-500 font-mono",children:["ID: ",l.id]})]})})}function Vh({onUseAsTemplate:l}){const{notices:o,total:c,page:d,setPage:h,pageSize:x,setPageSize:m,query:p,setQuery:w,fromDate:g,setFromDate:k,toDate:j,setToDate:N,loading:R,error:T,reload:b}=zh(),[v,D]=f.useState(null),_=p.trim()!==""||g!==""||j!=="",z=Math.max(1,Math.ceil(c/x)),F=Math.min(d,z),V=M=>{l(M)};return n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"bg-gray-50 border border-gray-200 rounded-xl p-4",children:n.jsx(Ah,{query:p,setQuery:w,fromDate:g,setFromDate:k,toDate:j,setToDate:N,pageSize:x,setPageSize:m,total:c})}),T&&n.jsxs("div",{className:"flex items-center justify-between gap-3 bg-red-50 border border-red-200 text-red-700 rounded-lg px-4 py-3 text-sm",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(xr,{className:"w-4 h-4 flex-shrink-0","aria-hidden":!0}),"読み込みに失敗しました(",T,")。表示中の内容は最新でない可能性があります。"]}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>void b(),children:"再試行"})]}),n.jsx("div",{className:R?"opacity-60 transition-opacity":"transition-opacity",children:c===0?_?n.jsx("div",{className:"text-center py-12 bg-gray-50 border border-dashed border-gray-300 rounded-xl",children:n.jsx("p",{className:"text-gray-500",children:"検索条件に一致するお知らせがありません。"})}):n.jsxs("div",{className:"text-center py-16 bg-gray-50 border border-dashed border-gray-300 rounded-xl",children:[n.jsx(wl,{className:"w-10 h-10 text-gray-300 mx-auto mb-3","aria-hidden":!0}),n.jsx("p",{className:"text-gray-500 font-medium mb-1",children:"配信済みお知らせはまだありません"}),n.jsx("p",{className:"text-sm text-gray-500",children:"LINE・WordPress へ配信すると、ここに自動で保存さã
408‚Œã¾ã™ã€‚"})]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:o.map(M=>n.jsx(Fh,{notice:M,onViewDetail:D,onUseAsTemplate:V},M.id))}),z>1&&n.jsxs("div",{className:"flex items-center justify-center gap-2 pt-2",children:[n.jsx("button",{onClick:()=>h(Math.max(1,F-1)),disabled:F===1,className:"p-3.5 -m-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"前のページ",children:n.jsx(is,{className:"w-4 h-4","aria-hidden":!0})}),Array.from({length:z},(M,J)=>J+1).map(M=>n.jsx("button",{onClick:()=>h(M),"aria-current":M===F?"page":void 0,className:`w-11 h-11 rounded text-sm font-medium transition-colors
409                    ${M===F?"bg-accent text-on-accent":"text-gray-600 hover:bg-gray-100"}`,children:M},M)),n.jsx("button",{onClick:()=>h(Math.min(z,F+1)),disabled:F===z,className:"p-3.5 -m-1.5 rounded hover:bg-gray-100 disabled:opacity-30 disabled:cursor-not-allowed transition-colors","aria-label":"次のページ",children:n.jsx(pr,{className:"w-4 h-4","aria-hidden":!0})})]})]})}),v&&n.jsx(Bh,{notice:v,onClose:()=>D(null),onUseAsTemplate:M=>{V(M),D(null)}})]})}function vo(l){return la(l)?"newyear":"schedule"}function Ld(l){return xf(l)?"newyear":"schedule"}function Yh(l){const o=l.match(/^(\d{4})年\d{1,2}月$/);return o?Number(o[1]):null}function kl(l,o){return l==="newyear"?hf:`${o} 診療カレンダー・お知らせ`}function Qh(l){return xf(l)?hf:`${l} 診療カレンダー・お知らせ`}function Pd(l,o,c){return l==="newyear"?{...c,slug:rs(o)}:{...c}}function fr(l,o,c){return l==="newyear"?`${o}-01-01T00:00`:c}function Kh(l,o){return l==="newyear"?"年頭の挨拶 LINE配信":`${o} LINE配信`}function Jh(l,o){return Vo(l)?"年頭の挨拶 LINE配信(予約送信)":`${o} LINE配信(予約送信)`}function wo(l){return l!=="newyear"}function qh(l,o){return la(l)?o:void 0}function Md(l,o,c,d){return l===kl(o,d)?kl(c,d):l}function Gh(l,o,c){const d=wh(l,o);if(!d)return{state:"unknown"};const h=Nl(c);return h===d?{state:"match",url:d}:{state:"mismatch",actual:d,expected:h}}function Xh(l,o){return gh(l,o)}function Zh(l,o){return!l||!o?!1:gf(l).some(c=>c!==o)}const ex=900*1e3;function tx(l,o,c){if(!o||!c||!Vo(c))return null;const d=Date.parse(`${o}T00:00:00Z`);return!Number.isFinite(d)||l<d?null:l<d+ex?"processing":"unsent"}function jf(l,o){return l<Date.parse(`${o}-01-01T00:00:00+09:00`)}function nx(l,o){return l===o?null:`この配信案は${l}分です(画面の翌月は${o})。予約日の既定値を確認してください`}function $d(l,o,c,d,h){const x=[];return l!=="newyear"?{lines:x}:(c||x.push("ホームページ記事の URL がまだ確認できていません(先に WordPress を予約してください)"),d==="now"&&jf(h,o)&&x.push("年内に送信しようとしています。LINE の記事 URL は 1/1 の公開まで 404 です"),{lines:x})}function rx(l,o,c){return l==="newyear"&&jf(c,o)?{lines:["年内に公開しようとしています。年頭の挨拶は 1/1 に公開する想定です"]}:{lines:[]}}function sx(l,o){return yf(l,o)?"newyear":null}function jo(l,o){return la(l)?o:"schedule"}function Dd(l,o,c){const d=Eh(o.map(Th),c),h=Ch(l);return(h===null?d.length===0:_h(h,d))?null:h===null?`LINE に「1月の診療予定」が入っていませんが、臨時予定には 1 月の登録が ${d.length} 件あります(予約した場合は元旦に保留されます)`:`LINE の「1月の診療予定」が臨時予定の登録と違います(登録:${d.length>0?d.join("/"):"0 件"})。予約した場合は元旦に保留されます`}const No="deliveryDraft_v1";function ax({clinicSettings:l,exceptions:o,announcement:c,doctors:d,holidays:h,linePrompt:x,wpPrompt:m,setLinePrompt:p,setWpPrompt:w,deliverySettings:g,setDeliverySettings:k,saveDelivery:j,pendingMessages:N,clearPendingMessages:R,loadFromServer:T,scheduledLine:b,setScheduledLine:v,initialSegment:D,onInitialSegmentConsumed:_}){const z=Kn(),[F,V]=f.useState(D??"create");f.useEffect(()=>{D&&(_==null||_())},[]);const[M,J]=f.useState(null),H=A=>{J(A),V("create")},W=new Date,Ne=new Date(W.getTime()+540*60*1e3),{year:re,month:ee}=rh(Ne),Z=`${re}年${ee+1}月`,xe=`${re}-${String(ee+1).padStart(2,"0")}`,be=sh(o,re,ee),[je,ne]=f.useState(""),[I,ie]=f.useState(""),[B,C]=f.useState(()=>vo(xe)),[O,ye]=f.useState(re),[G,fe]=f.useState(null),[ke,_e]=f.useState(null),[U,te]=f.useState(null),[he,ge]=f.useState(null),Pe=f.useRef(null);f.useEffect(()=>{const A=new URLSearchParams(window.location.search).get("extIdeaId");if(A){Pe.current=A;const Q=new URL(window.location.href);Q.searchParams.delete("extIdeaId"),window.history.replaceState(null,"",Q.toString())}},[]);const Ge=()=>{const A=Pe.current;A&&(Pe.current=null,fetch("/api/resolve-external-idea",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({ideaId:A})}).catch(Q=>console.warn("resolve-external-idea failed",Q)))},[Me,ze]=f.useState("idle"),[Ve,Ke]=f.useState(""),[pe,$e]=f.useState(!1),[De,Xe]=f.useState(!1),[wt,vn]=f.useState(!1),[st,gr]=f.useState(null);f.useEffect(()=>{if(!wt)return;let A=!1;return Mh().then(Q=>{A||gr(Q)}),()=>{A=!0}},[wt]),f.useEffect(()=>{M&&(ne(M.body),ie(M.body),sx(M.title,M.body)?(C("newyear"),ye(re)):la(xe)||(B==="newyear"&&(Jt(A=>Md(A,"newyear","schedule",Z)),Nt(A=>A===fr("newyear",O,Pt)?Pt:A)),C("schedule")),ge(null),ze("done"),J(null))},[M]);const oa=(()=>{const A=new Date(re,ee,1),Q=new Date(W.getFullYear(),W.getMonth(),W.getDate()+1),ae=A>W?A:Q;return`${ae.getFullYear()}
409-${String(ae.getMonth()+1).padStart(2,"0")}-${String(ae.getDate()).padStart(2,"0")}`})(),[sn,yr]=f.useState(oa),[an,jt]=f.useState(!1),[Kt,ln]=f.useState(""),[wn,vr]=f.useState("idle"),[Ml,wr]=f.useState(""),Pt=(()=>{const A=new Date(re,ee,1,9,0),Q=new Date(W.getFullYear(),W.getMonth(),W.getDate()+1,9,0),ae=A>W?A:Q,Ee=ae.getFullYear(),Ye=String(ae.getMonth()+1).padStart(2,"0"),En=String(ae.getDate()).padStart(2,"0"),Xn=String(ae.getHours()).padStart(2,"0"),Zn=String(ae.getMinutes()).padStart(2,"0");return`${Ee}-${Ye}-${En}T${Xn}:${Zn}`})(),[it,Jt]=f.useState(()=>kl(vo(xe),Z)),[on,Nt]=f.useState(()=>fr(vo(xe),re,Pt)),[St,jr]=f.useState("idle"),[ca,ds]=f.useState(""),[fs,ua]=f.useState(""),[qt,Nr]=f.useState("idle"),[Jn,Sr]=f.useState(""),[jn,$l]=f.useState(""),[Gt,Nn]=f.useState("idle"),[kr,br]=f.useState(""),qn=rn(),[cn,Er]=f.useState("idle"),[Xt,da]=f.useState(""),ms=f.useRef(!1),ps=f.useRef(!1),Cr=async()=>{ps.current=!1,Er("saving");const A=await j();A.ok?(Er("saved"),setTimeout(()=>Er("idle"),2e3)):(Er("error"),da(A.error==="conflict"?"他の変更と競合しました":A.error))};f.useEffect(()=>{if(!ms.current){ms.current=!0;return}ps.current=!0;const A=setTimeout(()=>{Cr()},1500);return()=>clearTimeout(A)},[x,m]),f.useEffect(()=>{const A=()=>{ps.current&&Cr()},Q=()=>A(),ae=()=>{document.visibilityState==="hidden"&&A()};return window.addEventListener("pagehide",Q),document.addEventListener("visibilitychange",ae),()=>{window.removeEventListener("pagehide",Q),document.removeEventListener("visibilitychange",ae),A()}},[]);const fa=()=>{Cr()},hs=f.useRef(null),Gn=()=>{try{localStorage.removeItem(No)}catch{}hs.current={lineMsg:je,wpMsg:I,wpTitle:it,forMonth:Z,edition:B,editionYear:O}};f.useEffect(()=>{var A;if(!M)try{const Q=localStorage.getItem(No);if(!Q)return;const ae=JSON.parse(Q);if(!ae.lineMsg&&!ae.wpMsg||ae.forMonth!==Z)return;ne(ae.lineMsg??""),ie(ae.wpMsg??""),ae.wpTitle&&Jt(ae.wpTitle),C(ae.edition==="newyear"?"newyear":"schedule"),typeof ae.editionYear=="number"&&ye(ae.editionYear),ae.edition==="newyear"&&Nt(fr("newyear",ae.editionYear??re,Pt)),ae.edition==="newyear"&&((A=ae.wpPosted)!=null&&A.postUrl)&&ae.wpPosted.slug&&ge(ae.wpPosted),ze("done"),qn("下書きを復元しました","info")}catch(Q){console.warn("draft restore failed",Q)}},[]);const ma=f.useRef({lineMsg:"",wpMsg:"",wpTitle:"",forMonth:Z});f.useEffect(()=>{ma.current={lineMsg:je,wpMsg:I,wpTitle:it,forMonth:Z,edition:B,editionYear:O,wpPosted:he}});const _r=()=>{const A=ma.current,Q=hs.current;if(!(Q&&Q.lineMsg===A.lineMsg&&Q.wpMsg===A.wpMsg&&Q.wpTitle===A.wpTitle))try{(A.lineMsg||A.wpMsg)&&localStorage.setItem(No,JSON.stringify(A))}catch{}};f.useEffect(()=>{const A=setTimeout(_r,500);return()=>clearTimeout(A)},[je,I,it,B,O,he]),f.useEffect(()=>{const A=()=>_r(),Q=()=>{document.visibilityState==="hidden"&&_r()};return window.addEventListener("pagehide",A),document.addEventListener("visibilitychange",Q),()=>{window.removeEventListener("pagehide",A),document.removeEventListener("visibilitychange",Q),_r()}},[]);const He=be.length===0?"特記事項なし":be.map(A=>{const Q=A.type==="closed"?"臨時休診":A.type==="open"?"臨時診療":"担当医変更",ae=A.time==="ALL"?"終日":A.time==="AM"?"午前":"午後",Ee=A.doctors.map(Xn=>{var Zn;return((Zn=d.find(Ns=>Ns.id===Xn))==null?void 0:Zn.name)??Xn}).filter(Boolean).join("・"),Ye=A.note?`(${A.note})`:"",En=Ee?` 担当: ${Ee}`:"";return`${nh(A.date)}: ${Q}(${ae})${En}${Ye}`}).join(`
410`),Dl=async()=>{ze("loading"),Ke("");try{const[A,Q]=wo(jo(xe,B))?await Promise.all([Lh(x),Ph(m)]):[x,m],ae=await fetch("/api/generate-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({clinicName:l.name,nextMonth:Z,nextMonthYm:xe,amHours:`${l.amStart}〜${l.amEnd}`,pmHours:`${l.pmStart}〜${l.pmEnd}`,exceptions:He,announcement:c,linePrompt:A,wpPrompt:Q,variant:qh(xe,B)})});if(!ae.ok){const En=await ae.json().catch(()=>({}));throw new Error(En.error??`HTTP ${ae.status}`)}const Ee=await ae.json(),Ye=Ee.variant??B;ne(Ee.line),ie(Ee.wordpress),C(Ye),ye(re),Jt(Ee.wpTitle??kl(Ye,Z)),Ye==="newyear"&&Nt(fr("newyear",re,Pt)),fe(Ye==="newyear"?{count:Ee.fewShotCount??0,error:Ee.fewShotError}:null),_e(Ye==="newyear"&&typeof Ee.scheduleCount=="number"?{scheduleCount:Ee.scheduleCount,warnings:Ee.warnings??[]}:null),te(null),ge(null),ze("done")}catch(A){Ke(A instanceof Error?A.message:"メッセージ生成に失敗しました。"),ze("error")}},xs=()=>
410{if(!N)return;ne(N.line),ie(N.wordpress);const A=Ld(N.targetMonth),Q=Yh(N.targetMonth)??re;C(A),ye(Q),Jt(Qh(N.targetMonth)),A==="newyear"&&Nt(fr("newyear",Q,Pt)),fe(null),_e(null),ge(null),te(nx(N.targetMonth,Z)),ze("done"),R().then(ae=>{ae.ok||qn(`配信案のクリアに失敗しました: ${ae.error}`,"error")})},pa=()=>{R().then(A=>{A.ok||qn(`却下に失敗しました: ${A.error}`,"error")})},Tr=async()=>{Nn("loading"),br("");try{const A=await fetch("/api/run-monthly",{method:"POST",credentials:"same-origin"});if(!A.ok){const Q=await A.json().catch(()=>({}));throw new Error(Q.error??`HTTP ${A.status}`)}Nn("done"),await T()}catch(A){br(A instanceof Error?A.message:"エラーが発生しました"),Nn("error")}},zl=async()=>{if(!sn||!je.trim())return;const A=$d(B,O,xa,"reserve",Date.now()),Q=B==="newyear"?Dd(je,o,O):null;if(Q&&A.lines.push(Q),!await z({title:"LINE予約送信の確認",message:n.jsxs("div",{className:"space-y-2",children:[A.lines.map(Ye=>n.jsx("p",{className:"text-sm font-bold text-red-600",children:Ye},Ye)),n.jsxs("p",{children:[n.jsx("strong",{children:sn})," の午前9時に以下の内容を全員へ配信予約します。よろしいですか?"]}),n.jsx("div",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap text-sm bg-gray-50 border rounded p-3",children:je})]}),confirmLabel:"予約する",tone:"warn"}))return;jt(!0),ln("");const Ee=await v({message:je,scheduledAt:sn});if(jt(!1),!Ee.ok){ln(Ee.error==="conflict"?"他の変更と競合しました。もう一度お試しください":Ee.error);return}Ge(),Gn()},gs=async()=>{jt(!0),ln("");const A=await v(void 0);jt(!1),A.ok||ln(A.error==="conflict"?"他の変更と競合しました。もう一度お試しください":A.error)},Lr=async()=>{if(!(b!=null&&b.scheduledAt))return;jt(!0),ln("");try{await na({sent_at:new Date(`${b.scheduledAt}T00:00:00Z`).toISOString(),title:Jh(b.message,Z),body:b.message,target:"all",created_by:"管理者(予約送信)"})}catch(Q){ln(Q instanceof Error?Q.message:"アーカイブ登録に失敗しました"),jt(!1);return}const A=await v(void 0);jt(!1),A.ok||ln(A.error==="conflict"?"他の変更と競合しました。もう一度お試しください":A.error)},Mt=async()=>{if(!je.trim())return;const A=$d(B,O,xa,"now",Date.now()),Q=B==="newyear"?Dd(je,o,O):null;if(Q&&A.lines.push(Q.replace("予約した場合は元旦に保留されます","今すぐ送信は元旦の確認を通らないので、このまま送られます")),!!await z({title:"LINE配信の確認",message:n.jsxs("div",{className:"space-y-2",children:[A.lines.map(Ee=>n.jsx("p",{className:"text-sm font-bold text-red-600",children:Ee},Ee)),n.jsx("p",{children:"以下の内容を今すぐ全員に配信します。よろしいですか?"}),n.jsx("div",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap text-sm bg-gray-50 border rounded p-3",children:je})]}),confirmLabel:"送信する",tone:"warn"})){vr("loading"),wr("");try{const Ee=await fetch("/api/line-send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({message:je})});if(!Ee.ok){const Ye=await Ee.json().catch(()=>({}));throw new Error(Ye.error??`HTTP ${Ee.status}`)}await na({sent_at:new Date().toISOString(),title:Kh(B,Z),body:je,target:"all",created_by:"管理者"}).catch(Ye=>console.warn("archive save failed",Ye)),vr("done"),Ge(),Gn()}catch(Ee){wr(Ee instanceof Error?Ee.message:"エラーが発生しました"),vr("error")}}},Rl=async()=>{const A=rx(B,O,Date.now());if(await z({title:"WordPress公開の確認",message:n.jsxs("div",{className:"space-y-2",children:[A.lines.map(ae=>n.jsx("p",{className:"text-sm font-bold text-red-600",children:ae},ae)),n.jsxs("p",{children:[n.jsx("strong",{children:it})," を今すぐ公開します。よろしいですか?"]}),B==="newyear"&&n.jsxs("p",{className:"text-xs text-gray-600",children:["同じ URL(",rs(O),")の予約記事が既にあるときは、その記事を今の本文で上書きして公開します。WordPress 管理画面で直接直した内容がある場合は失われます。"]}),n.jsx("div",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap font-mono text-xs bg-gray-50 border rounded p-3",children:I})]}),confirmLabel:"公開する",tone:"warn"})){jr("loading"),ds("");try{const ae=await fetch("/api/wp-publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Pd(B,O,{title:it,content:I,status:"publish"}))});if(!ae.ok)throw new Error(await ha(ae));const Ee=await ae.json();await na({sent_at:new Date().toISOString(),title:it,body:I,target:"all",created_by:"管理者"}).catch(Ye=>console.warn("archive save failed",Ye)),ua(Ee.postUrl),B==="newyear"&&ge({postUrl:Ee.postUrl,slug:Ee.slug||rs(O)}),Ee.updated&&qn("予約中の記事を更新しました(記事は 1 本のままです)","info"),jr("done"),Ge(),B!=="newyear"&&Gn()}catch(ae){ds(ae instanceof Error?ae.message:"エラーが発生しました"),jr("error")}}},kt=async()=>
410{if(!(!on||!await z({title:"WordPress予約公開の確認",message:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{children:[n.jsx("strong",{children:on.replace("T"," ")})," に ",n.jsx("strong",{children:it})," を公開予約します。よろしいですか?"]}),B==="newyear"&&n.jsxs("p",{className:"text-xs text-gray-600",children:["同じ URL(",rs(O),")の予約記事が既にあるときは、その記事を今の本文で上書きします。WordPress 管理画面で直接直した内容がある場合は失われます。"]}),n.jsx("div",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap font-mono text-xs bg-gray-50 border rounded p-3",children:I})]}),confirmLabel:"予約する",tone:"warn"}))){Nr("loading"),Sr("");try{const Q=await fetch("/api/wp-publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Pd(B,O,{title:it,content:I,status:"future",date:on+":00"}))});if(!Q.ok)throw new Error(await ha(Q));const ae=await Q.json();await na({sent_at:new Date().toISOString(),title:it,body:I,target:"all",created_by:"管理者"}).catch(Ee=>console.warn("archive save failed",Ee)),$l(ae.postUrl),B==="newyear"&&ge({postUrl:ae.postUrl,slug:ae.slug||rs(O)}),ae.updated&&qn("予約中の記事を更新しました(記事は 1 本のままです)","info"),Nr("done"),Ge(),B!=="newyear"&&Gn()}catch(Q){Sr(Q instanceof Error?Q.message:"エラーが発生しました"),Nr("error")}}},ha=async A=>{const Q=await A.json().catch(()=>({}));return A.status===503&&Q.error==="slug_lookup_failed"?`${Q.message??"ホームページ(WordPress)で同じ URL の記事があるか確認できませんでした"}。もう一度押してください。続けて失敗するときは、WordPress 管理画面から直接投稿してください(記事の URL は new-year-<西暦> にします)`:A.status===409&&Q.error==="slug_taken"?`${Q.message??"同じ URL の記事が既にあります"}${Q.postUrl?`(${Q.postUrl})`:""}。公開済みの記事は上書きしません。WordPress 管理画面で確認してください`:Q.error??`HTTP ${A.status}`},Re=he?Gh(he.postUrl,he.slug,je):null,xa=(Re==null?void 0:Re.state)==="match",Pr=(Re==null?void 0:Re.state)==="match"?Re.url:(Re==null?void 0:Re.state)==="mismatch"?Re.actual:null,Mr=Zh(b==null?void 0:b.message,Pr),Sn=B==="newyear"?Nl(je):null,$r=A=>{const Q=A?"newyear":"schedule";Q!==B&&(Jt(ae=>Md(ae,B,Q,Z)),Nt(ae=>ae===fr(B,O,Pt)?fr(Q,O,Pt):ae),C(Q),ge(null))},kn=tx(Date.now(),b==null?void 0:b.scheduledAt,b==null?void 0:b.message),ys=f.useRef(!1);f.useEffect(()=>{kn==="unsent"&&!ys.current&&(ys.current=!0,T()),kn!=="unsent"&&(ys.current=!1)},[kn]);const vs=()=>{var Q;if(!b)return;const A=Nl(b.message);ne(b.message),C("newyear"),ye(A&&((Q=vh(A))==null?void 0:Q.year)||re),ge(null),V("create"),ze("done")},ws=(A,Q)=>{navigator.clipboard.writeText(A).catch(()=>{const ae=document.createElement("textarea");ae.value=A,document.body.appendChild(ae),ae.select(),document.execCommand("copy"),document.body.removeChild(ae)}),Q(!0),setTimeout(()=>Q(!1),2500)},Dr=g??{notifyDay:25},bn=b!=null&&b.scheduledAt?Date.now()>=new Date(`${b.scheduledAt}T00:00:00Z`).getTime():!1,js=!!(b!=null&&b.scheduledAt)&&!bn;return n.jsxs("div",{className:"space-y-6 animate-in fade-in duration-300",children:[n.jsxs("div",{role:"tablist","aria-label":"配信管理の表示切替",className:"inline-flex bg-gray-100 rounded-lg p-1 gap-1",children:[n.jsx("button",{role:"tab",id:"delivery-segment-create-tab","aria-selected":F==="create","aria-controls":"delivery-segment-create-panel",onClick:()=>V("create"),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors
411            ${F==="create"?"bg-white shadow text-accent-fg":"text-gray-600 hover:text-gray-900"}`,children:"配信作成"}),n.jsx("button",{role:"tab",id:"delivery-segment-archive-tab","aria-selected":F==="archive","aria-controls":"delivery-segment-archive-panel",onClick:()=>V("archive"),className:`px-3 py-1 rounded-md text-xs font-medium transition-colors
412            ${F==="archive"?"bg-white shadow text-accent-fg":"text-gray-600 hover:text-gray-900"}`,children:"配信履歴"})]}),n.jsxs("div",{id:"delivery-segment-create-panel",role:"tabpanel","aria-labelledby":"delivery-segment-create-tab",className:F==="create"?"space-y-6":"hidden",children:[N&&n.jsxs("div",{className:"bg-amber-50 border border-amber-300 rounded-xl p-4 flex items-start gap-3",children:[n.jsx(vp,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5"}),n.jsxs("div",{className:"flex-1",children:[n.jsxs("p",{className:"font-bold text-amber-800 text-sm",children:[N.targetMonth,Ld(N.targetMonth)==="newyear"?"(年頭の挨拶)":"","の配信メッセージが自動生成されました"]}),n.jsxs("p",{className:"text-amber-700 text-xs mt-0.5",children:["生成日時: ",new Date(N.generatedAt).toLocaleStr
412ing("ja-JP")]})]}),n.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[n.jsx(le,{variant:"primary",size:"sm",onClick:xs,children:"確認する"}),n.jsx(le,{variant:"ghost",size:"sm",onClick:pa,children:"却下"})]})]}),b&&kn==="processing"&&n.jsxs("div",{className:"bg-amber-50 border border-amber-300 rounded-xl p-4 flex items-start gap-3 text-sm text-amber-800",children:[n.jsx(Lt,{className:"w-5 h-5 text-amber-600 flex-shrink-0 mt-0.5 animate-spin","aria-hidden":!0}),n.jsxs("p",{children:[n.jsx("strong",{children:b.scheduledAt})," の年頭の挨拶(LINE)は送信処理中です。9:15 ごろまでお待ちください(それでも予約が残っていれば、ここに赤字で対応の手順が出ます)。"]})]}),b&&kn==="unsent"&&n.jsxs("div",{className:"bg-red-50 border border-red-300 rounded-xl p-4 space-y-3 text-sm text-red-800",role:"alert",children:[n.jsxs("p",{className:"flex items-start gap-2",children:[n.jsx(Yt,{className:"w-5 h-5 flex-shrink-0 mt-0.5","aria-hidden":!0}),n.jsxs("span",{children:[n.jsx("strong",{children:b.scheduledAt})," の年頭の挨拶(LINE)は",n.jsx("strong",{children:"まだ送信されていません"}),"。 予約が残っているのは、ホームページの記事が未公開だった・「1月の診療予定」が臨時予定の登録と違った・送信に失敗した、のいずれかで送信を保留したためです(理由と正しい一覧は秘書チャットの通知にあります)。"]})]}),n.jsxs("ol",{className:"list-decimal pl-9 space-y-1 text-xs leading-relaxed",children:[n.jsx("li",{children:"WordPress 管理画面で、予約投稿「年頭の挨拶」を「今すぐ公開」にし、LiteSpeed Cache を全パージする(ホームページの記事が開けることを確認)"}),n.jsx("li",{children:"下の「予約を取消」を押す(予約を残したまま送ると、同じ日に定期実行を手動で動かしたとき二重に送られます)"}
412),n.jsx("li",{children:"「この本文を送信欄に入れる」を押し、「1月の診療予定」を臨時予定タブの登録と見比べて直してから、LINE 欄の「今すぐ送信」で送る"})]}),n.jsx("p",{className:"text-xs",children:"LINE が既に届いている場合は、何もせず「予約を取消」だけ押してください。"}),Kt&&n.jsx("p",{className:"text-xs text-red-700",children:Kt}),n.jsxs("div",{className:"flex flex-wrap gap-2 pl-9",children:[n.jsxs(le,{variant:"danger",size:"sm",onClick:gs,disabled:an,children:[n.jsx(mr,{className:"w-3 h-3","aria-hidden":!0})," 予約を取消"]}),n.jsx(le,{variant:"ghost",size:"sm",onClick:vs,children:"この本文を送信欄に入れる"})]})]}),n.jsxs(Ue,{title:"自動生成スケジュール",icon:Cl,children:[n.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"text-sm text-gray-600",children:"毎月"}),n.jsx("input",{type:"number",min:1,max:28,value:Dr.notifyDay,onChange:A=>k({...Dr,notifyDay:Math.min(28,Math.max(1,Number(A.target.value)))}),onBlur:()=>void fa(),className:"w-16 border border-gray-300 rounded-lg px-3 py-2 text-sm text-center font-bold focus:ring-2 focus:ring-accent outline-none"}),n.jsx("span",{className:"text-sm text-gray-600",children:"日 午前9時(JST)に自動生成"}),cn==="saving"&&n.jsx(Lt,{className:"w-4 h-4 animate-spin text-gray-400","aria-hidden":!0}),cn==="saved"&&n.jsxs("span",{className:"flex items-center gap-1 text-xs text-semantic-success",children:[n.jsx(yd,{className:"w-3.5 h-3.5","aria-hidden":!0})," 保存済み"]}),cn==="error"&&n.jsx("span",{className:"text-xs text-red-600",children:Xt})]}),n.jsx("p",{className:"text-xs text-gray-500",children:"毎日 JST 9:00 の定期実行(cron)で生成するため、時刻は9時固定です。"})]}),n.jsxs("div",{className:"mt-4 pt-4 border-t flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[n.jsxs("div",{className:"text-xs text-gray-500 space-y-0.5",children:[n.jsx("p",{children:"配信案の生成通知:秘書チャットアプリへ自動送信"}),n.jsx("p",{children:n.jsxs("span",{children:["WordPress:",n.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"WP_URL / WP_USERNAME / WP_APP_PASSWORD"})," を Cloudflare Pages のシークレットに設定"]})})]}),n.jsx(le,{variant:"ghost",size:"md",onClick:Tr,disabled:Gt==="loading",children:Gt==="loading"?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0})," 実行中..."]}):Gt==="done"?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-4 h-4","aria-hidden":!0})," 完了(アプリを確認)"]}):n.jsxs(n.Fragment,{children:[n.jsx(To,{className:"w-4 h-4","aria-hidden":!0})," 今すぐ手動実行"]})})]}),Gt==="error"&&n.jsx("p",{className:"mt-2 text-xs text-red-600 bg-red-50 p-2 rounded border border-red-200",children:kr})]}),n.jsxs(Ue,{title:`${Z} 配信準備`,icon:ss,children:[(B==="newyear"||la(xe))&&n.jsxs("div",{className:"mb-6 bg-accent-subtle border border-accent-subtle-2 roun
412ded-lg px-4 py-3 text-sm text-accent-hover leading-relaxed space-y-2",children:[n.jsxs("p",{className:"flex items-start gap-2",children:[n.jsx(Uo,{className:"w-4 h-4 flex-shrink-0 mt-0.5","aria-hidden":!0}),n.jsxs("span",{children:[n.jsx("strong",{children:"1月分は「年頭の挨拶」として生成します。"}),"タイトルは「年頭の挨拶」、LINE の末尾にホームページの記事 URL が入ります。配信設定の追加指示は使われません。 LINE の締めの言葉の前と、ホームページの挨拶の後に「1月の診療予定」(臨時予定タブに登録した休診・臨時診療・担当医変更)が自動で入ります。年始の休診は先に臨時予定に登録してから生成してください。",n.jsx("br",{}),n.jsx("strong",{children:"順番:"}),"WordPress を 1/1 0:00 に予約 → 「URL 確認済み」になってから LINE を予約してください。"]})]}),n.jsxs("label",{className:"flex items-center gap-2 font-medium cursor-pointer",children:[n.jsx("input",{type:"checkbox",checked:B==="newyear",onChange:A=>$r(A.target.checked),className:"w-4 h-4"}),"年頭の挨拶として扱う"]}),n.jsx("p",{className:"text-xs",children:"チェックを外して生成すると、通常の診療スケジュール記事になります。切り替えたあとは、もう一度「Claude でメッセージを生成」してください。"})]}),U&&n.jsxs("p",{className:"mb-6 flex items-start gap-2 text-sm text-amber-800 bg-amber-50 border border-amber-300 rounded-lg px-4 py-3",children:[n.jsx(Yt,{className:"w-4 h-4 flex-shrink-0 mt-0.5","aria-hidden":!0}),n.jsx("span",{children:U})]}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border",children:[n.jsx("h3",{className:"font-bold text-sm text-gray-700 mb-2",children:"来月の臨時スケジュール"}),be.length===0?n.jsx("p",{className:"text-gray-500 text-sm",children:"特記事項なし"}):n.jsx("ul",{className:"text-sm space-y-1.5",children:be.map(A=>n.jsxs("li",{className:"flex items-start gap-2",children:[n.jsx("span",{className:`mt-0.5 text-[10px] font-bold px-1.5 py-0.5 rounded flex-shrink-0
413                      ${A.type==="closed"?"bg-red-100 text-red-700":A.type==="open"?"bg-green-100 text-green-700":"bg-orange-100 text-orange-700"}`,children:A.type==="closed"?"休診":A.type==="open"?"臨時":"変更"}),n.jsxs("span",{className:"text-gray-700",children:[A.date,A.time!=="ALL"?`(${A.time==="AM"?"午前":"午後"})`:""]})]},A.id))})]}),n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border",children:[n.jsx("h3",{className:"font-bold text-sm text-gray-700 mb-2",children:"お知らせメモ"}),n.jsx("p",{className:"text-sm text-gray-600 whitespace-pre-wrap leading-relaxed",children:c.trim()||n.jsx("span",{className:"text-gray-500 italic",children:"(未入力)"})})]})]}),n.jsxs("div",{className:"mb-6 border rounded-xl overflow-hidden",children:[n.jsxs("button",{onClick:()=>vn(A=>!A),className:"w-full flex items-center justify-between px-4 py-3 bg-gray-50 hover:bg-gray-100 transition-colors text-sm font-medium text-gray-700",children:[n.jsxs("span",{className:"flex items-center gap-2",children:[n.jsx(Dp,{className:"w-4 h-4 text-gray-500"}),"メッセージ生成プロンプトを編集",n.jsx("span",{className:"text-xs text-gray-500 font-normal",children:"(変更は次回生成から反映)"})]}),wt?n.jsx(zo,{className:"w-4 h-4 text-gray-500"}):n.jsx(Tl,{className:"w-4 h-4 text-gray-500"})]}),wt&&n.jsxs("div",{className:"p-5 space-y-5 bg-white border-t",children:[n.jsxs("div",{className:"bg-accent-subtle border border-accent-subtle-2 roun
413ded-lg px-4 py-3 text-xs text-accent-hover leading-relaxed",children:[n.jsx("span",{className:"font-bold",children:"自動で含まれる情報:"}),"クリニック名・対象月・診療時間・来月の臨時スケジュール・お知らせメモ",n.jsx("br",{}),"以下には",n.jsx("span",{className:"font-bold",children:"追加指示・スタイル・制約"}),"を記述してください。"]}),!wo(jo(xe,B))&&n.jsxs("div",{className:"flex items-start gap-2 bg-amber-50 border border-amber-300 rounded-lg px-3 py-2 text-xs text-amber-800",children:[n.jsx(Yt,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5","aria-hidden":!0}),"1月分(年頭の挨拶)では、以下の追加指示と過去の配信例は使われません(ホームページの過去の挨拶記事を文体見本にします)。"]}),!!st&&wo(jo(xe,B))&&n.jsxs("div",{className:"flex items-center gap-2 bg-indigo-50 border border-indigo-200 rounded-lg px-3 py-2 text-xs text-indigo-700",children:[n.jsx(wl,{className:"w-3.5 h-3.5 flex-shrink-0","aria-hidden":!0}),"過去の配信例(直近 ",st," 件)を参照してメッセージを生成します"]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-bold text-green-700 mb-1.5 flex items-center gap-1.5",children:[n.jsx(_o,{className:"w-4 h-4"})," 公式LINE メッセージ生成指示"]}),n.jsx("textarea",{value:x,onChange:A=>p(A.target.value),rows:6,className:"w-full border border-gray-300 rounded-lg p-3 text-sm font-mono leading-relaxed focus:ring-2 focus:ring-green-400 outline-none resize-y"})]}),n.jsxs("div",{children:[n.jsxs("label",{className:"block text-sm font-bold text-purple-700 mb-1.5 flex items-center gap-1.5",children:[n.jsx(vd,{className:"w-4 h-4"})," WordPress 記事生成指示"]}),n.jsx("textarea",{value:m,onChange:A=>w(A.target.value),rows:7,className:"w-full border border-gray-300 rounded-lg p-3 text-sm font-mono leading-relaxed focus:ring-2 focus:ring-purple-400 outline-none resize-y"})]}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[cn==="saving"&&n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-3.5 h-3.5 animate-spin","aria-hidden":!0})," 保存中..."]}),cn==="saved"&&n.jsxs("span",{className:"flex items-center gap-1 text-semantic-success",children:[n.jsx(yd,{className:"w-3.5 h-3.5","aria-hidden":!0})," 保存済み"]}),cn==="error"&&n.jsx("span",{className:"text-red-600",children:Xt}),cn==="idle"&&n.jsx("span",{children:"入力から1.5秒後に自動保存されます。"})]})]})]}),n.jsx("div",{className:"flex flex-col items-center gap-2",children:n.jsx(le,{variant:"primary",size:"lg",onClick:Dl,disabled:Me==="loading",children:Me==="loading"?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-5 h-5 animate-spin","aria-hidden":!0})," Claude が生成中..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ss,{className:"w-5 h-5","aria-hidden":!0})," Claude でメッセージを生成"]})})}),Me==="done"&&B==="newyear"&&G&&(G.count>0?n.jsxs("p",{className:"mt-3 text-center text-xs text-indigo-700",children:["ホームページの過去の挨拶記事(",G.count," 件)を文体見本にして生成しました。"]}):n.jsxs("p",{className:"mt-3 flex items-start justify-center gap-1.5 text-xs text-amber-800",children:[n.jsx(Yt,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5","aria-hidden":!0}),"過去の挨拶記事を参照できなかったため、組み込みの文体ガイドで生成しました",G.error?`(理由: ${G.error})`:"","。"]})),Me==="done"&&B==="newyear"&&ke&&n.jsxs("div",{className:"mt-3 space-y-1 text-xs",children:[n.jsxs("p",{className:"text-center text-gray-600",children:["1月の診療予定:",ke.scheduleCount," 件(臨時予定タブの登録から作成。LINE の締めの前とホームページの挨拶の後に入っています)"]}),ke.warnings.map(A=>n.jsxs("p",{className:"flex items-start gap-1.5 text-amber-800 bg-amber-50 border border-amber-300 rounded px-3 py-2",children:[n.jsx(Yt,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5","aria-hidden":!0}),n.jsx("span",{children:A})]},A))]}),Me==="error"&&n.jsxs("div",{className:"mt-4 flex items-start gap-2 text-red-600 bg-red-50 p-3 rounded border border-red-200 text-sm",children:[n.jsx(Yt,{className:"w-4 h-4 flex-shrink-0 mt-0.5"}),n.jsx("span",{className:"whitespace-pre-wrap",children:Ve})]})]}),Me==="done"&&n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"bg-white p-6 rounded-xl shadow-sm border border-green-200",children:[n.jsxs("h2",{className:"text-lg font-bold text-gray-800 mb
413-4 border-b border-green-100 pb-2 flex items-center gap-2",children:[n.jsx(_o,{className:"w-5 h-5 text-green-600"})," 公式LINE用メッセージ"]}),n.jsx("textarea",{value:je,onChange:A=>ne(A.target.value),className:"w-full h-52 border border-gray-300 rounded-lg p-4 focus:ring-2 focus:ring-green-500 outline-none resize-y text-sm leading-relaxed"}),B==="newyear"&&n.jsxs("p",{className:"mt-2 text-xs text-gray-600 break-all",children:["記事 URL(予定):",Sn?n.jsx("span",{className:"font-mono",children:Sn}):n.jsx("span",{className:"text-red-600",children:"本文に記事の URL がありません"}),n.jsx("span",{className:"text-gray-500",children:"(公開されるまでは開けません。リンクにしていません)"})]}),n.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[n.jsxs("span",{className:"text-xs text-gray-500",children:[je.length,"文字"]}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>ws(je,$e),children:pe?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-4 h-4","aria-hidden":!0})," コピー完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(as,{className:"w-4 h-4","aria-hidden":!0})," コピー"]})})]}),n.jsxs("div",{className:"mt-4 pt-4 border-t border-green-100 space-y-3",children:[n.jsx("p",{className:"text-xs font-semibold text-gray-600",children:"LINE 送信"}),js&&n.jsxs("div",{className:"flex items-center justify-between bg-green-50 border border-green-200 rounded-lg px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-green-700 text-sm",children:[n.jsx(ra,{className:"w-4 h-4 flex-shrink-0"}),n.jsxs("span",{children:[n.jsx("strong",{children:b.scheduledAt})," 午前9時に自動送信予約済み"]})]}),n.jsxs(le,{variant:"danger",size:"sm",onClick:gs,disabled:an,children:[n.jsx(mr,{className:"w-3 h-3","aria-hidden":!0})," 予約を取消"]})]}),js&&Mr&&n.jsxs("p",{className:"flex items-start gap-1.5 text-xs font-bold text-red-600",children:[n.jsx(Yt,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5","aria-hidden":!0}),"予約済みの LINE に古い URL が入っています。予約を取り消して再予約してください。"]}),bn&&!kn&&n.jsxs("div",{className:"flex items-center justify-between bg-gray-50 border border-gray-200 rounded-lg px-4 py-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-600 text-sm",children:[n.jsx(Ot,{className:"w-4 h-4 flex-shrink-0 text-gray-500"}),n.jsxs("span",{children:[n.jsx("strong",{children:b.scheduledAt})," 午前9時の予約送信は送信済みです(予定時刻を経過)"]})]}),n.jsxs(le,{variant:"ghost",size:"sm",onClick:Lr,disabled:an,children:[an?n.jsx(Lt,{className:"w-3 h-3 animate-spin","aria-hidden":!0}):n.jsx(Ot,{className:"w-3 h-3","aria-hidden":!0})," 確認してアーカイブ"]})]}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx(le,{variant:"primary",size:"md",onClick:Mt,disabled:wn==="loading"||wn==="done"||!je.trim(),children:wn==="loading"?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0})," 送信中..."]}):wn==="done"?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-4 h-4","aria-hidden":!0})," 送信完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(ss,{className:"w-4 h-4","aria-hidden":!0})," 今すぐ送信"]})}),wn==="error"&&n.jsx("span",{className:"text-xs text-red-600",children:Ml})]}),!js&&n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx("input",{type:"date",value:sn,onChange:A=>yr(A.target.value),min:new Date().toISOString().slice(0,10),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:ring-2 focus:ring-green-400 outline-none"}),n.jsx("span",{className:"text-xs text-gray-500",children:"午前9時(JST)に自動送信"}),n.jsx(le,{variant:"primary",size:"sm",onClick:zl,disabled:an||!sn||!je.trim(),children:an?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0})," 保存中..."]}):n.jsxs(n.Fragment,{children:[n.jsx(ra,{className:"w-4 h-4","aria-hidden":!0})," 日付を指定して予約"]})})]}),Kt&&n.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[n.jsx(Yt,{className:"w-3.5 h-3.5"}),Kt]}),n.jsx("p",{className:"text-xs text-gray-500",children:"※ 予約送ä
413¿¡ã®æ™‚刻は午前9時(JST)固定です(定期実行が1日1回・JST 9:00 のため)。任意の時刻に送信したい場合は「今すぐ送信」をご利用ください。"})]})]}),n.jsxs("section",{className:"bg-white p-6 rounded-xl shadow-sm border border-purple-200",children:[n.jsxs("h2",{className:"text-lg font-bold text-gray-800 mb-4 border-b border-purple-100 pb-2 flex items-center gap-2",children:[n.jsx(vd,{className:"w-5 h-5 text-purple-600"})," WordPress用記事(HTML)"]}),n.jsx("textarea",{value:I,onChange:A=>ie(A.target.value),className:"w-full h-64 border border-gray-300 rounded-lg p-4 focus:ring-2 focus:ring-purple-500 outline-none resize-y font-mono text-sm"}),n.jsxs("div",{className:"mt-3 flex items-center justify-between",children:[n.jsxs("span",{className:"text-xs text-gray-500",children:[I.length,"文字"]}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>ws(I,Xe),children:De?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-4 h-4","aria-hidden":!0})," コピー完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(as,{className:"w-4 h-4","aria-hidden":!0})," コピー"]})})]}),n.jsxs("div",{className:"mt-4 pt-4 border-t border-purple-100 space-y-3",children:[n.jsx("p",{className:"text-xs font-semibold text-gray-600",children:"WordPress 公開"}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-xs text-gray-500 mb-1",children:"投稿タイトル"}),n.jsx("input",{type:"text",value:it,onChange:A=>Jt(A.target.value),className:"w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:ring-2 focus:ring-purple-400 outline-none"})]}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx(le,{variant:"primary",size:"md",onClick:Rl,disabled:St==="loading"||St==="done"||!I.trim()||!it.trim(),children:St==="loading"?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0})," 公開中..."]}):St==="done"?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-4 h-4","aria-hidden":!0})," 公開完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(rf,{className:"w-4 h-4","aria-hidden":!0})," 今すぐ公開"]})}),St==="done"&&fs&&n.jsxs("a",{href:fs,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-green-700 underline hover:text-green-900",children:["記事を確認 ",n.jsx(jl,{className:"w-3.5 h-3.5"})]}),St==="error"&&n.jsx("span",{className:"text-xs text-red-600",children:ca})]}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsx("input",{type:"datetime-local",value:on,onChange:A=>Nt(A.target.value),min:new Date().toISOString().slice(0,16),className:"border border-gray-300 rounded-lg px-3 py-1.5 text-sm focus:ring-2 focus:ring-purple-400 outline-none"}),n.jsx(le,{variant:"primary",size:"sm",onClick:kt,disabled:qt==="loading"||qt==="done"||!on||!I.trim()||!it.trim(),children:qt==="loading"?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0})," 予約中..."]}):qt==="done"?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-4 h-4","aria-hidden":!0})," 予約完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(ra,{className:"w-4 h-4","aria-hidden":!0})," 日付を指定して予約"]})}),qt==="done"&&jn&&n.jsxs("a",{href:jn,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sm text-green-700 underline hover:text-green-900",children:["記事を確認 ",n.jsx(jl,{className:"w-3.5 h-3.5"})]}),qt==="error"&&n.jsx("span",{className:"text-xs text-red-600",children:Jn})]}),B==="newyear"&&n.jsxs("p",{className:"text-xs text-gray-500",children:["年頭の挨拶は記事の URL を ",n.jsx("code",{className:"bg-gray-100 px-1 rounded",children:rs(O)})," に固定して投稿します。 予約し直しても記事は 1 本のままです(予約中の記事は更新されます。公開済みの記事は上書きしません)。"]}),B==="newyear"&&(Re==null?void 0:Re.state)==="match"&&n.jsxs("p",{className:"flex items-start gap-1.5 text-sm text-green-700 break-all",children:[n.jsx(Ot,{className:"w-4 h-4 flex-shrink-0 mt-0.5","aria-hidden":!0}),n.jsxs("span",{children:["✔ ホームページ URL を確認:",n.jsx("span",{className:"font-mono",children:Re.url})]})]}),B==="newyear"&&(Re==null?void 0:Re.state)==="mismatch"&&n.jsxs("div",{className:"text-sm text-red-700 bg-red-50 border border-red-200 rounded-lg px-3 py-2 space-y-2",children:[n.jsxs("p",{className:"flex items-start gap-1.5 break-all",children:[n.jsx(Yt,{className:"w-4 h-4 flex-shrink-0 mt-0.5","aria-hidden":!0}),n.jsxs("span",{children:["URL が想定と異なります(実際:",n.jsx("span",{className:"font-mono",children:Re.actual}),Re.expected?n.jsxs(n.Fragment,{children:["/LINE 本文:",n.jsx("span",{className:"font-mono",children:Re.expected})]}
413):"/LINE 本文に記事の URL がありません",")"]})]}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>ne(Xh(je,Re.actual)),children:"LINE 本文の URL を置き換える"})]}),B==="newyear"&&(Re==null?void 0:Re.state)==="unknown"&&n.jsxs("p",{className:"flex items-start gap-1.5 text-xs text-amber-800",children:[n.jsx(Yt,{className:"w-3.5 h-3.5 flex-shrink-0 mt-0.5","aria-hidden":!0}),"投稿は完了しましたが、記事の URL を確認できませんでした。WordPress 管理画面で URL を確認してください。"]})]})]})]})]}),n.jsx("div",{id:"delivery-segment-archive-panel",role:"tabpanel","aria-labelledby":"delivery-segment-archive-tab",className:F==="archive"?"":"hidden",children:n.jsx(Ue,{title:"配信済みお知らせ アーカイブ",icon:wl,description:"LINE・WordPress へ配信したお知らせの履歴です。テンプレートとして再利用したり、過去の文体・表現を参照できます。",children:n.jsx(Vh,{onUseAsTemplate:H})})})]})}function lx({doctors:l,saveDoctors:o,onDeleteDoctor:c}){const[d,h]=f.useState(!1),[x,m]=f.useState({id:"",name:"",color:sa[0]}),[p,w]=f.useState(!1),g=Kn(),k=rn(),j=()=>{m({id:"",name:"",color:sa[0]}),h(!0)},N=b=>{m(b),h(!0)},R=async()=>{if(!x.name.trim())return;w(!0);const b=x.id?await o(l.map(v=>v.id===x.id?x:v)):await o([...l,{...x,id:Date.now().toString()}]);if(w(!1),!b.ok){k(b.error==="conflict"?"他の変更と競合しました。もう一度お試しください":`保存に失敗しました: ${b.error}`,"error");return}h(!1)},T=async b=>{await g({title:"担当医の削除",message:`「${b.name}」を削除しますか?設定済みのスケジュールからも外れます。`,confirmLabel:"削除する"})&&await c(b.id)};return n.jsxs(Ue,{title:"担当医の管理",icon:Ap,description:"カレンダーに表示する医師を追加・編集します。",headerExtra:!d&&n.jsxs(le,{variant:"primary",onClick:j,children:[n.jsx(cs,{className:"w-4 h-4","aria-hidden":!0})," 医師を追加"]}),children:[d&&n.jsxs("div",{className:"bg-gray-50 p-5 rounded-lg border border-accent-subtle-2 mb-6",children:[n.jsx("h3",{className:"font-bold text-gray-700 mb-4",children:x.id?"担当医の編集":"担当医の追加"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-4",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"医師名"}),n.jsx("input",{type:"text",value:x.name,onChange:b=>m(v=>({...v,name:b.target.value})),placeholder:"例: 山田 太郎",className:"w-full border border-gray-300 rounded-md p-2 focus:ring-2 focus:ring-accent outline-none bg-white"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"表示カラー"}),n.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:sa.map(b=>n.jsx("button",{onClick:()=>m(v=>({...v,color:b})),className:`px-3 py-1.5 rounded-md border text-sm font-medium transition-all ${yn[b].classes}
414                      ${x.color===b?"ring-2 ring-offset-1 ring-accent shadow-md scale-105":"opacity-70 hover:opacity-100"}`,children:yn[b].label},b))})]})]}),n.jsxs("div",{className:"flex justify-end gap-3",children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>h(!1),disabled:p,children:"キャンセル"}),n.jsx(le,{variant:"primary",size:"sm",onClick:()=>void R(),disabled:p,children:p?"保存中…":"保存する"})]})]}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4",children:[l.map(b=>n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-200 flex justify-between items-center group hover:border-accent transition-colors",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center font-bold text-lg border ${yn[us(b.color)].classes}`,children:b.name.charAt(0)}),n.jsx("span",{className:"font-medium text-gray-800",children:b.name})]}),n.jsxs("div",{className:"flex opacity-0 group-hover:opacity-100 transition-opacity",children:[n.jsx("button",{onClick:()=>N(b),"aria-label":`${b.name}を編集`,className:"p-2 text-accent-fg hover:bg-accent-subtle-2 roun
414ded-full",children:n.jsx(os,{className:"w-4 h-4","aria-hidden":!0})}),n.jsx("button",{onClick:()=>void T(b),"aria-label":`${b.name}を削除`,className:"p-2 text-semantic-error hover:bg-red-100 rounded-full",children:n.jsx(hr,{className:"w-4 h-4","aria-hidden":!0})})]})]},b.id)),l.length===0&&n.jsx("p",{className:"text-gray-500 col-span-full text-sm",children:"登録されている担当医はいません。"})]})]})}const ix=["日","月","火","水","木","金","土"];function ox({day:l,period:o,isOpen:c,doctors:d,allDoctors:h,onClose:x,onSave:m}){const[p,w]=f.useState(c),[g,k]=f.useState(d),j=N=>k(R=>R.includes(N)?R.filter(T=>T!==N):[...R,N]);return n.jsx(Qn,{title:`${ix[l]}曜 ${o==="am"?"午前":"午後"} の設定`,onClose:x,footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",onClick:x,children:"キャンセル"}),n.jsx(le,{variant:"primary",onClick:()=>m(p,p?g:[]),children:"設定を保存"})]}),children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-3",children:"診療ステータス"}),n.jsx("div",{className:"flex gap-4",children:[!0,!1].map(N=>n.jsxs("label",{className:`flex-1 flex items-center justify-center gap-2 p-3 border rounded-lg cursor-pointer transition-colors
415                    ${p===N?N?"bg-accent-subtle border-accent text-accent-hover":"bg-gray-100 border-gray-400 text-gray-700":"hover:bg-gray-50"}`,children:[n.jsx("input",{type:"radio",checked:p===N,onChange:()=>w(N),className:"hidden"}),n.jsx("span",{className:"font-bold text-lg",children:N?"◯":"ー"}),N?"診療あり":"休診"]},String(N)))})]}),n.jsxs("div",{className:`transition-opacity ${p?"opacity-100":"opacity-40 pointer-events-none"}`,children:[n.jsx("label",{className:"block text-sm font-bold text-gray-700 mb-3",children:"担当医の割り当て"}),n.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-2",children:h.map(N=>{const R=g.includes(N.id);return n.jsxs("label",{className:`flex items-center gap-3 p-3 border rounded-lg cursor-pointer transition-colors
416                      ${R?"bg-accent-subtle border-accent":"hover:bg-gray-50"}`,children:[n.jsx("input",{type:"checkbox",checked:R,onChange:()=>j(N.id),className:"w-5 h-5 text-accent-fg rounded"}),n.jsx("span",{className:`text-sm px-2 py-1 border rounded font-medium ${yn[us(N.color)].classes}`,children:N.name})]},N.id)})})]})]})})}const cx=["日","月","火","水","木","金","土"];function So(l){return l<.01?l===0?"$0.00":"$0.01未満":`$${l.toFixed(2)}`}function zd(l){const[o,c]=l.split("-");return`${o}年${Number(c)}月`}function ux({data:l,setClinicSettings:o,saveClinicSettings:c,isClinicSettingsDirty:d,saveWeeklySchedule:h,saveDoctors:x,onDeleteDoctor:m}){const{clinicSettings:p,weeklySchedule:w,doctors:g}=l,k=rn(),[j,N]=f.useState(null),[R,T]=f.useState(!1),[b,v]=f.useState(""),[D,_]=f.useState(null),[z,F]=f.useState("");f.useEffect(()=>{let ee=!1;return fetch("/api/admin/api-usage-summary",{credentials:"same-origin"}).then(Z=>Z.ok?Z.json():Promise.reject(new Error(`HTTP ${Z.status}`))).then(Z=>{ee||_(Z)}).catch(Z=>{ee||F(Z instanceof Error?Z.message:String(Z))}),()=>{ee=!0}},[]);const V=async()=>{T(!0),v("");const ee=await c();T(!1),ee.ok?k("クリニック設定を保存しました","success"):v(ee.error==="conflict"?"他の変更と競合しました。もう一度お試しください。":ee.error)},[M,J]=f.useState(!1),H=typeof window<"u"?window.location.origin:"https://clinic-calendar-cmw.pages.dev",W=`<!-- ${p.name} 診療カレンダー -->
417<div id="clinic-calendar-widget"
418     data-api="${H}/api/public/schedule"
419     data-limit-months="3"></div>
420<script src="${H}/widget.js"><\/script>`,Ne=()=>{navigator.clipboard.writeText(W).catch(()=>{const ee=document.createElement("textarea");ee.value=W,document.body.appendChild(ee),ee.select(),document.execCommand("copy"),document.body.removeChild(ee)}),J(!0),setTimeout(()=>J(!1),3e3)},re=async(ee,Z)=>
420{if(!j)return;const xe={...w};xe[j.day]={...xe[j.day],[j.period]:{isOpen:ee,doctors:Z}};const be=await h(xe);if(!be.ok){k(be.error==="conflict"?"他の変更と競合しました。もう一度お試しください":`保存に失敗しました: ${be.error}`,"error");return}N(null)};return n.jsxs("div",{className:"space-y-8 animate-in fade-in duration-300",children:[n.jsx(lx,{doctors:g,saveDoctors:x,onDeleteDoctor:m}),n.jsx(Ue,{title:"クリニック名",icon:jp,children:n.jsx("input",{type:"text",value:p.name,onChange:ee=>o({...p,name:ee.target.value}),className:"w-full border border-gray-300 rounded-lg p-3 focus:ring-2 focus:ring-accent outline-none bg-white"})}),n.jsxs(Ue,{title:"診療時間の設定",icon:ra,children:[n.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:["am","pm"].map(ee=>n.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg border border-gray-200",children:[n.jsx("h3",{className:"font-bold text-gray-700 mb-3",children:ee==="am"?"午前":"午後"}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("input",{type:"time",value:ee==="am"?p.amStart:p.pmStart,onChange:Z=>o({...p,[ee==="am"?"amStart":"pmStart"]:Z.target.value}),className:"border rounded p-2 flex-1 focus:ring-2 focus:ring-accent outline-none bg-white"}),n.jsx("span",{className:"text-gray-500 font-bold",children:"〜"}),n.jsx("input",{type:"time",value:ee==="am"?p.amEnd:p.pmEnd,onChange:Z=>o({...p,[ee==="am"?"amEnd":"pmEnd"]:Z.target.value}),className:"border rounded p-2 flex-1 focus:ring-2 focus:ring-accent outline-none bg-white"})]})]},ee))}),n.jsxs("div",{className:"mt-4 pt-4 border-t flex items-center justify-between gap-3",children:[d?n.jsx("span",{className:"text-xs font-medium text-amber-700 bg-amber-50 border border-amber-200 rounded-full px-2.5 py-1",children:"未保存の変更あり"}):n.jsx("span",{}),n.jsxs("div",{className:"flex items-center gap-2",children:[b&&n.jsx("span",{className:"text-xs text-red-600",children:b}),n.jsx(le,{variant:"primary",size:"sm",onClick:()=>void V(),disabled:R||!d,children:R?"保存中…":"保存する"})]})]})]}),n.jsx(Ue,{title:"曜日別・基本診療スケジュール",icon:Np,headerExtra:n.jsx("span",{className:"text-xs text-gray-600 bg-accent-subtle border border-accent-subtle-2 px-3 py-1.5 rounded-full",children:"表の枠をクリックして担当医を編集"}),children:n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full min-w-[700px] border-collapse text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"bg-gray-50",children:[n.jsx("th",{className:"p-3 border text-gray-600 font-medium w-24",children:"時間帯"}),cx.map((ee,Z)=>n.jsxs("th",{className:`p-3 border font-medium
421                    ${Z===0?"text-semantic-error":Z===6?"text-accent-fg":"text-gray-600"}`,children:[ee,"曜"]},ee))]})}),n.jsx("tbody",{children:["am","pm"].map(ee=>n.jsxs("tr",{children:[n.jsxs("td",{className:"p-3 border font-medium text-gray-700 bg-gray-50 text-center leading-tight",children:[ee==="am"?"午前":"午後",n.jsx("div",{className:"text-[10px] text-gray-500 font-normal mt-1",children:ee==="am"?`${p.amStart}-${p.amEnd}`:`${p.pmStart}-${p.pmEnd}`})]}),[0,1,2,3,4,5,6].map(Z=>{const xe=w[Z][ee];return n.jsx("td",{className:`p-2 border cursor-pointer transition-all hover:bg-accent-subtle hover:shadow-inner
422                          ${xe.isOpen?"bg-white":"bg-gray-50/50"}`,onClick:()=>N({day:Z,period:ee,isOpen:xe.isOpen,doctors:xe.doctors}),children:n.jsxs("div",{className:"flex flex-col items-center gap-2 min-h-[60px] justify-center",children:[n.jsx("span",{className:`font-bold ${xe.isOpen?"text-accent-fg":"text-gray-500"}`,children:xe.isOpen?"◯ 診療":"ー 休診"}),xe.isOpen&&xe.doctors.length>0&&n.jsx("div",{className:"flex flex-wrap justify-center gap-1",children:xe.doctors.map(be=>{const je=g.find(ne=>ne.id===be);return je?n.jsx("span",{className:`text-[10px] px-1.5 py-0.5 rounded border ${yn[us(je.color)].classes}`,children:je.name},be):null})}),xe.isOpen&&xe.doctors.length===0&&n.jsx("span",{className:"text-[10px] text-semantic-error border border-red-200 bg-red-50 px-1 rounded",children:"未設定"})]})},`${Z}-${ee}`)})]},ee))})]})})})}),n.jsxs(Ue,{title:"HP埋め込みコード",icon:Ep,children:[n.jsxs("p",{className:"text-xs text-gray-600 mb-3 leading-relaxed",children:["WordPressのHTMLブロックにこのコードを貼り付けると診療カレンダーが表示されます。",n.jsx("br",{}),"カレンダー・お知らせを編集するたびにウィジェットも自動で最新データを反映します(HPへの反æ
422˜ ã¯æœ€å¤§5分ほどかかります)。貼り替え不要です。"]}),n.jsxs("div",{className:"mb-2 text-xs text-accent-fg bg-accent-subtle p-2 rounded border border-accent-subtle-2",children:[n.jsx("code",{children:'data-limit-months="3"'})," で当月・来月・再来月の3ヶ月のみ表示されます。"]}),n.jsxs("div",{className:"relative",children:[n.jsx("pre",{className:"bg-slate-800 text-slate-100 p-4 rounded-lg text-[10px] overflow-x-auto whitespace-pre-wrap font-mono leading-tight",children:W}),n.jsx("button",{onClick:Ne,className:`absolute top-2 right-2 px-2.5 py-1.5 rounded flex items-center gap-1 text-[10px] font-medium transition-all
423              ${M?"bg-semantic-success text-white":"bg-white/10 text-white hover:bg-white/20"}`,children:M?n.jsxs(n.Fragment,{children:[n.jsx(Ot,{className:"w-3.5 h-3.5"})," 完了"]}):n.jsxs(n.Fragment,{children:[n.jsx(as,{className:"w-3.5 h-3.5"})," コピー"]})})]})]}),n.jsxs(Ue,{title:"API利用料金(月次合計)",icon:Ip,children:[n.jsx("p",{className:"text-xs text-gray-500 mb-3",children:"clinic-calendar と HPチャットボットが同じデータベースを共有しているため、合計=両アプリ分です。"}),z?n.jsxs("p",{className:"text-sm text-red-600",children:["読み込みに失敗しました: ",z]}):D?n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-baseline gap-3",children:[n.jsx("span",{className:"text-xl font-bold text-gray-800",children:So(D.currentMonth.total)}),n.jsxs("span",{className:"text-sm text-gray-500",children:[zd(D.currentMonth.month),"(",D.currentMonth.count,"件)"]})]}),D.currentMonth.byLabel.length>0&&n.jsx("div",{className:"flex flex-wrap gap-2",children:D.currentMonth.byLabel.map(ee=>n.jsxs("span",{className:"text-xs text-gray-600 bg-gray-50 border border-gray-200 rounded-full px-3 py-1",children:[ee.label,": ",So(ee.total),"(",ee.count,"件)"]},ee.label))}),D.trailing.length>1&&n.jsxs("div",{className:"pt-3 border-t",children:[n.jsx("p",{className:"text-xs font-medium text-gray-600 mb-2",children:"直近の推移"}),n.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-gray-500",children:D.trailing.map(ee=>n.jsxs("span",{children:[zd(ee.month),": ",So(ee.total)]},ee.month))})]})]}):n.jsx("p",{className:"text-sm text-gray-500",children:"読み込み中…"})]}),j&&n.jsx(ox,{day:j.day,period:j.period,isOpen:j.isOpen,doctors:j.doctors,allDoctors:g,onClose:()=>N(null),onSave:re})]})}function dx(){const[l,o]=f.useState([]),[c,d]=f.useState([]),[h,x]=f.useState([]),[m,p]=f.useState(!1),[w,g]=f.useState(""),k=f.useCallback(async()=>{p(!0),g("");try{const[b,v,D]=await Promise.all([fetch("/api/phone/routing-rules",{credentials:"same-origin"}),fetch("/api/phone/destinations",{credentials:"same-origin"}),fetch("/api/phone/response-messages",{credentials:"same-origin"})]);if(!b.ok)throw new Error(`rules: HTTP ${b.status}`);if(!v.ok)throw new Error(`destinations: HTTP ${v.status}`);if(!D.ok)throw new Error(`messages: HTTP ${D.status}`);const _=await b.json(),z=await v.json(),F=await D.json();o(_.rules??[]),d(z.destinations??[]),x(F.messages??[])}catch(b){g(b instanceof Error?b.message:String(b))}finally{p(!1)}},[]);f.useEffect(()=>{k()},[k]);const j=f.useCallback(async b=>{const v=await fetch("/api/phone/routing-rules",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({rules:b})});if(!v.ok){const _=await v.json().catch(()=>({}));throw new Error(_.error??`HTTP ${v.status}`)}const D=await v.json();o(D.rules??[])},[]),N=f.useCallback(async b=>{const v=await fetch("/api/phone/destinations",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({destinations:b})});if(!v.ok){const _=await v.json().catch(()=>({}));throw new Error(_.error??`HTTP ${v.status}`)}const D=await v.json();d(D.destinations??[])},[]),R=f.useCallback(async b=>{const v=await fetch("/api/phone/response-messages",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:b})});if(!v.ok){const _=await v.json().catch(()=>({}));throw new Error(_.error??`HTTP ${v.status}`)}const D=await v.json();x(D.messages??[])},[]),T=f.useCallback(async b=>{const v=await fetch(`/api/phone/response-messages?preview=${encodeURIComponent(b)}`,{credentials:"same-origin"});return v.ok?await v.json():null},[]);return{rules:l,destinations:c,messages:h,loading:m,error:w,reload:k,saveRules:j,saveDestinations:N,saveMessages:R,previewMessage:T}}function Mo(l){const o=new Date(l+324e5),c=d=>String(d).padStart(2,"0");return`${o.getUTCFullYear()}-${c(o.getUTCMonth()+1)}-${c(o.getUTCDate())}T${c(o.getUTCHours())}:${c(o.getUTCMinutes())}`}function ia(l){const o=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(l);if(!o)return NaN;const[,c,d,h,x,m]=o.map(Number);return Date.UTC(c,d-1,h,x-9,m,0,0)}function fx(l){const o=new Date(l+324e5),c=d=>String(d).padStart(2,"0");return`${o.getUTCFullYear()}/${c(o.getUTCMonth()+1)}/${c(o.getUTCDate())} ${c(o.getUTCHours())}:${c(o.getUTCMinutes())}`}const Rd=["日","月","火","水","木","金","土"],mx={forward_clinic:"在宅診療部へ転送",auto_response:"自動応答",forward_outsource:"業者へ転送",forward_outpatient:"外来へ転送"},px=["forward_clinic","auto_response","forward_outsource"];function Ad(l){const o=Math.floor(l/60),c=l%60;return`${String(o).padStart(2,"0")}
423:${String(c).padStart(2,"0")}`}function yl(l){const[o,c]=l.split(":").map(Number);return Number.isNaN(o)||Number.isNaN(c)?0:o*60+c}function hx(l,o){if(!l.effectiveFromInput&&!l.effectiveToInput)return null;const c=l.effectiveFromInput?ia(l.effectiveFromInput):null,d=l.effectiveToInput?ia(l.effectiveToInput):null;return c!=null&&o<c?{label:`${l.effectiveFromInput.replace("T"," ")} から`,className:"bg-accent-subtle text-accent-hover"}:d!=null&&o>=d?{label:"終了済",className:"bg-gray-100 text-gray-600"}:{label:"適用中",className:"bg-green-50 text-green-700"}}function xx({rules:l,onSave:o,nowMs:c}){const[d,h]=f.useState([]),[x,m]=f.useState(!1),[p,w]=f.useState(""),[g,k]=f.useState(!1);f.useEffect(()=>{h(l.map((v,D)=>({key:`r${v.id}-${D}`,day_of_week:v.day_of_week,start:Ad(v.start_minutes),end:Ad(v.end_minutes),action:v.action,message_key:v.message_key??"",sort_order:v.sort_order,effectiveFromInput:v.effective_from!=null?Mo(v.effective_from):"",effectiveToInput:v.effective_to!=null?Mo(v.effective_to):""})))},[l]);const j=(v,D)=>{h(_=>_.map((z,F)=>F===v?{...z,...D}:z))},N=()=>{h(v=>[...v,{key:`new-${Date.now()}`,day_of_week:1,start:"09:00",end:"17:30",action:"forward_clinic",message_key:"",sort_order:v.length+1,effectiveFromInput:"",effectiveToInput:""}])},R=v=>h(D=>D.filter((_,z)=>z!==v)),T=async()=>{w(""),k(!1),m(!0);try{const v=d.map((D,_)=>({day_of_week:D.day_of_week,start_minutes:yl(D.start),end_minutes:yl(D.end),action:D.action,message_key:D.action==="auto_response"?D.message_key||"default":null,sort_order:D.sort_order||_+1,effective_from:D.effectiveFromInput?ia(D.effectiveFromInput):null,effective_to:D.effectiveToInput?ia(D.effectiveToInput):null}));for(const D of v){if(D.end_minutes<=D.start_minutes)throw new Error("終了時刻は開始時刻より後にしてください");if(D.effective_from!=null&&D.effective_to!=null&&D.effective_from>=D.effective_to)throw new Error("有効期間の開始は終了より前にしてください")}await o(v),k(!0),setTimeout(()=>k(!1),3e3)}catch(v){w(v instanceof Error?v.message:String(v))}finally{m(!1)}},b=[...d].sort((v,D)=>v.day_of_week-D.day_of_week||yl(v.start)-yl(D.start));return n.jsxs("div",{className:"space-y-4",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"曜日と時間帯ごとに動作を設定します。ルールが無い時間帯はデフォルトで「業者へ転送」となります。 有効期間を入れると、その日時ちょうどからルールを差し替えられます(契約変更の予約など)。"}),n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsxs("tr",{children:[n.jsx("th",{className:"p-2 text-left font-medium text-gray-600 w-16",children:"曜日"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"開始"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"終了"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"動作"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"メッセージkey"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"有効期間"}),n.jsx("th",{className:"p-2",children:n.jsx("span",{className:"sr-only",children:"操作"})})]})}),n.jsx("tbody",{className:"divide-y",children:b.map((v,D)=>{const _=d.findIndex(V=>V.key===v.key),z=hx(v,c),F=`${D+1}行目(${Rd[v.day_of_week]}曜日 ${v.start}〜${v.end})`;return n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsx("td",{className:"p-2",children:n.jsx("select",{value:v.day_of_week,onChange:V=>j(_,{day_of_week:Number(V.target.value)}),"aria-label":`${F} 曜日`,className:"border rounded px-1.5 py-1 text-sm",children:Rd.map((V,M)=>n.jsx("option",{value:M,children:V},M))})}),n.jsx("td",{className:"p-2",children:n.jsx("input",{type:"time",value:v.start,onChange:V=>j(_,{start:V.target.value}),"aria-label":`${F} 開始時刻`,className:"border rounded px-1.5 py-1 text-sm"})}),n.jsx("td",{className:"p-2",children:n.jsx("input",{type:"time",value:v.end,onChange:V=>j(_,{end:V.target.value}),"aria-label":`${F} 終了時刻`,className:"border rounded px-1.5 py-1 text-sm"})}),n.jsx("td",{className:"p-2",children:n.jsx("select",{value:v.action,onChange:V=>j(_,{action:V.target.value}),"aria-label":`${F} 動作`,className:"border rounded px-1.5 py-1 text-sm",children:px.map(V=>n.jsx("option",{value:V,children:mx[V]},V))})}),n.jsx("td",{className:"p-2",children:n.jsx("input",{type:"text",value:v.message_key,onChange:V=>j(_,{message_key:V.target.value}),placeholder:"default",disabled:v.action!=="auto_response","aria-label":`${F} メッセージkey`,className:"border rounded px-1.5 py-1 text-sm w-24 disabled:bg-gray-100"})}),n.jsx("td",{className:"p-2",children:n.jsxs("div",{className:"flex flex-col gap-1",children:[n.jsx("input",{type:"datetime-local",value:v.effectiveFromInput,onChange:V=>j(_,{effectiveFromInput:V.target.value}),className:"border rounded px-1.5 py-1 text-xs","aria-label":"有効期間の開始"}),n.jsx("input",{type:"datetime-local",value:v.effectiveToInput,onChange:V=>
423j(_,{effectiveToInput:V.target.value}),className:"border rounded px-1.5 py-1 text-xs","aria-label":"有効期間の終了"}),z&&n.jsx("span",{className:`inline-block w-fit px-1.5 py-0.5 rounded text-[11px] ${z.className}`,children:z.label})]})}),n.jsx("td",{className:"p-2 text-right",children:n.jsx("button",{onClick:()=>R(_),className:"text-semantic-error hover:bg-red-50 p-3.5 -m-1 rounded","aria-label":"削除",children:n.jsx(hr,{className:"w-4 h-4","aria-hidden":!0})})})]},v.key)})})]})})}),n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs(le,{variant:"ghost",size:"sm",onClick:N,children:[n.jsx(cs,{className:"w-4 h-4","aria-hidden":!0})," ルール追加"]}),n.jsxs("div",{className:"flex items-center gap-3",children:[p&&n.jsx("span",{className:"text-sm text-red-600",children:p}),g&&n.jsx("span",{className:"text-sm text-semantic-success",children:"保存しました"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:T,disabled:x,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",x?"保存中…":"保存"]})]})]})]})}function aa({id:l,label:o,hint:c,error:d,size:h="md",visuallyHidden:x=!1,className:m="",children:p}){const w=f.useId(),g=l??w,k=h==="sm"?"block text-xs text-gray-500 mb-1":"block text-sm font-medium text-gray-700 mb-1",j=d?`${g}-error`:c?`${g}-hint`:void 0,N=f.cloneElement(p,{id:g,"aria-invalid":d?!0:void 0,"aria-describedby":j});return n.jsxs("div",{className:m,children:[n.jsx("label",{htmlFor:g,className:x?"sr-only":k,children:o}),N,c&&!d&&n.jsx("p",{id:`${g}-hint`,className:"text-xs text-gray-500 mt-1",children:c}),d&&n.jsx("p",{id:`${g}-error`,className:"text-xs text-red-600 mt-1",children:d})]})}const ko={clinic_landline:"在宅診療部 固定電話",clinic_outpatient:"外来 固定電話",outsource:"往診代行業者 専用番号",twilio_inbound:"Twilio 着信番号(公開用)"},gx={clinic_landline:"在宅診療部スタッフの勤務時間帯の転送先(在宅診療部のJCOM固定電話)",clinic_outpatient:"カレンダーで臨時診療が設定された時間帯の転送先(在宅が不在でも外来が開いているため外来へ)。未登録時は通常の振り分けにフォールバックされます。",outsource:"営業時間外・休業日の業者転送先。未登録時は自動応答にフォールバックされます。",twilio_inbound:"Twilio で取得した公開電話番号(参考表示。Webhook 自体は Twilio Console で設定)"},yx=["clinic_landline","clinic_outpatient","outsource","twilio_inbound"];function vx({destinations:l,onSave:o}){const[c,d]=f.useState(()=>({clinic_landline:{number_e164:"",label:""},clinic_outpatient:{number_e164:"",label:""},outsource:{number_e164:"",label:""},twilio_inbound:{number_e164:"",label:""}})),[h,x]=f.useState(!1),[m,p]=f.useState(""),[w,g]=f.useState(!1);f.useEffect(()=>{const N={...c};for(const R of Object.keys(N)){const T=l.find(b=>b.key===R);N[R]={number_e164:(T==null?void 0:T.number_e164)??"",label:(T==null?void 0:T.label)??""}}d(N)},[l]);const k=async()=>{p(""),g(!1),x(!0);try{const N=Object.keys(c).map(R=>({key:R,number_e164:c[R].number_e164.trim(),label:c[R].label.trim()||null}));await o(N),g(!0),setTimeout(()=>g(!1),3e3)}catch(N){p(N instanceof Error?N.message:String(N))}finally{x(!1)}},j=!c.outsource.number_e164.trim();return n.jsxs("div",{className:"space-y-4",children:[j&&n.jsxs("div",{className:"flex items-start gap-2 bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm text-amber-800",children:[n.jsx(xr,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),n.jsxs("div",{children:[n.jsx("strong",{children:"業者番号が未登録です。"}),"営業時間外・休業日・祝日の着信は",n.jsx("u",{children:"自動応答"}),"へフォールバックされます。業者番号を登録するまでの暫定挙動です。"]})]}),yx.map(N=>n.jsxs("div",{className:"border rounded-lg p-3 bg-gray-50",children:[n.jsxs("div",{className:"flex items-center gap-2 font-medium text-gray-800 mb-1",children:[n.jsx(of,{className:"w-4 h-4 text-accent-fg"}),ko[N]]}),n.jsx("p",{className:"text-xs text-gray-500 mb-2",children:gx[N]}),n.jsxs("div",{className:"grid sm:grid-cols-2 gap-2",children:[n.jsx(aa,{label:"番号(E.164 例: +81422033040)",size:"sm",children:n.jsx("input",{type:"text",value:c[N].number_e164,onChange:R=>d(T=>({...T,[N]:{...T[N],number_e164:R.target.value}})),placeholder:"+81...","aria-label":`${ko[N]} 番号(E.164)`,className:"w-full border rounded px-2 py-1.5 text-sm font-mono"})}),n.jsx(aa,{label:"表示ラベル",size:"sm",children:n.jsx("input",{type:"text",value:c[N].label,onChange:R=>d(T=>({...T,[N]:{...T[N],label:R.target.value}})),"aria-label":`${ko[N]} 表示ラベル`,className:"w-full border rounded px-2 py-1.5 text-sm"})})]})]},N)),n.jsxs("div",{className:"flex items-center justify-end gap-3",children:[m&&n.jsx("span",{className:"text-sm text-red-600",children:m}),w&&n.jsx("span",{className:"text-sm text-semantic-success",children:"保存しました"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:k,disabled:h,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",h?"保存中…":"保存"]})]})]})}function wx(l){const[o,c]=f.useState([]),[d,h]=f.useState(!1),[x,m]=f.useState(""),p=f.useCallback(async()=>{h(!0),m("");try{const j=l?`?dest_key=${encodeURIComponent(l)}`:"",N=await fetch(`/api/phone/destination-schedule${j}`,{credentials:"same-origin"});if(!N.ok)throw new Error(`HTTP ${N.status}`);const R=await N.json();c(R.schedules??[])}catch(j){m(j instanceof Error?j.message:String(j))}finally{h(!1)}},[l]);f.useEffect(()=>{p()},[p]);const w=f.useCallback(async j=>{const N=await fetch("/api/phone/destination-schedule",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(j)});if(!N.ok){const R=await N.json().catch(()=>({}));throw new Error(R.error??`HTTP ${N.status}`)}await p()},[p]),g=f.useCallback(async(j,N)=>{const R=await fetch("/api/phone/destination-schedule",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:j,...N})});if(!R.ok){const T=await R.json().catch(()=>({}));throw new Error(T.error??`HTTP ${R.status}`)}await p()},[p]),k=f.useCallback(async j=>{const N=await fetch(`/api/phone/destination-schedule?id=${j}`,{method:"DELETE",credentials:"same-origin"});if(!N.ok){const R=await N.json().catch(()=>({}));throw new Error(R.error??`HTTP ${N.status}`)}await p()},[p]);return{schedules:o,loading:d,error:x,reload:p,create:w,update:g,remove:k}}const Id="outsource";function vl(l){return l?l.startsWith("+81")?"0"+l.slice(3):l:"(未入力)"}function jx({nowMs:l}){const{schedules:o,error:c,create:d,update:h,remove:x}=wx(Id),[m,p]=f.useState(null),[w,g]=f.useState(!1),[k,j]=f.useState(""),N=Kn(),R=()=>
423{p({number:"",effectiveInput:"",note:""}),j("")},T=_=>{p({id:_.id,number:vl(_.number_e164)==="(未入力)"?"":vl(_.number_e164),effectiveInput:Mo(_.effective_at),note:_.note??""}),j("")},b=()=>{p(null),j("")},v=async()=>{if(!m)return;const _=ia(m.effectiveInput);if(!Number.isFinite(_)){j("切替日時を入力してください");return}g(!0),j("");try{m.id?await h(m.id,{number:m.number,effective_at:_,note:m.note||void 0}):await d({dest_key:Id,number:m.number,effective_at:_,note:m.note||void 0}),p(null)}catch(z){j(z instanceof Error?z.message:String(z))}finally{g(!1)}},D=async _=>{if(await N({title:"予約切替の削除",message:"この予約切替を削除しますか?電話ルーティング(着信の振り分け)に影響します。",confirmLabel:"削除する"})){j("");try{await x(_)}catch(F){j(F instanceof Error?F.message:String(F))}}};return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"指定日時(JST)から往診代行業者の転送先番号を自動で切り替えます。番号が未定のうちは空欄で登録し、分かり次第入力してください。 切替日時を過ぎても番号が空の場合は、旧番号には転送せず自動音声案内になります。"}),(c||k)&&n.jsx("div",{className:"text-sm text-red-600",children:c||k}),n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsxs("tr",{children:[n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"切替日時(JST)"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"切替後の番号"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"メモ"}),n.jsx("th",{className:"p-2 text-right"})]})}),n.jsx("tbody",{className:"divide-y",children:o.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:4,className:"p-3 text-center text-gray-500",children:"予約はありません"})}):o.map(_=>{const z=_.effective_at<=l,F=!_.number_e164,V=z&&F;return n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsxs("td",{className:"p-2 whitespace-nowrap text-gray-800",children:[fx(_.effective_at),z&&n.jsx("span",{className:"ml-1.5 text-xs text-gray-500",children:"(適用中)"})]}),n.jsxs("td",{className:"p-2 font-mono text-xs",children:[n.jsx("span",{className:F?"text-semantic-warning":"text-gray-700",children:vl(_.number_e164)}),V&&n.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-amber-700",children:[n.jsx(xr,{className:"w-3.5 h-3.5"}),"番号未入力のため自動音声中"]})]}),n.jsx("td",{className:"p-2 text-gray-500",children:_.note??""}),n.jsxs("td",{className:"p-2 text-right whitespace-nowrap",children:[n.jsx("button",{onClick:()=>T(_),"aria-label":"編集",className:"text-accent-fg hover:bg-accent-subtle p-3.5 -m-0.5 rounded mr-1",children:n.jsx(os,{className:"w-4 h-4","aria-hidden":!0})}),n.jsx("button",{onClick:()=>void D(_.id),"aria-label":"削除",className:"text-semantic-error hover:bg-red-50 p-3.5 -m-0.5 rounded",children:n.jsx(hr,{className:"w-4 h-4","aria-hidden":!0})})]})]},_.id)})})]})})}),n.jsxs(le,{variant:"ghost",size:"sm",onClick:R,children:[n.jsx(cs,{className:"w-4 h-4","aria-hidden":!0})," 予約切替を追加"]}),m&&n.jsx(Qn,{title:m.id?"予約切替を編集":"予約切替を追加",icon:n.jsx(Cl,{className:"w-4 h-4 text-accent-fg","aria-hidden":!0}),onClose:b,footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:b,children:"キャンセル"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:()=>void v(),disabled:w||!m.effectiveInput,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",w?"保存中…":"保存"]})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"切替日時(JST)"}),n.jsx("input",{type:"datetime-local",value:m.effectiveInput,onChange:_=>p(z=>z&&{...z,effectiveInput:_.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"切替後の番号(未定なら空欄)"}),n.jsx("input",{value:m.number,onChange:_=>p(z=>z&&{...z,number:_.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm font-mono",placeholder:"ä¾
423‹ï¼š050-1234-5678(分かり次第)"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"メモ"}),n.jsx("input",{value:m.note,onChange:_=>p(z=>z&&{...z,note:_.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm",placeholder:"例:新往診代行業者へ切替"})]}),k&&n.jsx("div",{className:"text-sm text-red-600",children:k})]})})]})}function Nx(){const[l,o]=f.useState("male"),[c,d]=f.useState(!1),[h,x]=f.useState("");f.useEffect(()=>{let p=!1;return d(!0),fetch("/api/phone/voice",{credentials:"same-origin"}).then(w=>w.ok?w.json():null).then(w=>{!p&&w&&o(w.voice==="female"?"female":"male")}).catch(()=>{}).finally(()=>{p||d(!1)}),()=>{p=!0}},[]);const m=f.useCallback(async p=>{const w=l;o(p),x("");try{const g=await fetch("/api/phone/voice",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({voice:p})});if(!g.ok)throw new Error(`HTTP ${g.status}`)}catch(g){o(w),x(g instanceof Error?g.message:String(g))}},[l]);return{voice:l,loading:c,error:h,setVoice:m}}const Sx={male:"男性(穏やか・Takumi)",female:"女性(穏やか・Kazuha)"};function kx({messages:l,onSave:o,onPreview:c}){const{voice:d,setVoice:h}=Nx(),[x,m]=f.useState([]),[p,w]=f.useState(!1),[g,k]=f.useState(""),[j,N]=f.useState(!1),[R,T]=f.useState({}),[b,v]=f.useState(null),[D,_]=f.useState("");f.useEffect(()=>{m(l.map(J=>({...J})))},[l]);const z=async(J,H)=>{_(""),v(J);try{const W=await fetch("/api/phone/tts-preview",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:H,voice:d})});if(!W.ok){const Z=await W.json().catch(()=>({}));throw new Error(Z.error??`HTTP ${W.status}`)}const Ne=await W.blob(),re=URL.createObjectURL(Ne),ee=new Audio(re);ee.onended=()=>{URL.revokeObjectURL(re),v(null)},ee.onerror=()=>{URL.revokeObjectURL(re),v(null)},await ee.play()}catch(W){_(W instanceof Error?W.message:String(W)),v(null)}},F=(J,H)=>m(W=>W.map((Ne,re)=>re===J?{...Ne,...H}:Ne)),V=async()=>{k(""),N(!1),w(!0);try{const J=x.map(H=>({key:H.key,text:H.text,audio_url:H.audio_url??null}));await o(J),N(!0),setTimeout(()=>N(!1),3e3)}catch(J){k(J instanceof Error?J.message:String(J))}finally{w(!1)}},M=async J=>{const H=await c(J);H&&T(W=>({...W,[J]:H.expanded}))};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"text-sm text-gray-600 bg-accent-subtle border border-accent-border rounded-lg p-3",children:[n.jsx("strong",{children:"placeholder:"})," 本文中に ",n.jsx("code",{className:"bg-white px-1 rounded",children:"{next_business_day}"})," と書くと、 着信時に「次回診療日(例:",n.jsx("code",{className:"bg-white px-1 rounded",children:"7月17日木曜日"}),")」に自動で置換されます。"]}),n.jsxs("div",{className:"border rounded-lg p-3 bg-gray-50",children:[n.jsxs("div",{className:"text-sm font-medium text-gray-800 mb-2 flex items-center gap-1.5",children:[n.jsx(wd,{className:"w-4 h-4 text-accent-fg"})," 読み上げの声"]}),n.jsx("div",{className:"flex flex-wrap gap-2",children:["male","female"].map(J=>n.jsxs("label",{className:`flex items-center gap-2 px-3 py-1.5 border rounded-lg cursor-pointer text-sm bg-white transition-colors
424                ${d===J?"border-accent ring-1 ring-accent text-accent-hover":"hover:bg-gray-50 text-gray-700"}`,children:[n.jsx("input",{type:"radio",name:"voice",checked:d===J,onChange:()=>h(J),className:"w-4 h-4"}),Sx[J]]},J))}),n.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"選んだ声が実際の着信時にも使われます。各メッセージの「試聴」で、電話と同じ声を確認できます。"}),D&&n.jsx("p",{className:"text-xs text-red-600 mt-1",children:D})]}),x.map((J,H)=>n.jsxs("div",{className:"border rounded-lg p-3 bg-gray-50",children:[n.jsxs("div",{className:"flex items-center justify-between mb-2",children:[n.jsxs("div",{className:"text-sm font-medium text-gray-800",children:["key: ",n.jsx("code",{className:"bg-white px-1.5 py-0.5 rounded text-accent-hover",children:J.key})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{type:"button",variant:"ghost",size:"sm",onClick:()=>z(J.key,J.text),disabled:b===J.key||!J.text.trim(),children:b===J.key?n.jsxs(n.Fragment,{children:[n.jsx(Lt,{className:"w-3.5 h-3.5 animate-spin","aria-hidden":!0})," 再生中…"]}):n.jsxs(n.Fragment,{children:[n.jsx(wd,{className:"w-3.5 h-3.5","aria-hidden":!0})," 試聴"]})}),n.jsxs(le,{type:"button",variant:"ghost",size:"sm",onClick:()=>M(J.key),children:[n.jsx(Ao,{className:"w-3.5 h-3.5","aria-hidden":!0})," 展開プレビュー"]})]})]}),n.jsx("textarea",{value:J.text,onChange:W=>F(H,{text:W.target.value}),rows:5,className:"w-full border rounded px-2 py-1.5 text-sm leading-relaxed"}),n.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:[J.text.length," / 2000 文字"]}),R[J.key]&&n.jsxs("div",{className:"mt-2 text-sm bg-white border border-gray-200 rounded p-2",children:[n.jsx("div",{className:"text-xs text-gray-500 mb-1",children:"展開後:"}),n.jsx("div",{className:"text-gray-800 whitespace-pre-wrap",children:R[J.key]})]})]},J.key)),n.jsxs("div",{className:"flex items-center justify-end gap-3",children:[g&&n.jsx("span",{className:"text-sm text-red-600",children:g}),j&&n.jsx("span",{className:"text-sm text-semantic-success",children:"保存しました"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:V,disabled:p,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",p?"保存中…":"保存"]})]})]})}function bx(){const[l,o]=f.useState([]),[c,d]=f.useState(!1),[h,x]=f.useState(""),m=f.useCallback(async()=>{d(!0),x("");try{const k=await fetch("/api/phone/business-closures",{credentials:"same-origin"});if(!k.ok)throw new Error(`HTTP ${k.status}`);const j=await k.json();o(j.closures??[])}catch(k){x(k instanceof Error?k.message:String(k))}finally{d(!1)}},[]);f.useEffect(()=>{m()},[m]);const p=f.useCallback(async k=>{const j=await fetch("/api/phone/business-closures",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)});if(!j.ok){const N=await j.json().catch(()=>({}));throw new Error(N.error??`HTTP ${j.status}`)}await m()},[m]),w=f.useCallback(async(k,j)=>{const N=await fetch("/api/phone/business-closures",{method:"PUT",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:k,...j})});if(!N.ok){const R=await N.json().catch(()=>({}));throw new Error(R.error??`HTTP ${N.status}`)}await m()},[m]),g=f.useCallback(async k=>{const j=await fetch(`/api/phone/business-closures?id=${k}`,{method:"DELETE",credentials:"same-origin"});if(!j.ok){const N=await j.json().catch(()=>({}));throw new Error(N.error??`HTTP ${j.status}`)}await m()},[m]);return{closures:l,loading:c,error:h,reload:m,create:p,update:w,remove:g}}function Ex({columns:l,rows:o,rowKey:c,emptyMessage:d,pagination:h,rowClassName:x,className:m=""}){const p=(h==null?void 0:h.pageSizeOptions)??[10,25,50,100],w=h?Math.max(1,Math.ceil(h.total/h.pageSize)):1;return n.jsxs("div",{className:`space-y-3 ${m}`,children:[n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsx("tr",{children:l.map(g=>n.jsx("th",{className:`p-2 text-left font-medium text-gray-600 ${g.headerClassName??""}`,children:g.headerSrOnly?n.jsx("span",{className:"sr-only",children:g.header}):g.header},g.key))})}),n.jsx("tbody",{className:"divide-y",children:o.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:l.length,className:"p-3 text-center text-gray-500",children:d})}):o.map(g=>n.jsx("tr",{className:`hover:bg-gray-50 ${(x==null?void 0:x(g))??""}`,children:l.map(k=>n.jsx("td",{className:`p-2 ${k.cellClassName??""}`,children:k.render(g)},k.key))},c(g)))})]})})}),h&&n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("label",{className:"flex items-center gap-2 text-gray-500",children:[n.jsx("span",{children:"表示件数"}),n.jsx("select",{value:h.pageSize,onChange:g=>h.onPageSizeChange(Number(g.target.value)),className:"border border-gray-200 rounded px-2 py-1 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-accent",children:p.map(g=>n.jsxs("option",{value:g,children:[g,"件"]},g))})]}),w>1&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>h.onPageChange(Math.max(1,h.page-1)),disabled:h.page===1,"aria-label":"前へ",className:"p-3.5 -m-0.5 rounded hover:bg-gray-100 disabled:opacity-30",children:n.jsx(is,{className:"w-4 h-4","aria-hidden":!0})}),n.jsxs("span",{className:"text-gray-700",children:[h.page," / ",w]}),n.jsx("button",{onClick:()=>h.onPageChange(Math.min(w,h.page+1)),disabled:h.page===w,"aria-label":"次へ",className:"p-3.5 -m-0.5 rounded hover:bg-gray-100 disabled:opacity-30",children:n.jsx(pr,{className:"w-4 h-4","aria-hidden":!0})})]})]})]})}const bo={auto_response:"自動応答(平日9-17のみ、それ以外は業者)",forward_outsource:"業者へ転送(終日)"};function Cx(){return{date:"",yearly_recurring:0,action:"forward_outsource",note:""}}function _x(){const{closures:l,error:o,create:c,update:d,remove:h}=bx(),[x,m]=f.useState(null),[p,w]=f.useState(!1),[g,k]=f.useState(""),j=Kn(),N=_=>{m({id:_.id,date:_.date,yearly_recurring:_.yearly_recurring===1?1:0,action:_.action,note:_.note??""}),k("")},R=()=>{m(Cx()),k("")},T=()=>{m(null),k("")},b=async()=>
424{if(x){k(""),w(!0);try{const _=x.yearly_recurring===1?1:0;let z=x.date;_===1&&/^\d{4}-\d{2}-\d{2}$/.test(z)?z="0000-"+z.slice(5):_===1&&/^\d{2}-\d{2}$/.test(z)&&(z="0000-"+z);const F={date:z,yearly_recurring:_,action:x.action,note:x.note||null};x.id?await d(x.id,F):await c(F),m(null)}catch(_){k(_ instanceof Error?_.message:String(_))}finally{w(!1)}}},v=async _=>{if(await j({title:"休業日設定の削除",message:"この休業日設定を削除しますか?電話ルーティング(着信の振り分け)に影響します。",confirmLabel:"削除する"})){k("");try{await h(_)}catch(F){k(F instanceof Error?F.message:String(F))}}},D=[{key:"date",header:"日付",render:_=>n.jsx("span",{className:"font-mono text-gray-800",children:_.date})},{key:"recurring",header:"繰り返し",render:_=>n.jsx("span",{className:"text-gray-600",children:_.yearly_recurring===1?"毎年":"特定日"})},{key:"action",header:"動作",render:_=>n.jsx("span",{className:"text-gray-600",children:bo[_.action]})},{key:"note",header:"メモ",render:_=>n.jsx("span",{className:"text-gray-500",children:_.note??""})},{key:"ops",header:"操作",headerSrOnly:!0,cellClassName:"text-right whitespace-nowrap",render:_=>n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>N(_),"aria-label":"編集",className:"text-accent-fg hover:bg-accent-subtle p-3.5 -m-0.5 rounded mr-1",children:n.jsx(os,{className:"w-4 h-4","aria-hidden":!0})}),n.jsx("button",{onClick:()=>void v(_.id),"aria-label":"削除",className:"text-semantic-error hover:bg-red-50 p-3.5 -m-0.5 rounded",children:n.jsx(hr,{className:"w-4 h-4","aria-hidden":!0})})]})}];return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"全職員休業の休業日を登録します。特定日と「毎年繰り返し」(年末年始など)に対応します。 今年だけの全館休業(夏季休業など)はカレンダーの臨時休診「休業日(全職員休業)」でも設定できます。"}),(o||g)&&n.jsx("div",{className:"text-sm text-red-600",children:o||g}),n.jsx(Ex,{columns:D,rows:l,rowKey:_=>_.id,emptyMessage:"休業日は未設定です"}),n.jsx("div",{children:n.jsxs(le,{variant:"ghost",size:"sm",onClick:R,children:[n.jsx(cs,{className:"w-4 h-4","aria-hidden":!0})," 休業日を追加"]})}),x&&n.jsx(Qn,{title:x.id?"休業日を編集":"休業日を追加",onClose:T,footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:T,children:"キャンセル"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:()=>void b(),disabled:p||!x.date,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",p?"保存中…":"保存"]})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{id:"yearly",type:"checkbox",checked:x.yearly_recurring===1,onChange:_=>m(z=>z&&{...z,yearly_recurring:_.target.checked?1:0,date:_.target.checked?z.date&&/^\d{4}-\d{2}-\d{2}$/.test(z.date)?"0000-"+z.date.slice(5):z.date:z.date&&/^0000-\d{2}-\d{2}$/.test(z.date)?new Date().getFullYear()+"-"+z.date.slice(5):z.date})}),n.jsx("label",{htmlFor:"yearly",className:"text-sm text-gray-700",children:"毎年同じ月日に適用する"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"日付"}),x.yearly_recurring===1?n.jsx("input",{type:"text",value:x.date,onChange:_=>m(z=>z&&{...z,date:_.target.value}),placeholder:"0000-12-29 または MM-DD",className:"w-full border rounded px-2 py-1.5 text-sm font-mono"}):n.jsx("input",{type:"date",value:x.date,onChange:_=>m(z=>z&&{...z,date:_.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"動作"}),n.jsxs("select",{value:x.action,onChange:_=>m(z=>z&&{...z,action:_.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm",children:[n.jsx("option",{value:"forward_outsource",children:bo.forward_outsource}),n.jsx("option",{value:"auto_response",children:bo.auto_response})]})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"メモ"}),n.jsx("input",{type:"text",value:x.note,onChange:_=>m(z=>z&&{...z,note:_.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm"})]}),g&&n.jsx("div",{className:"text-sm text-red-600",children:g})]})})]})}function Tx(){const[l,o]=f.useState([]),[c,d]=f.useState(!1),[h,x]=f.useState(""),m=f.useCallback(async()=>{d(!0),x("");try{const p=await fetch("/api/phone/calendar-closures",{credentials:"same-origin"});if(!p.ok)throw new Error(`HTTP ${p.status}`);const w=await p.json();o(w.closures??[])}catch(p){x(p instanceof Error?p.message:String(p))}finally{d(!1)}},[]);return f.useEffect(()=>{m()},[m]),{closures:l,loading:c,error:h,reload:m}}const Lx=["日","月","火","水","木","金","土"],Px={ALL:"終日",AM:"午前",PM:"午後"},Mx={forward_clinic:"在宅診療部へ転送",forward_outpatient:"外来へ転送",auto_response:"自動応答",forward_outsource:"業者へ転送"};function $x(){const l=Date.now()+324e5,o=new Date(l);return`${o.getUTCFullYear()}
424-${String(o.getUTCMonth()+1).padStart(2,"0")}-${String(o.getUTCDate()).padStart(2,"0")}`}function Dx(l){const[o,c,d]=l.split("-").map(Number);if(!o||!c||!d)return l;const h=new Date(Date.UTC(o,c-1,d)).getUTCDay();return`${o}年${c}月${d}日(${Lx[h]})`}function zx({c:l}){return!l.phoneTimeline||l.phoneTimeline.length===0?n.jsx("span",{className:"text-xs text-gray-500",children:"—"}):n.jsx("div",{className:"space-y-0.5",children:l.phoneTimeline.map((o,c)=>n.jsxs("div",{className:"flex items-baseline gap-2 whitespace-nowrap",children:[n.jsxs("span",{className:"font-mono text-xs text-gray-500",children:[o.start,"–",o.end]}),n.jsx("span",{className:"text-xs text-gray-700",children:Mx[o.action]??o.action})]},c))})}function Rx({c:l}){if(l.phoneTimeline==null)return n.jsx("span",{className:"text-xs text-gray-500",children:"—"});if(!l.phoneClosure)return n.jsx("span",{className:"text-xs text-gray-500",children:"なし(カレンダー設定のみで反映)"});const o=l.phoneClosure.action==="forward_outsource"?"終日 業者へ転送":"日中 自動応答";return n.jsxs("span",{className:"inline-block px-1.5 py-0.5 rounded text-[11px] bg-accent-subtle text-accent-hover whitespace-nowrap",children:["あり(",o,")"]})}function Od({c:l,withDetail:o}){return n.jsxs("tr",{className:"hover:bg-gray-50 align-top",children:[n.jsx("td",{className:"p-2 text-gray-800 whitespace-nowrap",children:Dx(l.date)}),n.jsx("td",{className:"p-2 text-gray-600 whitespace-nowrap",children:Px[l.time_range]}),o&&n.jsx("td",{className:"p-2",children:n.jsx(zx,{c:l})}),o&&n.jsx("td",{className:"p-2",children:n.jsx(Rx,{c:l})}),n.jsx("td",{className:"p-2 text-gray-500",children:l.note||"—"})]})}function Ax(){const{closures:l,loading:o,error:c}=Tx(),d=$x(),h=l.filter(p=>p.date>=d),x=l.filter(p=>p.date<d).reverse(),m=h.filter(p=>p.phoneTimeline==null).length;return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"カレンダーの臨時休診で「休業日(全職員休業)」にチェックした日の一覧と、その日の電話側の扱いです。 編集はカレンダーの「臨時予定」から行ってください。"}),n.jsxs("div",{className:"flex items-start gap-2 text-sm text-gray-600 bg-accent-subtle/60 border border-accent-subtle-2 roun
424ded-lg p-3",children:[n.jsx(sf,{className:"w-4 h-4 text-accent-fg shrink-0 mt-0.5"}),n.jsxs("span",{children:["カレンダーで休業日にすると、",n.jsx("strong",{className:"font-medium",children:"電話側にも自動で反映されます"}),"(電話側への登録は不要です)。平日は在宅診療部へ転送するはずの時間帯だけが自動応答に切り替わり、 半日休業ならその時間帯のみが対象です。土日祝はもともと終日 業者へ転送されます。",n.jsx("br",{}),"24時間すべて業者へ回したい場合だけ、上の「休業日」カードに",n.jsx("strong",{className:"font-medium",children:"「業者へ転送」で"}),"登録してください (「自動応答」で登録すると平日日中が自動応答になり、目的と逆になります)。 実際の判定結果は下の「電話側の扱い」列のとおりです。"]})]}),c&&n.jsxs("div",{className:"text-sm text-red-600",children:["読み込みエラー: ",c]}),o?n.jsx("div",{className:"text-gray-500 text-sm",children:"読み込み中…"}):l.length===0?n.jsx("div",{className:"text-sm text-gray-500 border rounded-lg p-3 text-center",children:"カレンダー側で設定された休業日(全職員休業)はありません。"}):n.jsxs(n.Fragment,{children:[n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsxs("tr",{children:[n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"日付"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"時間帯"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"電話側の扱い"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"電話側の休業日登録"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"メモ"})]})}),n.jsx("tbody",{className:"divide-y",children:h.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:5,className:"p-3 text-center text-gray-500",children:"今後の全館休業はありません"})}):h.map(p=>n.jsx(Od,{c:p,withDetail:!0},p.id))})]})})}),m>0&&n.jsxs("p",{className:"text-xs text-gray-500",children:["※ 先の予定 ",m," 件は「電話側の扱い」を省略しています(日付を指定して上の「ルーティング確認」でご確認ください)。"]}),x.length>0&&n.jsxs("details",{className:"text-sm",children:[n.jsxs("summary",{className:"cursor-pointer text-gray-500 hover:text-gray-700 select-none",children:["過去の休業日(",x.length,"件)を表示"]}),n.jsx(Qt,{className:"mt-2",children:n.jsx("div",{className:"overflow-x-auto border rounded-lg opacity-70",children:n.jsx("table",{className:"w-full text-sm",children:n.jsx("tbody",{className:"divide-y",children:x.map(p=>n.jsx(Od,{c:p,withDetail:!1},p.id))})})})})]})]}),n.jsxs("a",{href:"/?tab=temp",className:"inline-flex items-center gap-1.5 text-sm text-accent-fg hover:text-accent-hover",children:[n.jsx(yp,{className:"w-4 h-4","aria-hidden":!0})," カレンダー(臨時予定)で編集する"]})]})}function Ix(l){const[o,c]=f.useState(null),[d,h]=f.useState(!1),[x,m]=f.useState(""),p=f.useCallback(async()=>{if(l){h(!0),m("");try{const w=await fetch(`/api/phone/route-preview?date=${encodeURIComponent(l)}`,{credentials:"same-origin"});if(!w.ok){const k=await w.json().catch(()=>({}));throw new Error(k.error??`HTTP ${w.status}`)}const g=await w.json();c(g)}catch(w){m(w instanceof Error?w.message:String(w)),c(null)}finally{h(!1)}}},[l]);return f.useEffect(()=>{p()},[p]),{preview:o,loading:d,error:x}}const Ox={forward_clinic:"在宅診療部へ転送",forward_outpatient:"外来へ転送",auto_response:"自動応答",forward_outsource:"業者へ転送"},Ud={ALL:"終日",AM:"午前",PM:"午後"};function Ux(){const l=Date.now()+324e5,o=new Date(l);return`${o.getUTCFullYear()}-${String(o.getUTCMonth()+1).padStart(2,"0")}-${String(o.getUTCDate()).padStart(2,"0")}`}function Fx(){const[l,o]=f.useState(Ux()),{preview:c,loading:d,error:h}=Ix(l),x=[];c!=null&&c.isHoliday&&x.push("祝日"),c!=null&&c.businessClosure&&x.push(c.businessClosure.action==="forward_outsource"?"休業日(業者へ転送)":"休業日(自動応答)");for(const m of(c==null?void 0:c.calendarExceptions)??[])m.type==="closed"&&m.staff_closed===1&&x.push(`全館休業(${Ud[m.time_range]})`),m.type==="open"&&x.push(`臨時診療(${Ud[m.time_range]})`);return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-sm text-gray-500",children:"指定した日に着信があった場合、時間帯ごとにどこへ振り分けられるかを確認できます。"}),n.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[n.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-700",children:[n.jsx(ef,{className:"w-4 h-4 text-accent-fg"}
424),"確認する日",n.jsx("input",{type:"date",value:l,onChange:m=>o(m.target.value),className:"border rounded px-2 py-1.5 text-sm"})]}),x.map(m=>n.jsx("span",{className:"px-2 py-0.5 rounded text-xs bg-accent-subtle text-accent-hover",children:m},m))]}),h&&n.jsxs("div",{className:"text-sm text-red-600",children:["読み込みエラー: ",h]}),d&&n.jsx("div",{className:"text-sm text-gray-500",children:"読み込み中…"}),c&&!d&&n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsxs("tr",{children:[n.jsx("th",{className:"p-2 text-left font-medium text-gray-600 whitespace-nowrap",children:"時間帯"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"動作"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"転送先 / メッセージ"})]})}),n.jsx("tbody",{className:"divide-y",children:c.segments.map((m,p)=>n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsxs("td",{className:"p-2 whitespace-nowrap text-gray-800 font-mono text-xs",children:[m.start,"–",m.end]}),n.jsx("td",{className:"p-2 text-gray-700",children:n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx(Oo,{className:"w-3.5 h-3.5 text-gray-500"}),Ox[m.action]??m.action]})}),n.jsxs("td",{className:"p-2",children:[m.forwardTo?n.jsx("span",{className:"font-mono text-xs text-gray-700",children:vl(m.forwardTo)}):m.messageKey?n.jsxs("span",{className:"text-xs text-gray-500",children:["key: ",m.messageKey]}):n.jsx("span",{className:"text-xs text-gray-500",children:"—"}),m.fellBackToAutoResponse&&n.jsxs("span",{className:"ml-2 inline-flex items-center gap-1 text-xs text-amber-700",children:[n.jsx(xr,{className:"w-3.5 h-3.5"}),"業者番号未登録のため自動音声"]})]})]},p))})]})})})]})}function Hx(){const{rules:l,destinations:o,messages:c,loading:d,error:h,saveRules:x,saveDestinations:m,saveMessages:p,previewMessage:w}=dx();return n.jsxs("div",{className:"space-y-6 animate-in fade-in duration-300",children:[n.jsxs(Ue,{title:"番号設定",icon:of,description:"Twilio 着信番号・在宅診療部固定電話・往診代行業者番号を設定します。",children:[h&&n.jsxs("div",{className:"text-sm text-red-600 mb-2",children:["読み込みエラー: ",h]}),d?n.jsx("div",{className:"text-gray-500 text-sm",children:"読み込み中…"}):n.jsx(vx,{destinations:o,onSave:m})]}),n.jsx(Ue,{title:"業者番号の予約切替",icon:Cl,description:"往診代行業者が切り替わる際に、指定日時から転送先番号を自動で切り替えます。",children:n.jsx(jx,{nowMs:Date.now()})}),n.jsx(Ue,{title:"曜日・時間帯ルール",icon:Oo,description:"曜日と時間帯ごとに「在宅診療部へ転送」「自動応答」「業者へ転送」を割り当てます。マッチしない時間帯と祝日はデフォルトで業者転送になります。",children:d?n.jsx("div",{className:"text-gray-500 text-sm",children:"読み込み中…"}):n.jsx(xx,{rules:l,onSave:x,nowMs:Date.now()})}),n.jsx(Ue,{title:"ルーティング確認",icon:ef,children:n.jsx(Fx,{})}),n.jsx(Ue,{title:"自動応答メッセージ",icon:_o,description:"自動応答時に Twilio から読み上げるテキスト(Polly.Takumi-Neural / ja-JP)を編集します。",children:d?n.jsx("div",{className:"text-gray-500 text-sm",children:"読み込み中…"}):n.jsx(kx,{messages:c,onSave:p,onPreview:w})}),n.jsx(Ue,{title:"毎年の休業日(電話設定)",icon:Sp,description:"年末年始のように毎年同じ月日を繰り返す全職員休業を登録します。夏季休業など今年だけの全館休業は、カレンダーの臨時休診で「休業日(全職員休業)」にチェックする方法でも設定できます。",children:n.jsx(_x,{})}),n.jsx(Ue,{title:"カレンダー由来の全館休業",icon:kp,description:"臨時予定タブで「休業日(全職員休業)」にチェックした日を、電話ルーティングにも自動反映した確認用の一覧です。ここでの追加・編集はできません。",headerExtra:n.jsx("span",{className:"text-xs font-medium text-gray-600 bg-gray-100 border border-gray-200 rounded-full px-2.5 py-1 whitespace-nowrap",children:"確認専用"}),children:n.jsx(Ax,{})})]})}const Wx=(l,o,c)=>{const d=new URLSearchParams;return l.from&&d.set("from",l.from),l.to&&d.set("to",l.to),l.action&&d.set("action",l.action),l.result&&d.set("result",l.result),l.q&&d.set("q",l.q),d.set("limit",String(o)),d.set("offset",String(c)),d.toString()};function Bx(){const[l,o]=f.useState([]),[c,d]=f.useState(0),[h,x]=f.useState({}),[m,p]=f.useState(1),[w,g]=f.useState(10),[k,j]=f.useState(!1),[N,R]=f.useState(""),T=f.useCallback(async()=>{j(!0),R("");try{const v=Wx(h,w,(m-1)*w),D=await fetch(`/api/phone/call-log?${v}`,{credentials:"same-origin"});if(!D.ok)throw new Error(`HTTP ${D.status}`);const _=await D.json();o(_.items??[]),d(_.total??0)}catch(v){R(v instanceof Error?v.message:String(v))}finally{j(!1)}},[h,m,w]);f.useEffect(()=>{T()},[T]);const b=f.useCallback(async(v,D)=>{const _=await fetch(`/api/phone/call-log/${v}`,{method:"PATCH",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({note:D})});if(!_.ok){const z=await _.json().catch(()=>({}));throw new Error(z.error??`HTTP ${_.status}`)}o(z=>z.map(F=>F.id===v?{...F,note:D}:F))},[]);return{items:l,total:c,filters:h,setFilters:v=>{x(v),p(1)},page:m,setPage:p,pageSize:w,setPageSize:v=>{g(v),p(1)},loading:k,error:N,reload:T,updateNote:b}}function Vx(){const[l,o]=f.useState([]),[c,d]=f.useState(!1),[h,x]=f.useState(""),[m,p]=f.useState(""),w=f.useCallback(async()=>{d(!0),x("");try{const T=m.trim()?`?q=${encodeURIComponent(m.trim())}`:"",b=await fetch(`/api/phone/contacts${T}`,{credentials:"same-origin"});if(!b.ok)throw new Error(`HTTP ${b.status}`);const v=await b.json();o(v.contacts??[])}catch(T){x(T instanceof Error?T.message:String(T))}finally{d(!1)}},[m]);f.useEffect(()=>{w()},[w]);const g=f.useCallback(async(T,b)=>{const v=await fetch("/api/phone/contacts",{method:T,credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!v.ok){const _=await v.json().catch(()=>({}));throw new Error(_.error??`HTTP ${v.status}`)}const D=await v.json();o(D.contacts??[])},[]),k=f.useCallback((T,b)=>g("POST",{name:T,phone:b}),[g]),j=f.useCallback((T,b,v)=>g("PUT",{id:T,name:b,phone:v}),[g]),N=f.useCallback(async T=>{const b=await fetch(`/api/phone/contacts?id=${T}`,{method:"DELETE",credentials:"same-origin"});if(!b.ok){const v=await b.json().catch(()=>({}));throw new Error(v.error??`HTTP ${b.status}`)}await w()},[w]),R=f.useCallback(async T=>{const b=await fetch("/api/phone/contacts/import",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({contacts:T})});if(!b.ok){const D=await b.json().catch(()=>({}));throw new Error(D.error??`HTTP ${b.status}`)}const v=await b.json();return o(v.contacts??[]),{added:v.added??0,updated:v.updated??0,unchanged:v.unchanged??0,skipped:v.skipped??0,imported:v.imported??0,total:v.total??0}},[]);return{contacts:l,loading:c,error:h,query:m,setQuery:p,reload:w,add:k,update:j,remove:N,importMany:R}}const Yx=[{value:"",label:"すべて"},{value:"forward_clinic",label:"在宅診療部へ転送"},{value:"forward_outpatient",label:"外来へ転送"},{value:"auto_response",label:"自動応答"},{value:"forward_outsource",label:"業者へ転送"},{value:"auto_response_fallback",label:"自動応答(業者未登録フォールバック)"}],Qx=[{value:"",label:"すべて"},{value:"completed",label:"完了"},{value:"no-answer",label:"応答なし"},{value:"busy",label:"話中"},{value:"failed",label:"失敗"},{value:"canceled",label:"キャンセル"}];function Kx({filters:l,onChange:o,total:c}){const[d,h]=f.useState(l),x=()=>o(d),m=()=>{h({}),o({})};return n.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-xl p-4 space-y-3",children:[n.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-5 ga
424p-2",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"開始日"}),n.jsx("input",{type:"date",value:d.from??"",onChange:p=>h(w=>({...w,from:p.target.value||void 0})),className:"w-full border rounded px-2 py-1.5 text-sm"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"終了日"}),n.jsx("input",{type:"date",value:d.to??"",onChange:p=>h(w=>({...w,to:p.target.value||void 0})),className:"w-full border rounded px-2 py-1.5 text-sm"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"アクション"}),n.jsx("select",{value:d.action??"",onChange:p=>h(w=>({...w,action:p.target.value||void 0})),className:"w-full border rounded px-2 py-1.5 text-sm",children:Yx.map(p=>n.jsx("option",{value:p.value,children:p.label},p.value))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"結果"}),n.jsx("select",{value:d.result??"",onChange:p=>h(w=>({...w,result:p.target.value||void 0})),className:"w-full border rounded px-2 py-1.5 text-sm",children:Qx.map(p=>n.jsx("option",{value:p.value,children:p.label},p.value))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"検索(番号・メモ)"}),n.jsx("input",{type:"text",value:d.q??"",onChange:p=>h(w=>({...w,q:p.target.value||void 0})),onKeyDown:p=>{p.key==="Enter"&&!p.nativeEvent.isComposing&&x()},className:"w-full border rounded px-2 py-1.5 text-sm"})]})]}),n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("span",{className:"text-gray-500",children:["全 ",n.jsx("strong",{className:"text-gray-800",children:c})," 件"]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(le,{variant:"ghost",size:"sm",onClick:m,children:[n.jsx(mr,{className:"w-3.5 h-3.5","aria-hidden":!0})," クリア"]}),n.jsxs(le,{variant:"primary",size:"sm",onClick:x,children:[n.jsx(Ll,{className:"w-3.5 h-3.5","aria-hidden":!0})," 適用"]})]})]})]})}const Jx={forward_clinic:"在宅診療部へ転送",forward_outpatient:"外来へ転送",auto_response:"自動応答",forward_outsource:"業者へ転送",auto_response_fallback:"自動応答(業者未登録)"};function qx(l){if(!l)return"";const o=new Date(l+9*3600*1e3),c=d=>String(d).padStart(2,"0");return`${o.getUTCFullYear()}-${c(o.getUTCMonth()+1)}-${c(o.getUTCDate())} ${c(o.getUTCHours())}:${c(o.getUTCMinutes())}`}function Gx({items:l,total:o,page:c,pageSize:d,onPage:h,onPageSize:x,onUpdateNote:m,onRegister:p}){const[w,g]=f.useState(null),[k,j]=f.useState(!1),[N,R]=f.useState(""),T=Math.max(1,Math.ceil(o/d)),b=async()=>{if(w){j(!0),R("");try{await m(w.id,w.note),g(null)}catch(v){R(v instanceof Error?v.message:String(v))}finally{j(!1)}}};return n.jsxs("div",{className:"space-y-3",children:[n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsxs("tr",{children:[n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"日時(JST)"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"発信元"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"名前"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"動作"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"転送先"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"通話秒"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"結果"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"メモ"}),n.jsx("th",{className:"p-2"})]})}),n.jsx("tbody",{className:"divide-y",children:l.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:9,className:"p-3 text-center text-gray-500",children:"該当する着信はありません"})}):l.map(v=>n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsx("td",{className:"p-2 whitespace-nowrap font-mono text-xs text-gray-700",children:qx(v.received_at)}),n.jsx("td",{className:"p-2 font-mono text-xs text-gray-700",children:v.caller_e164??""}),n.jsx("td",{className:"p-2 text-gray-800 whitespace-nowrap",children:v.contact_name?n.jsx("span",{className:"font-medium",children:v.contact_name}):v.caller_e164&&p?n.jsxs("button",{onClick:()=>p(v.caller_e164),className:"inline-flex items-center gap-1 text-xs text-accent-fg hover:text-accent-hover border border-accent-border hover:bg-accent-subtle px-2 py-0.5 rounded",children:[n.jsx(Rp,{className:"w-3.5 h-3.5"})," 登録"]}):n.jsx("span",{className:"text-gray-500",children:"—"})}),n.jsx("td",{className:"p-2 text-gray-700",children:Jx[v.action]??v.action}),n.jsx("td",{className:"p-2 font-mono text-xs text-gray-600",children:v.forwarded_to_e164??""}),n.jsx("td",{className:"p-2 text-gray-600",children:v.duration_sec??""}),n.jsx("td",{className:"p-2 text-gray-600",children:v.result??""}),n.jsx("td",{className:"p-2 text-gray-500 max-w-[14rem] truncate",title:v.note,children:v.note}),n.jsx("td",{className:"p-2 text-right",children:n.jsx("button",{onClick:()=>
424g({id:v.id,note:v.note}),className:"text-accent-fg hover:bg-accent-subtle p-3.5 -m-0.5 rounded","aria-label":"メモ編集",children:n.jsx(os,{className:"w-4 h-4","aria-hidden":!0})})})]},v.id))})]})})}),n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("label",{className:"flex items-center gap-2 text-gray-500",children:[n.jsx("span",{children:"表示件数"}),n.jsx("select",{value:d,onChange:v=>x(Number(v.target.value)),className:"border border-gray-200 rounded px-2 py-1 text-sm text-gray-700 focus:outline-none focus:ring-1 focus:ring-accent",children:[10,25,50,100].map(v=>n.jsxs("option",{value:v,children:[v,"件"]},v))})]}),T>1&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>h(Math.max(1,c-1)),disabled:c===1,"aria-label":"前へ",className:"p-3.5 -m-0.5 rounded hover:bg-gray-100 disabled:opacity-30",children:n.jsx(is,{className:"w-4 h-4","aria-hidden":!0})}),n.jsxs("span",{className:"text-gray-700",children:[c," / ",T]}),n.jsx("button",{onClick:()=>h(Math.min(T,c+1)),disabled:c===T,"aria-label":"次へ",className:"p-3.5 -m-0.5 rounded hover:bg-gray-100 disabled:opacity-30",children:n.jsx(pr,{className:"w-4 h-4","aria-hidden":!0})})]})]}),w&&n.jsx(Qn,{title:"メモを編集",onClose:()=>g(null),footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>g(null),children:"キャンセル"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:()=>void b(),disabled:k,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",k?"保存中…":"保存"]})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx("textarea",{value:w.note,onChange:v=>g({id:w.id,note:v.target.value}),rows:5,className:"w-full border rounded px-2 py-1.5 text-sm",placeholder:"(発信者の用件・対応内容など)"}),N&&n.jsx("div",{className:"text-sm text-red-600",children:N})]})})]})}const Xx="modulepreload",Zx=function(l){return"/"+l},Fd={},e0=function(o,c,d){let h=Promise.resolve();if(c&&c.length>0){let m=function(g){return Promise.all(g.map(k=>Promise.resolve(k).then(j=>({status:"fulfilled",value:j}),j=>({status:"rejected",reason:j}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),w=(p==null?void 0:p.nonce)||(p==null?void 0:p.getAttribute("nonce"));h=m(c.map(g=>{if(g=Zx(g),g in Fd)return;Fd[g]=!0;const k=g.endsWith(".css"),j=k?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${j}`))return;const N=document.createElement("link");if(N.rel=k?"stylesheet":Xx,k||(N.as="script"),N.crossOrigin="",N.href=g,w&&N.setAttribute("nonce",w),document.head.appendChild(N),k)return new Promise((R,T)=>{N.addEventListener("load",R),N.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${g}`)))})}))}function x(m){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=m,window.dispatchEvent(p),!p.defaultPrevented)throw m}return h.then(m=>{for(const p of m||[])p.status==="rejected"&&x(p.reason);return o().catch(x)})};function t0(l){if(!l)return"";const o=String(l).trim();if(!o)return"";const c=o.startsWith("+"),d=o.replace(/\D/g,"");return d.length<8?"":c?"+"+d:d.startsWith("0")?"+81"+d.slice(1):d.startsWith("81")?"+"+d:"+81"+d}function Hd(l){return t0(l)!==""}function Wd(l){if(l.raw_input&&l.raw_input.trim())return l.raw_input;const o=l.phone_norm;return o.startsWith("+81")?"0"+o.slice(3):o}const n0=["氏名","名前","患者","薬局","会社","宛名","施設","事業所","name","担当"];async function r0(l){const o=await e0(()=>import("./xlsx-BGhuli8m.js"),[]),c=await l.arrayBuffer(),d=o.read(c,{type:"array"}),h=[];for(const x of d.SheetNames){const m=d.Sheets[x];if(!m)continue;const p=o.utils.sheet_to_json(m,{header:1,blankrows:!1,defval:""});if(!p.length)continue;let g=p[0].map(k=>String(k).toLowerCase()).findIndex(k=>n0.some(j=>k.includes(j.toLowerCase())));g<0&&(g=0);for(const k of p){const j=String(k[g]??"").trim();if(!j)continue;const N=new Set([g]);for(let R=0;R<k.length;R++){if(N.has(R))continue;const T=String(k[R]??"").trim();if(!Hd(T))continue;let b="";const v=R+1;if(v<k.length&&!N.has(v)){const D=String(k[v]??"").trim();D&&!Hd(D)&&D.length<=20&&(b=D,N.add(v))}N.add(R),h.push({name:b?`${j}(${b})`:j,phone:T})}}}return h}function s0({hook:l}){const{contacts:o,loading:c,error:d,query:h,setQuery:x,add:m,update:p,remove:w,importMany:g}=l,[k,j]=f.useState(null),[N,R]=f.useState(!1),[T,b]=f.useState(""),[v,D]=f.useState(!1),[_,z]=f.useState(""),[F,V]=f.useState(1),[M,J]=f.useState(10),H=Math.max(1,Math.ceil(o.length/M)),W=Math.min(F,H),Ne=o.slice((W-1)*M,W*M);f.useEffect(()=>{V(1)},[h,M]);const re=()=>{j({name:"",phone:""}),b("")},ee=ne=>{j({id:ne.id,name:ne.name,phone:Wd(ne)}),b("")},Z=()=>{j(null),b("")},xe=async()=>
424{if(k){b(""),R(!0);try{k.id?await p(k.id,k.name,k.phone):await m(k.name,k.phone),j(null)}catch(ne){b(ne instanceof Error?ne.message:String(ne))}finally{R(!1)}}},be=async ne=>{if(window.confirm("この連絡先を削除しますか?")){b("");try{await w(ne)}catch(I){b(I instanceof Error?I.message:String(I))}}},je=async ne=>{var ie;const I=(ie=ne.target.files)==null?void 0:ie[0];if(ne.target.value="",!!I){D(!0),z(""),b("");try{const B=await r0(I);if(!B.length){b("ファイルから名前と番号を読み取れませんでした(1列目=名前、その右に電話番号/続柄の列)");return}const C=await g(B);z(`取込完了:新規 ${C.added}ä»¶ / 更新 ${C.updated}ä»¶ / 変更なし ${C.unchanged}ä»¶`+(C.skipped?` / スキップ ${C.skipped}ä»¶`:"")+`(ファイル ${C.total}件)`)}catch(B){b(B instanceof Error?B.message:String(B))}finally{D(!1)}}};return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 justify-between",children:[n.jsxs("div",{className:"relative",children:[n.jsx(Ll,{className:"w-4 h-4 text-gray-500 absolute left-2 top-1/2 -translate-y-1/2"}),n.jsx("input",{value:h,onChange:ne=>x(ne.target.value),placeholder:"名前・番号で検索",className:"border rounded-lg pl-8 pr-2 py-1.5 text-sm w-56"})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("a",{href:"/api/phone/contacts/export.csv",className:"flex items-center gap-1.5 text-sm border border-gray-200 hover:bg-gray-50 px-3 py-1.5 rounded-lg",children:[n.jsx(nf,{className:"w-4 h-4"})," CSV出力"]}),n.jsxs("label",{className:`flex items-center gap-1.5 text-sm border border-gray-200 hover:bg-gray-50 px-3 py-1.5 rounded-lg cursor-pointer ${v?"opacity-50 pointer-events-none":""}`,children:[n.jsx(zp,{className:"w-4 h-4"})," ",v?"取込中…":"ファイルから一括登録",n.jsx("input",{type:"file",accept:".xlsx,.xls,.csv",className:"hidden",onChange:je})]}),n.jsxs(le,{variant:"primary",size:"sm",onClick:re,children:[n.jsx(cs,{className:"w-4 h-4","aria-hidden":!0})," 追加"]})]})]}),n.jsxs("div",{className:"flex items-start gap-2 text-xs text-gray-500",children:[n.jsx(Cp,{className:"w-3.5 h-3.5 mt-0.5 flex-shrink-0"}),n.jsxs("span",{children:[".xlsx / .csv・複数シート対応。1列目に名前、その右に電話番号の列を並べます。",n.jsx("b",{children:"番号の右隣に続柄・区分(母/自宅/父など)"}),"を入れると「山田太郎(母)」のように登録されます。 再取込すると",n.jsx("b",{children:"重複チェックして新規・変更分だけ"}),"反映します(+81 の有無・ハイフン・Excelで先頭0が消えた番号も自動で吸収)。"]})]}),(d||T)&&n.jsx("div",{className:"text-sm text-red-600",children:d||T}),_&&n.jsx("div",{className:"text-sm text-semantic-success",children:_}),n.jsx(Qt,{children:n.jsx("div",{className:"overflow-x-auto border rounded-lg",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{className:"bg-gray-50 border-b",children:n.jsxs("tr",{children:[n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"名前"}),n.jsx("th",{className:"p-2 text-left font-medium text-gray-600",children:"電話番号"}),n.jsx("th",{className:"p-2 text-right"})]})}),n.jsx("tbody",{className:"divide-y",children:c?n.jsx("tr",{children:n.jsx("td",{colSpan:3,className:"p-3 text-center text-gray-500",children:"読み込み中…"})}):o.length===0?n.jsx("tr",{children:n.jsx("td",{colSpan:3,className:"p-3 text-center text-gray-500",children:"連絡先は未登録です"})}):Ne.map(ne=>n.jsxs("tr",{className:"hover:bg-gray-50",children:[n.jsx("td",{className:"p-2 text-gray-800",children:ne.name}),n.jsx("td",{className:"p-2 font-mono text-xs text-gray-600",children:Wd(ne)}),n.jsxs("td",{className:"p-2 text-right whitespace-nowrap",children:[n.jsx("button",{onClick:()=>ee(ne),"aria-label":`${ne.name}を編集`,className:"text-accent-fg hover:bg-accent-subtle p-3.5 -m-0.5 rounded mr-1",children:n.jsx(os,{className:"w-4 h-4","aria-hidden":!0})}),n.jsx("button",{onClick:()=>void be(ne.id),"aria-label":`${ne.name}を削除`,className:"text-semantic-error hover:bg-red-50 p-3.5 -m-0.5 rounded",children:n.jsx(hr,{className:"w-4 h-4","aria-hidden":!0})})]})]},ne.id))})]})})}),o.length>0&&n.jsxs("div",{className:"flex items-center justify-between text-sm",children:[n.jsxs("div",{className:"flex items-center gap-2 text-gray-500",children:[n.jsx("label",{children:"表示件数"}),n.jsx("select",{value:M,onChange:ne=>J(Number(ne.target.value)),className:"border rounded px-1.5 py-1 text-xs",children:[10,25,50,100].map(ne=>n.jsxs("option",{value:ne,children:[ne,"ä»¶"]},ne))}),n.jsxs("span",{className:"text-gray-500",children:["全 ",o.length," ä»¶"]})]}),H>1&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{onClick:()=>V(Math.max(1,W-1)),disabled:W===1,className:"p-3.5 -m-0.5 rounded hover:bg-gray-100 disabled:opacity-30","aria-label":"前へ",children:n.jsx(is,{className:"w-4 h-4","aria-hidden":!0})}),n.jsxs("span",{className:"text-gray-700",children:[W," / ",H]}),n.jsx("button",{onClick:()=>V(Math.min(H,W+1)),disabled:W===H,className:"p-3.5 -m-0.5 rounded hover:bg-gray-100 disabled:opacity-30","aria-label":"次へ",children:n.jsx(pr,{className:"w-4 h-4","aria-hidden":!0})})]})]}),k&&n.jsx(Qn,{title:k.id?"連絡先を編集":"連絡先を追加",onClose:Z,footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:Z,children:"キャンセル"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:()=>void xe(),disabled:N||!k.name||!k.phone,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",N?"保存中…":"保存"]})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"名前"}),n.jsx("input",{value:k.name,onChange:ne=>j(I=>I&&{...I,name:ne.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm",placeholder:"ä¾
424‹ï¼šå±±ç”° 太郎"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"電話番号"}),n.jsx("input",{value:k.phone,onChange:ne=>j(I=>I&&{...I,phone:ne.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm font-mono",placeholder:"例:090-1234-5678"})]}),T&&n.jsx("div",{className:"text-sm text-red-600",children:T})]})})]})}function a0(l){const o=new URLSearchParams;return l.from&&o.set("from",l.from),l.to&&o.set("to",l.to),l.action&&o.set("action",l.action),l.result&&o.set("result",l.result),l.q&&o.set("q",l.q),"/api/phone/call-log/export.csv"+(o.toString()?"?"+o.toString():"")}function l0(){const{items:l,total:o,filters:c,setFilters:d,page:h,setPage:x,pageSize:m,setPageSize:p,loading:w,error:g,updateNote:k,reload:j}=Bx(),N=Vx(),[R,T]=f.useState(null),[b,v]=f.useState(!1),[D,_]=f.useState(""),z=async()=>{if(R){v(!0),_("");try{await N.add(R.name,R.phone),T(null),await j()}catch(F){_(F instanceof Error?F.message:String(F))}finally{v(!1)}}};return n.jsxs("div",{className:"space-y-6 animate-in fade-in duration-300",children:[n.jsxs(Ue,{title:"着信ログ",icon:lf,description:"Twilio 経由の着信履歴です。アドレス帳に登録された番号は「名前」列に表示されます。未登録の番号は「登録」から追加できます。",headerExtra:n.jsxs("a",{href:a0(c),className:"flex items-center gap-1.5 text-sm text-gray-700 border border-gray-200 hover:bg-gray-50 px-3 py-1.5 rounded-full",children:[n.jsx(nf,{className:"w-4 h-4","aria-hidden":!0})," CSVエクスポート"]}),children:[g&&n.jsx("div",{className:"text-sm text-red-600 mb-2",children:g}),n.jsx(Kx,{filters:c,onChange:d,total:o}),n.jsx("div",{className:"mt-4",children:w?n.jsx("div",{className:"text-gray-500 text-sm",children:"読み込み中…"}):n.jsx(Gx,{items:l,total:o,page:h,pageSize:m,onPage:x,onPageSize:p,onUpdateNote:k,onRegister:F=>{_(""),T({phone:F,name:""})}})})]}),n.jsx(Ue,{title:"アドレス帳",icon:wp,description:"電話番号と名前を登録しておくと、着信ログに名前が表示されます。ファイル(.xlsx / .csv)からの一括登録にも対応しています。",children:n.jsx(s0,{hook:N})}),R&&n.jsx(Qn,{title:"アドレス帳に登録",onClose:()=>T(null),footer:n.jsxs(n.Fragment,{children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>T(null),children:"キャンセル"}),n.jsxs(le,{variant:"primary",size:"sm",onClick:()=>void z(),disabled:b||!R.name||!R.phone,children:[n.jsx(Yn,{className:"w-4 h-4","aria-hidden":!0})," ",b?"保存中…":"保存"]})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"電話番号"}),n.jsx("input",{value:R.phone,onChange:F=>T(V=>V&&{...V,phone:F.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm font-mono"})]}),n.jsxs("div",{children:[n.jsx("label",{className:"text-xs text-gray-500",children:"名前"}),n.jsx("input",{value:R.name,autoFocus:!0,onChange:F=>T(V=>V&&{...V,name:F.target.value}),className:"w-full border rounded px-2 py-1.5 text-sm",placeholder:"例:山田 太郎"})]}),D&&n.jsx("div",{className:"text-sm text-red-600",children:D})]})})]})}const i0={answered:"回答",unknown:"分かりません",blocked:"受診誘導"},o0={answered:"bg-green-50 text-green-700 border-green-200",unknown:"bg-amber-50 text-amber-700 border-amber-200",blocked:"bg-gray-100 text-gray-600 border-gray-200"};function c0(l){const o=new Date(l);return isNaN(o.getTime())?l:o.toLocaleString("ja-JP",{timeZone:"Asia/Tokyo",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function u0(){const[l,o]=f.useState([]),[c,d]=f.useState(0),[h,x]=f.useState({}),[m,p]=f.useState(1),[w,g]=f.useState(10),[k,j]=f.useState(""),[N,R]=f.useState(""),[T,b]=f.useState(""),[v,D]=f.useState(""),[_,z]=f.useState(!1),[F,V]=f.useState(null),M=f.useCallback(async()=>{z(!0),V(null);try{const W=new URLSearchParams;k&&W.set("from",k),N&&W.set("to",N),T&&W.set("outcome",T),v.trim()&&W.set("q",v.trim()),W.set("page",String(m)),W.set("pageSize",String(w));const Ne=await fetch(`/api/chatbot-inquiries?${W.toString()}`,{credentials:"same-origin"});if(!Ne.ok)throw new Error(`取得に失敗しました (${Ne.status})`);const re=await Ne.json();o(re.items),d(re.total),x(re.stats??{})}catch(W){V(W instanceof Error?W.message:"取得に失敗しました")}finally{z(!1)}},[k,N,T,v,m,w]);f.useEffect(()=>{M()},[M]);const J=Math.max(1,Math.ceil(c/w)),H=W=>{W.preventDefault(),p(1),M()};return n.jsx("div",{className:"space-y-6 animate-in fade-in duration-300",children:n.jsxs(Ue,{title:"チャット問い合わせ履歴",icon:Io,description:"ホームページのチャットボットに寄せられた質問と回答でã
424™ã€‚HP記載に基づく回答のみを返し、記載が無い質問は「分かりません」として受付へ案内しています。",headerExtra:n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsxs("span",{className:"px-2 py-1 rounded-full border bg-green-50 text-green-700 border-green-200",children:["回答 ",h.answered??0]}),n.jsxs("span",{className:"px-2 py-1 rounded-full border bg-amber-50 text-amber-700 border-amber-200",children:["分かりません ",h.unknown??0]}),h.blocked?n.jsxs("span",{className:"px-2 py-1 rounded-full border bg-gray-100 text-gray-600 border-gray-200",children:["受診誘導 ",h.blocked]}):null]}),children:[n.jsxs("form",{onSubmit:H,className:"flex flex-wrap items-end gap-3 mb-4",children:[n.jsxs("label",{className:"text-sm text-gray-600",children:[n.jsx("span",{className:"block mb-1",children:"開始日"}),n.jsx("input",{type:"date",value:k,onChange:W=>j(W.target.value),className:"border border-gray-200 rounded-lg px-2 py-1.5 text-sm"})]}),n.jsxs("label",{className:"text-sm text-gray-600",children:[n.jsx("span",{className:"block mb-1",children:"終了日"}),n.jsx("input",{type:"date",value:N,onChange:W=>R(W.target.value),className:"border border-gray-200 rounded-lg px-2 py-1.5 text-sm"})]}),n.jsxs("label",{className:"text-sm text-gray-600",children:[n.jsx("span",{className:"block mb-1",children:"種別"}),n.jsxs("select",{value:T,onChange:W=>b(W.target.value),className:"border border-gray-200 rounded-lg px-2 py-1.5 text-sm bg-white",children:[n.jsx("option",{value:"",children:"すべて"}),n.jsx("option",{value:"answered",children:"回答"}),n.jsx("option",{value:"unknown",children:"分かりません"}),n.jsx("option",{value:"blocked",children:"受診誘導"})]})]}),n.jsxs("label",{className:"text-sm text-gray-600 flex-1 min-w-[180px]",children:[n.jsx("span",{className:"block mb-1",children:"キーワード"}),n.jsx("input",{type:"text",value:v,onChange:W=>D(W.target.value),placeholder:"質問・回答を検索",className:"w-full border border-gray-200 rounded-lg px-2 py-1.5 text-sm"})]}),n.jsxs(le,{type:"submit",variant:"primary",size:"sm",children:[n.jsx(Ll,{className:"w-4 h-4","aria-hidden":!0})," 絞り込み"]})]}),F&&n.jsx("div",{className:"text-sm text-red-600 mb-2",children:F}),_?n.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"読み込み中…"}):l.length===0?n.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"該当する問い合わせはありません。"}):n.jsx("ul",{className:"space-y-3",children:l.map(W=>n.jsxs("li",{className:"border border-gray-100 rounded-lg p-4 hover:bg-gray-50/60",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2 mb-2",children:[n.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full border ${o0[W.outcome]??"bg-gray-100 text-gray-600 border-gray-200"}`,children:i0[W.outcome]??W.outcome}),n.jsxs("span",{className:"text-xs text-gray-500",children:[c0(W.created_at),typeof W.top_score=="number"&&` ・ 一致度 ${W.top_score.toFixed(2)}`]})]}),n.jsxs("p",{className:"font-medium text-gray-800 mb-1",children:["Q. ",W.question]}),n.jsx("p",{className:"text-sm text-gray-600 whitespace-pre-wrap",children:W.answer}),W.sources.length>0&&n.jsx("div",{className:"mt-2 flex flex-wrap gap-x-3 gap-y-1",children:W.sources.map(Ne=>n.jsxs("a",{href:Ne,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-accent-fg hover:underline inline-flex items-center gap-1 break-all",children:[n.jsx(jl,{className:"w-3 h-3 flex-shrink-0"}),Ne.replace(/^https?:\/\/[^/]+/,"")||Ne]},Ne))})]},W.id))}),c>0&&n.jsxs("div",{className:"flex items-center justify-between mt-4 text-sm text-gray-600 flex-wrap gap-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("label",{className:"text-gray-500",children:"表示件数"}),n.jsx("select",{value:w,onChange:W=>{g(Number(W.target.value)),p(1)},className:"border border-gray-200 rounded px-1.5 py-1 text-xs bg-white",children:[10,25,50,100].map(W=>n.jsxs("option",{value:W,children:[W,"ä»¶"]},W))}),n.jsxs("span",{className:"text-gray-500",children:["全 ",c," 件中 ",(m-1)*w+1,"–",Math.min(m*w,c)," ä»¶"]})]}),J>1&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>p(W=>Math.max(1,W-1)),disabled:m<=1,children:"前へ"}),n.jsxs("span",{children:[m," / ",J]}),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>p(W=>Math.min(J,W+1)),disabled:m>=J,children:"次へ"})]})]})]})})}function d0(l){return l.stale?"配信結果が不明です":l.status==="failed"?"配信に失敗しています":l.line.error?`LINE の配信が失敗しています(${l.line.error})`:l.wp.error?`HP への掲載が失敗しています(${l.wp.error})`:"対応が必要です"}function f0(l){const[,o,c]=l.split("-");return`${Number(o)}/${Number(c)} 9:00`}function Nf(l){return`urgent-row-${l}`}function Sf(l){return`urgent-scheduled-${l}`}function m0({items:l,scheduledOverdue:o,scheduledRunStale:c,isAdmin:d}){const h=l.length+o.length+(d&&c?1:0);if(h===0)return null;const x=m=>{var p;(p=document.getElementById(m))==null||p.scrollIntoView({behavior:"smooth",block:"center"})};return n.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-xl p-4",children:[n.jsxs("p",{className:"text-sm font-bold text-red-700 flex items-center gap-1.5 mb-2",children:[n.jsx(xr,{className:"w-4 h-4 flex-shrink-0","aria-hidden":!0}
424),"要対応の臨時お知らせが ",h," 件あります"]}),n.jsxs("ul",{className:"space-y-1",children:[o.map(m=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>x(Sf(m.id)),className:"text-sm text-red-700 hover:underline text-left min-h-11 py-1",children:["予約配信「",m.title,"」(",f0(m.scheduledFor),")が実行されていません"]})},m.id)),l.map(m=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>x(Nf(m.id)),className:"text-sm text-red-700 hover:underline text-left min-h-11 py-1",children:[m.title," — ",d0(m)]})},m.id)),d&&c&&n.jsx("li",{className:"text-sm text-red-700 py-1",children:"予約配信の自動実行が26時間以上確認できていません(cron 停止の可能性・管理者向け)"})]})]})}function p0({label:l,className:o=""}){return n.jsxs("span",{className:`inline-flex items-center gap-2 text-sm text-gray-500 ${o}`,children:[n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0}),l]})}const h0=[{pattern:"日本一",category:"比較優良広告",severity:"high",reason:"客観的事実の証明が困難な絶対的優越表現",replacement:null},{pattern:"世界一",category:"比較優良広告",severity:"high",reason:"客観的事実の証明が困難な絶対的優越表現",replacement:null},{pattern:"No\\.?1|ナンバーワン|ナンバー1",category:"比較優良広告",severity:"high",reason:"客観的事実の証明が困難な絶対的優越表現",replacement:null},{pattern:"最高水準",category:"比較優良広告",severity:"high",reason:"他院との比較優良を示唆",replacement:"高水準"},{pattern:"最高の(?:治療|医療|施設)",category:"比較優良広告",severity:"high",reason:"他院との比較優良を示唆",replacement:null},{pattern:"最先端の?医療",category:"比較優良広告",severity:"medium",reason:"他院との比較優良を示唆",replacement:"高度な医療"},{pattern:"業界(?:トップ|首位|最大手)",category:"比較優良広告",severity:"high",reason:"客観的根拠なき優越表現",replacement:null},{pattern:"他院より(?:優れ|すぐれ|高い|安い|良い|よ[いく])",category:"比較優良広告",severity:"high",reason:"他施設との比較表現",replacement:null},{pattern:"他では受けられない",category:"比較優良広告",severity:"high",reason:"排他的優位性の主張",replacement:null},{pattern:"絶対(?:に)?(?:治る|治ります|治癒|安全|大丈夫)",category:"誇大広告",severity:"high",reason:"治療効果・安全性の絶対的保証",replacement:null},{pattern:"100[%%]\\s*(?:治[るり]|治癒|安全|効[くき]|有効)",category:"誇大広告",severity:"high",reason:"治療効果の絶対的保証",replacement:null},{pattern:"100[%%]の(?:治癒|安全)",category:"誇大広告",severity:"high",reason:"治療効果の絶対的保証",replacement:null},{pattern:"必ず治[るり]|必ず治癒|必ず良くな[るり]",category:"誇大広告",severity:"high",reason:"治療効果の保証表現",replacement:null},{pattern:"完治を?(?:保証|約束)",category:"誇大広告",severity:"high",reason:"治療効果の保証表現",replacement:null},{pattern:"奇跡(?:の|的な)(?:治療|回復|効果)",category:"誇大広告",severity:"high",reason:"誇大な効果表現",replacement:null},{pattern:"劇的に改善する",category:"誇大広告",severity:"medium",reason:"誇大な効果表現",replacement:"改善が期待される"},{pattern:"劇的に改善",category:"誇大広告",severity:"medium",reason:"誇大な効果表現",replacement:"改善が期待される"},{pattern:"夢の(?:治療|薬|医療)",category:"誇大広告",severity:"medium",reason:"誇大表現",replacement:null},{pattern:"副作用(?:が|は)?(?:全く|まったく|一切)?(?:ない|ありません|無い)",category:"リスク否定",severity:"high",reason:"副作用がないと断定する表現はガイドライン違反",replacement:null},{pattern:"リスク(?:が|は)?(?:全く|まったく|一切)?(?:ない|ありません|ゼロ)",category:"リスク否定",severity:"high",reason:"リスクがないと断定する表現",replacement:null},{pattern:"安全性(?:は)?100[%%]",category:"リスク否定",severity:"high",reason:"安全性の絶対的保証",replacement:null},{pattern:"後遺症(?:は|が)(?:残らない|ない|ありません)",category:"リスク否定",severity:"high",reason:"後遺症がないと断定する表現",replacement:null},{pattern:"(?:患者|お子)さん(?:から|の)(?:声|体験談)[^。]{0,50}(?:良かった|治った|改善した)",category:"主観的体験談",severity:"medium",reason:"患者の主観的体験談に基づく治療効果アピール",replacement:null},{pattern:"喜び(?:の|の声|のメッセージ)",category:"主観的体験談",severity:"low",reason:"主観的表現の可能性",replacement:null},{pattern:"神の手",category:"個人賛辞",severity:"high",reason:"医師個人の卓越性を客観性なく示す表現",replacement:null},{pattern:"カリスマ(?:医師|ドクター)",category:"個人賛辞",severity:"medium",reason:"客観性に欠ける個人賛辞",replacement:null},{pattern:"スーパードクター",category:"個人賛辞",severity:"medium",reason:"客観性に欠ける個人賛辞",replacement:null},{pattern:"\\d+\\s*[%%]\\s*(?:の)?(?:治癒率|改善率|成功率|有効率|寛解率)",category:"治療成績の数値表示",severity:"high",reason:"治癒率・成功率の数値表示は医療広告ガイドライン上原則禁止(比較・誤認のおそれ)",replacement:null},{pattern:"(?:治癒率|改善率|成功率|有効率|寛解率)(?:[はがのは::]\\s*)?\\d+\\s*[%%]",category:"治療成績の数値表示",severity:"high",reason:"治癒率・成功率の数値表示は医療広告ガイドライン上原則禁止(比較・誤認のおそれ)",replacement:null},{pattern:"(?:治癒率|成功率|寛解率)(?:が)?(?:高い|良い|優れ)",category:"治療成績の数値表示",severity:"medium",reason:"根拠不明な治療成績の優秀性主張",replacement:null},{pattern:"(?:\\d+)人に(?:\\d+)人(?:が)?(?:改善|治癒|発作消失)",category:"治療成績の数値表示",severity:"high",reason:"分数・割合形式による治療成績の断定的表示",replacement:null},{pattern:"他(?:院|病院|施設|の病院)では(?:診られ|対応でき|治療でき|わから)(?:ない|ません)",category:"他院比較",severity:"high",reason:"他院が対応不可であることを示唆する排他的優位性表現",replacement:null},{pattern:"他(?:院|病院|施設|の病院)では(?:見逃|見落と)(?:される|されやすい|されがち)",category:"他院比較",severity:"medium",reason:"他院の診断能力を貶める示唆",replacement:null},{pattern:"(?:都内|東京|関東|全国|地域|近隣)[^\\s]{0,3}(?:唯一|で唯一|初の|で初の)",category:"他院比較",severity:"high",reason:"地域・全国唯一の主張は客観的根拠が必要",replacement:null}
424,{pattern:"(?:都内|東京|関東|全国)(?:最多|最大|最高|トップクラス)(?:の)?(?:症例|実績|件数|経験)",category:"他院比較",severity:"high",reason:"症例数・実績の地域最多主張は客観的根拠が必要",replacement:null},{pattern:"手遅れ(?:に|になる|になります|にならないよう)",category:"過度な不安喚起",severity:"high",reason:"治療機会の消滅を示唆する脅迫的表現",replacement:null},{pattern:"放置すると(?:取り返しのつかない|重篤(?:な事態)?|危険(?:な状態)?|症状が悪化するばかり)",category:"過度な不安喚起",severity:"medium",reason:"放置のリスクを過度に強調する受診誘導表現",replacement:null},{pattern:"今すぐ(?:受診|診察|相談)(?:しないと|しなければ)",category:"過度な不安喚起",severity:"medium",reason:"緊急性を過度に強調した受診誘導表現",replacement:null},{pattern:"口コミ(?:No\\.?1|ナンバーワン|1位|一位|第1位|最高評価|で人気)",category:"根拠不明な評判",severity:"high",reason:"根拠・出典不明の口コミランキング主張",replacement:null},{pattern:"(?:Google|グーグル)(?:クチコミ|口コミ|マップ)[^\\d]{0,20}(?:No\\.?1|1位|最高|高評価)",category:"根拠不明な評判",severity:"high",reason:"根拠不明なGoogleクチコミランキングの主張",replacement:null},{pattern:"患者(?:満足度|評価)(?:\\d+(?:\\.\\d+)?)[%%点/]",category:"根拠不明な評判",severity:"medium",reason:"患者満足度スコアの提示は調査方法・出典の明記が必要",replacement:null},{pattern:"メディア(?:掲載|取材|出演|で紹介)(?:多数|相次ぐ)",category:"根拠不明な評判",severity:"low",reason:"メディア掲載の多さによる優位性示唆(出典明記が必要)",replacement:null},{pattern:"最安値|他院より(?:お得|安[くい]|リーズナブル)|業界最安",category:"費用比較優良広告",severity:"high",reason:"費用の比較優良広告はガイドライン違反",replacement:null},{pattern:"格安|破格(?:の)?(?:価格|料金|費用)",category:"費用比較優良広告",severity:"medium",reason:"費用の誇大表現",replacement:null},{pattern:"(?:てんかん|小児神経|脳神経)(?:界|学界|診療界)の(?:第一人者|パイオニア|権威|スペシャリスト)",category:"根拠不明な権威性",severity:"high",reason:"医師個人の分野における権威性を客観的根拠なく主張する表現",replacement:null},{pattern:"日本(?:最高峰|屈指|随一)の(?:専門医|専門家|権威|名医)",category:"根拠不明な権威性",severity:"high",reason:"根拠不明な最高峰・屈指の権威性主張",replacement:null},{pattern:"(?:\\d+)年の(?:豊富な)?経験を(?:持つ|誇る)(?:専門医|医師)",category:"根拠不明な権威性",severity:"low",reason:"経験年数のみによる優位性訴求(虚偽でなければ違反ではないが文脈確認推奨)",replacement:null}],x0=["未承認(?:の)?(?:医薬品|薬|治療)","海外(?:でしか|のみ)承認","適応外(?:使用|処方)"],g0=["自由診療","保険適応外","保険(?:が)?(?:利かない|きかない|適用されない)"],Bd=new RegExp("\\p{Cf}","gu");function y0(l){return l.normalize("NFKC").replace(Bd,"").normalize("NFKC").replace(Bd,"")}function v0(l){let o="";const c=[];for(let d=0;d<l.length;d++)/\s/u.test(l[d])||(o+=l[d],c.push(d));return{collapsed:o,map:c}}function kf(l,o,c,d){const h=Math.max(0,o-d),x=Math.min(l.length,c+d);return`…${l.slice(h,x).replace(/\n/g," ")}…`}function Vd(l,o,c){const d=c?c.collapsed:l,h=new RegExp(o.pattern,"gu"),x=[];for(const m of d.matchAll(h)){const p=m.index??0,w=p+m[0].length;if(c&&w===p)continue;const g=c?c.map[p]:p,k=c?c.map[w-1]+1:w;x.push({start:g,end:k,violation:{category:o.category,severity:o.severity,matchedText:l.slice(g,k),context:kf(l,g,k,30),reason:o.reason,suggestion:o.replacement}})}return x}function Yd(l,o,c,d,h,x){const m=[];for(const p of o){const w=new RegExp(p,"gu");for(const g of l.matchAll(w)){const k=g.index??0,j=k+g[0].length,N=kf(l,k,j,c);d.some(T=>N.includes(T))||m.push({start:k,end:j,violation:{category:h,severity:"medium",matchedText:g[0],context:N,reason:x,suggestion:null}})}}return m}const w0=["注意","国内未承認","保険適用外","医師の判断"],j0=["費用","副作用","リスク","全額自己負担"];function N0(l){return`${l.violation.category}\0${l.violation.severity}\0${l.start}\0${l.end}`}function S0(l){const o=y0(l),c=v0(o),d=[],h=new Set,x=p=>{const w=N0(p);h.has(w)||(h.add(w),d.push(p.violation))};for(const p of h0){for(const w of Vd(o,p))x(w);for(const w of Vd(o,p,c))x(w)}
424for(const p of Yd(o,x0,200,w0,"未承認医薬品の注意喚起欠如","未承認医薬品・適応外使用の言及には注意喚起の併記が必要"))x(p);for(const p of Yd(o,g0,300,j0,"自由診療の費用・リスク併記欠如","自由診療への言及時は費用・副作用・リスクの併記が必要"))x(p);const m=k0(o+JSON.stringify(d.map(p=>[p.category,p.matchedText])));return{violations:d,fingerprint:m}}function k0(l){let d=2166136261;for(let h=0;h<l.length;h++)d^=l.charCodeAt(h),d=Math.imul(d,16777619);return(d>>>0).toString(16).padStart(8,"0")}function b0(l){const{quotaType:o,quotaLimit:c,used:d,targetedReaches:h}=l;if(o==="none")return{level:"unlimited",remaining:null,message:"追加メッセージ従量プラン(上限なし)のため、配信数による制限はありません。"};if(h==null)return{level:"unknown",remaining:c==null?null:c-d,message:"友だち数(配信対象者数)を取得できなかったため、配信数が上限に収まるかは判定できません。"};if(c==null)return{level:"unknown",remaining:null,message:"今月のメッセージ上限を取得できなかったため、配信数が上限に収まるかは判定できません。"};const x=c-d;return x<h?{level:"insufficient",remaining:x,message:`今月の残り送信可能数は${x}通です。今回の配信対象(約${h}人)に対して不足しており、配信が失敗する可能性があります。`}:{level:"ok",remaining:x,message:`今月の残り送信可能数は${x}通です(今回の配信で約${h}通を消費する見込みです)。`}}const Eo={title:60,body:1500,bullets:2e3},E0=540*60*1e3;function bl(l){const o=new Date(l+E0),c=o.getUTCFullYear(),d=String(o.getUTCMonth()+1).padStart(2,"0"),h=String(o.getUTCDate()).padStart(2,"0");return`${c}-${d}-${h}`}function bf(l){const o=/^(\d{4})-(\d{2})-(\d{2})$/.exec(l);return o?{y:Number(o[1]),m:Number(o[2]),d:Number(o[3])}:null}function El(l,o){const c=bf(l);if(!c)throw new Error(`invalid date: ${l}`);const d=Date.UTC(c.y,c.m-1,c.d,12,0,0),h=new Date(d+o*24*60*60*1e3),x=h.getUTCFullYear(),m=String(h.getUTCMonth()+1).padStart(2,"0"),p=String(h.getUTCDate()).padStart(2,"0");return`${x}-${m}-${p}`}function C0(l){const o=bf(l);if(!o)return!1;const c=new Date(Date.UTC(o.y,o.m-1,o.d));return c.getUTCFullYear()===o.y&&c.getUTCMonth()===o.m-1&&c.getUTCDate()===o.d}const Ef=60;function _0(l,o){if(typeof l!="string"||!C0(l))return{ok:!1,error:"scheduled_for_invalid"};const c=bl(o),d=El(c,1),h=El(c,Ef);return l<d||l>h?{ok:!1,error:"scheduled_for_out_of_range"}:{ok:!0,value:l}}function T0(l,o){return`【${l}】
425
426${o}`}function L0(l){return l.split(/\n{2,}/).map(o=>o.trim()).filter(Boolean)}function P0({title:l,body:o}){const c=T0(l||"(タイトル未入力)",o||"(本文未入力)");return n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[n.jsxs("div",{children:[n.jsxs("p",{className:"text-xs font-medium text-gray-500 mb-1.5 flex items-center gap-1",children:[n.jsx(Io,{className:"w-3.5 h-3.5","aria-hidden":!0})," LINE配信プレビュー"]}),n.jsx("div",{className:"bg-[#7494c0] rounded-lg p-3",children:n.jsx("div",{className:"bg-white rounded-lg rounded-tl-none p-3 max-w-full whitespace-pre-wrap text-sm text-gray-800 shadow-sm",children:c})})]}),n.jsxs("div",{children:[n.jsxs("p",{className:"text-xs font-medium text-gray-500 mb-1.5 flex items-center gap-1",children:[n.jsx(rf,{className:"w-3.5 h-3.5","aria-hidden":!0})," ホームページ記事プレビュー"]}),n.jsxs("div",{className:"bg-white border border-gray-200 rounded-lg p-3 h-full",children:[n.jsx("h4",{className:"font-bold text-gray-800 mb-2 break-words",children:l||"(タイトル未入力)"}),o?n.jsx("div",{className:"text-sm text-gray-700 space-y-2",children:L0(o).map((d,h)=>n.jsx("p",{className:"whitespace-pre-wrap break-words",children:d},h))}):n.jsx("p",{className:"text-sm text-gray-400 italic",children:"(本文未入力)"})]})]})]})}function M0({violations:l,acknowledged:o,onAcknowledgedChange:c}){if(l.length===0)return null;const d=l.filter(x=>x.severity==="high"),h=l.filter(x=>x.severity!=="high");return n.jsxs("div",{className:"space-y-3",children:[d.length>0&&n.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3 space-y-2",children:[n.jsxs("p",{className:"text-sm font-bold text-red-700 flex items-center gap-1.5",children:[n.jsx(Tp,{className:"w-4 h-4 flex-shrink-0","aria-hidden":!0}),"この表現は配信できません"]}),n.jsx("ul",{className:"text-sm text-red-700 space-y-1.5 pl-1",children:d.map((x,m)=>n.jsxs("li",{children:["「",x.matchedText,"」— ",x.reason,x.suggestion&&n.jsxs("span",{className:"block text-red-700",children:["修正案: 「",x.suggestion,"」"]})]},m))})]}),h.length>0&&n.jsxs("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 space-y-2",children:[n.jsxs("p",{className:"text-sm font-bold text-amber-700 flex items-center gap-1.5",children:[n.jsx(xr,{className:"w-4 h-4 flex-shrink-0","aria-hidden":!0}),"確認が必要な表現があります"]}),n.jsx("ul",{className:"text-sm text-amber-700 space-y-1.5 pl-1",children:h.map((x,m)=>n.jsxs("li",{children:["「",x.matchedText,"」— ",x.reason,x.suggestion&&n.jsxs("span",{className:"block text-amber-700",children:["修正案: 「",x.suggestion,"」"]})]},m))}),n.jsxs("label",{className:"flex items-center gap-2 text-sm text-amber-800 pt-1 min-h-11",children:[n.jsx("input",{type:"checkbox",checked:o,onChange:x=>c(x.target.checked),className:"w-4 h-4"}),"表現を確認しました"]})]})]})}const $0=`・9/20(土)は院長不在のため休診
427・9/22(月)から通常どおり`;function D0(l,o,c,d){return JSON.stringify([l,o,[...c].sort(),d])}function Co(l){return l==="staff"?"スタッフ用":"理事長"}function Qd(l){const[,o,c]=l.split("-").map(Number);return`${o}月${c}日 9:00`}function Kd({items:l}){if(l.length===0)return null;const o=l.slice(0,2).map(c=>`「${c.title}」`).join("、");return n.jsxs("p",{className:"text-amber-700 text-sm",children:["現在 ",l.length," 件の予約があります(",o,l.length>2?" 他":"",")。重複していないかご確認ください。"]})}function z0({hook:l,isAdmin:o,onSent:c,onScheduled:d}){const h=Kn(),x=rn(),[m,p]=f.useState("manual"),[w,g]=f.useState(""),[k,j]=f.useState(!1),[N,R]=f.useState(""),[T,b]=f.useState(""),[v,D]=f.useState(""),[_,z]=f.useState("manual"),[F,V]=f.useState(new Set(["wordpress","line"])),[M,J]=f.useState("now"),[H,W]=f.useState(""),[Ne,re]=f.useState(null),[ee,Z]=f.useState(null),[xe,be]=f.useState(!1),[je,ne]=f.useState(""),[I,ie]=f.useState(null),B=f.useRef(null),C=!o&&l.staffCanSend===!1,O=f.useMemo(()=>S0(`${T}
428${v}`),[T,v]),ye=Ne===O.fingerprint,G=O.violations.some(pe=>pe.severity==="high"),fe=O.violations.length>0&&!G,ke=El(bl(Date.now()),1),_e=El(bl(Date.now()),Ef),U=M==="now"||_0(H,Date.now()).ok;f.useEffect(()=>{if(!F.has("line")||ee)return;let pe=!1;return l.fetchQuota().then($e=>{pe||Z($e)}).catch(()=>{}),()=>{pe=!0}},[F,ee,l.fetchQuota]);const te=ee?b0({quotaType:ee.quotaType,quotaLimit:ee.quotaLimit,used:ee.used,targetedReaches:ee.targetedReaches}):null,he=pe=>{V($e=>{const De=new Set($e);if(De.has(pe)){if(De.size===1)return $e;De.delete(pe)}else De.add(pe);return De})},ge=()=>{g(""),b(""),D(""),z("manual"),J("now"),W(""),re(null),ie(null),ne(""),B.current=null,Z(null)},Pe=async()=>
428{if(w.trim()){j(!0),R("");try{const pe=await l.generate(w);b(pe.title),D(pe.body),z("ai"),re(null),ie(null)}catch(pe){R(pe instanceof Error?pe.message:"生成に失敗しました")}finally{j(!1)}}},Ge=()=>{var De;const pe=D0(T,v,F,M==="schedule"?H:null);if(((De=B.current)==null?void 0:De.fingerprint)===pe)return B.current.key;const $e=crypto.randomUUID();return B.current={fingerprint:pe,key:$e},$e},Me=async pe=>{be(!0),ne("");try{let $e,De=!1;if(pe)$e=await l.retry(pe);else{const vn=await l.send({clientKey:Ge(),title:T,body:v,source:_,inputBullets:m==="ai"?w:void 0,channels:[...F],acknowledgedFingerprint:fe?O.fingerprint:void 0});$e=vn.announcement,De=vn.already}if(!$e)throw new Error("送信結果を取得できませんでした");let Xe=$e;if($e.status==="sending")try{Xe=await l.pollUntilDone($e.id)}catch{ie($e),x("配信を受け付けました。結果は履歴でご確認ください","info"),c();return}ie(Xe);const wt=Xe.status==="sending";Xe.status==="sent"?(x(De?"この内容は既に配信済みです":"臨時お知らせを配信しました","success"),ge()):Xe.stale||wt?x(De?"この内容は既に受け付け済みで、処理を続けています":"処理を続けています。履歴で結果を確認してください","info"):De&&x("この内容は既に受け付け済みです。下の結果をご確認ください","info"),c()}catch($e){ne($e instanceof Error?$e.message:"配信に失敗しました")}finally{be(!1)}},ze=async()=>{be(!0),ne("");try{(await l.schedule({clientKey:Ge(),title:T,body:v,source:_,inputBullets:m==="ai"?w:void 0,channels:[...F],acknowledgedFingerprint:fe?O.fingerprint:void 0,scheduledFor:H})).already?x("この内容は既に予約済みです","info"):(x(`${Qd(H)} に配信を予約しました`,"success"),ge()),d()}catch(pe){ne(pe instanceof Error?pe.message:"予約に失敗しました")}finally{be(!1)}},Ve=async()=>{if(ne(""),M==="schedule"&&!U){ne("予約日は明日から60日後までの範囲で指定してください");return}be(!0);let pe=[],$e=[],De="owner",Xe=!0;try{const st=await l.check(T,v);if(st.compliance.violations.some(gr=>gr.severity==="high")){ne("この表現は配信できません。内容を見直してください"),be(!1);return}pe=st.recentSimilar,$e=st.pendingScheduled,De=st.wpAccount,Xe=st.wpAccountConfigured}catch(st){ne(st instanceof Error?st.message:"確認に失敗しました"),be(!1);return}if(be(!1),F.has("wordpress")&&!Xe){ne(`${Co(De)}の WordPress アカウントが未設定です。管理者に連絡してください`);return}const wt=[...F].map(st=>st==="wordpress"?"ホームページ":"公式LINE").join(" / ");if(M==="schedule"){if(!await h({title:"臨時お知らせを予約します",tone:"warn",confirmLabel:"予約する",message:n.jsxs("div",{className:"space-y-3 text-left",children:[n.jsxs("p",{className:"font-bold",children:["配信日時: ",Qd(H)]}),n.jsxs("p",{children:["配信先: ",wt]}),F.has("wordpress")&&n.jsxs("p",{className:"text-sm text-gray-600",children:["ホームページには",Co(De),"のアカウントで投稿されます。"]}),n.jsxs("div",{className:"max-h-40 overflow-y-auto text-sm bg-gray-50 border rounded p-2",children:[n.jsx("p",{className:"font-bold",children:T}),n.jsx("p",{className:"whitespace-pre-wrap",children:v})]}),pe.length>0&&n.jsxs("p",{className:"text-amber-700 text-sm",children:["直近1時間に「",pe[0].title,"」が",pe[0].createdByLabel??"","により配信されています。"]}),n.jsx(Kd,{items:$e}),F.has("line")&&n.jsx("p",{className:"text-rose-700 font-medium text-sm",children:"LINE は送信後に取り消せません(予約は 9:00 まで取り消せます)。"})]})}))return;await ze();return}await h({title:"臨時お知らせを配信します",tone:"danger",requireTypedText:"配信",typedTextLabel:"確認のため「配信」と入力してください",confirmLabel:"配信する",message:n.jsxs("div",{className:"space-y-3 text-left",children:[n.jsxs("p",{children:["配信先: ",wt]}),F.has("wordpress")&&n.jsxs("p",{className:"text-sm text-gray-600",children:["ホームページには",Co(De),"のアカウントで投稿されます。"]}),n.jsxs("div",{className:"max-h-40 overflow-y-auto text-sm bg-gray-50 border rounded p-2",children:[n.jsx("p",{className:"font-bold",children:T}),n.jsx("p",{className:"whitespace-pre-wrap",children:v})]}),pe.length>0&&n.jsxs("p",{className:"text-amber-700 text-sm",children:["直近1時間に「",pe[0].title,"」が",pe[0].createdByLabel??"","により配信されています。"]}),n.jsx(Kd,{items:$e}),F.has("line")&&n.jsx("p",{className:"text-rose-700 font-medium text-sm",children:"LINE は送信後に取り消せません。"})]})})&&await Me()},Ke=T.trim()&&v.trim()&&F.size>0&&!G&&(!fe||ye)&&!C&&U;return n.jsxs("div",{className:"space-y-4",children:[C&&n.jsx("p",{className:"text-sm text-amber-700 bg-amber-50 border border-amber-200 rounded-lg p-3",children:"現在、職員からの配信は停止中です(管理者にご連絡ください)"}),n.jsxs("div",{className:"flex gap-1 bg-gray-100 rounded-lg p-1 
428w-fit",children:[n.jsx("button",{type:"button",onClick:()=>p("manual"),className:`px-3 py-1.5 text-sm rounded-md min-h-11 ${m==="manual"?"bg-white shadow text-accent-fg font-medium":"text-gray-600"}`,children:"本文を入力"}),n.jsx("button",{type:"button",onClick:()=>p("ai"),className:`px-3 py-1.5 text-sm rounded-md min-h-11 ${m==="ai"?"bg-white shadow text-accent-fg font-medium":"text-gray-600"}`,children:"AI に作ってもらう"})]}),m==="ai"&&n.jsxs("div",{className:"space-y-2",children:[n.jsx(aa,{label:"伝えたいことを箇条書きで",size:"sm",children:n.jsx("textarea",{value:w,onChange:pe=>g(pe.target.value),placeholder:$0,rows:3,maxLength:Eo.bullets,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm"})}),N&&n.jsx("p",{className:"text-sm text-red-600",children:N}),n.jsx(le,{variant:"secondary",size:"sm",disabled:k||!w.trim(),onClick:()=>void Pe(),children:k?n.jsx(p0,{label:"生成中…"}):n.jsxs(n.Fragment,{children:[n.jsx(Uo,{className:"w-4 h-4","aria-hidden":!0})," 文面を生成"]})})]}),n.jsx(aa,{label:"タイトル",size:"sm",children:n.jsx("input",{type:"text",value:T,onChange:pe=>{b(pe.target.value),m==="manual"&&z("manual")},onKeyDown:pe=>{pe.key==="Enter"&&pe.preventDefault()},maxLength:Eo.title,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm"})}),n.jsx(aa,{label:"本文",hint:"患者さんの氏名は書かないでください",size:"sm",children:n.jsx("textarea",{value:v,onChange:pe=>{D(pe.target.value),m==="manual"&&z("manual")},rows:6,maxLength:Eo.body,className:"w-full border border-gray-200 rounded-lg px-3 py-2 text-sm"})}),n.jsxs("div",{className:"flex flex-wrap gap-4",children:[n.jsxs("label",{className:"flex items-center gap-2 text-sm min-h-11",children:[n.jsx("input",{type:"checkbox",checked:F.has("wordpress"),onChange:()=>he("wordpress"),className:"w-4 h-4"}),"ホームページ"]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm min-h-11",children:[n.jsx("input",{type:"checkbox",checked:F.has("line"),onChange:()=>he("line"),className:"w-4 h-4"}),"公式LINE"]})]}),n.jsxs("fieldset",{className:"space-y-1.5",children:[n.jsx("legend",{className:"text-sm font-medium text-gray-700 mb-1",children:"配信タイミング"}),n.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[n.jsxs("label",{className:"flex items-center gap-2 text-sm min-h-11",children:[n.jsx("input",{type:"radio",name:"urgent-timing",checked:M==="now",onChange:()=>J("now"),className:"w-4 h-4"}),"今すぐ配信"]}),n.jsxs("label",{className:"flex items-center gap-2 text-sm min-h-11",children:[n.jsx("input",{type:"radio",name:"urgent-timing",checked:M==="schedule",onChange:()=>J("schedule"),className:"w-4 h-4"}),"指定日の朝9時に配信"]}),M==="schedule"&&n.jsx("input",{type:"date",value:H,min:ke,max:_e,onChange:pe=>W(pe.target.value),className:"border border-gray-200 rounded-lg px-3 py-2 text-sm min-h-11"})]}),M==="schedule"&&n.jsx("p",{className:"text-xs text-gray-500",children:"午前9時(JST)に自動配信されます。それまでは下の「予約中の配信」から取り消せます。"})]}),F.has("line")&&te&&n.jsx("p",{className:`text-sm rounded-lg px-3 py-2 border ${te.level==="insufficient"?"bg-amber-50 text-amber-700 border-amber-200":"bg-gray-50 text-gray-600 border-gray-200"}`,children:te.message}),n.jsx(M0,{violations:O.violations,acknowledged:ye,onAcknowledgedChange:pe=>re(pe?O.fingerprint:null)}),(T||v)&&n.jsx(P0,{title:T,body:v}),je&&n.jsx("p",{className:"text-sm text-red-600",children:je}),I&&I.status!=="sent"&&n.jsxs("div",{className:`rounded-lg p-3 border text-sm space-y-2 ${I.status==="failed"?"bg-red-50 border-red-200":"bg-amber-50 border-amber-200"}`,children:[n.jsx("p",{className:"font-medium",children:I.stale||I.status==="sending"?"処理を続けています。結果は履歴で確認してください":I.status==="partial"?"一部のチャネルで失敗しました":"配信に失敗しました"}),I.channels.includes("wordpress")&&n.jsxs("p",{children:["HP: ",I.wp.postUrl?"掲載済み":I.wp.error?`失敗: ${I.wp.error}`:"未送信"]}),I.channels.includes("line")&&n.jsxs("p",{children:["LINE: ",I.line.sentAt?"送信済み":I.line.error?`失敗: ${I.line.error}`:I.line.outcomeUnknown?"結果不明":"未送信"]}),!I.line.retryBlocked&&(I.stale||I.status==="partial"||I.status==="failed")&&(()=>{const pe=I.channels.length===F.size&&I.channels.every(De=>F.has(De));return I.title!==T||I.body!==v||!pe||M==="schedule"?n.jsx("p",{className:"text-amber-800 text-sm",children:"内容・配信先・配信タイミングのいずれかを変更しました。再送では変更前の内容がそのまま 即時に送られてしまうため無効化しています。変更した場合は、あらためて上のボタンから 新しく配信または予約してください。"}):n.jsx(le,{variant:"secondary",size:"sm",disabled:xe,onClick:async()=>{await h({title:"臨時お知らせを再送します",tone:"danger",requireTypedText:"配信",typedTextLabel:"確認のため「配信」と入力してください",confirmLabel:"再送する",message:n.jsxs("div",{className:"space-y-2 text-left",children:[n.jsxs("p",{children:["配信先: ",I.channels.map(Xe=>Xe==="wordpress"?"ホームページ":"公式LINE").join(" / ")]}),n.jsx("p",{children:"未完了のチャネルへ、以下の内容を再送します。"}),n.jsxs("div",{className:"max-h-40 overflow-y-auto text-sm bg-gray-50 border rounded p-2",children:[n.jsx("p",{className:"font-bold",children:I.title}),n.jsx("p",{className:"whitespace-pre-wrap",children:I.body})]}),I.channels.includes("line")&&n.jsx("p",{className:"text-rose-700 font-medium text-sm",children:"LINE は送信後に取り消せません。"})]})})&&await Me(I.id)},children:"再送する"})})()]}),n.jsxs(le,{variant:"primary",disabled:!Ke||xe,onClick:()=>void Ve(),children:[xe?n.jsx(Lt,{className:"w-4 h-4 animate-spin","aria-hidden":!0}):n.jsx(ss,{className:"w-4 h-4","aria-hidden":!0}),M==="schedule"?"予約内容を確認":"配信内容を確認"]})]})}const Jd={sent:{label:"配信済み",cls:"bg-green-100 text-green-700"},partial:{label:"一部失敗",cls:"bg-amber-100 text-amber-700"},failed:{label:"失敗",cls:"bg-red-100 text-red-700"},sending:{label:"送信中",cls:"bg-blue-100 text-blue-700"}};function R0(l){const[,o,c]=l.split("-");return`${Number(o)}/${Number(c)} 9:00`}
428function A0(l){return new Date(l).toLocaleString("ja-JP",{timeZone:"Asia/Tokyo",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function I0(l){return l.status==="failed"&&l.wp.postId==null&&l.line.sentAt==null&&(l.line.attemptStartedAt==null||l.line.error!=null)}function O0(l,o,c){return o||c!=null&&l.createdBy===c}function U0({items:l,total:o,page:c,setPage:d,pageSize:h,setPageSize:x,loading:m,error:p,isAdmin:w,currentUserIdentity:g,onRetry:k,onDelete:j,onResolve:N}){const R=rn(),T=Kn(),[b,v]=f.useState(null),[D,_]=f.useState(null),z=Math.max(1,Math.ceil(o/h)),F=async(M,J)=>{_(M);try{await J()}catch(H){R(H instanceof Error?H.message:"操作に失敗しました","error")}finally{_(null)}},V=async M=>{const J=bl(Date.now()),H=M.scheduledFor!=null&&M.scheduledFor<J;await T({title:"臨時お知らせを再送します",tone:"danger",requireTypedText:"配信",typedTextLabel:"確認のため「配信」と入力してください",confirmLabel:"再送する",message:n.jsxs("div",{className:"space-y-2 text-left",children:[H&&n.jsxs("p",{className:"text-red-700 font-bold text-sm",children:["この内容は ",M.scheduledFor," に配信予定でした(本日は ",J," です)。内容が古くないか確認してください。"]}),n.jsx("p",{className:"font-bold",children:M.title}),M.channels.includes("line")&&n.jsx("p",{className:"text-rose-700 font-medium text-sm",children:"LINE は送信後に取り消せません。"})]})})&&await F(M.id,()=>k(M.id))};return m&&l.length===0?n.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"読み込み中…"}):p?n.jsx("div",{className:"text-sm text-red-600 py-4",children:p}):l.length===0?n.jsx("div",{className:"text-gray-500 text-sm py-8 text-center",children:"配信履歴はまだありません。"}):n.jsxs("div",{className:"space-y-3",children:[n.jsx("ul",{className:"space-y-2",children:l.map(M=>{const J=M.stale?{label:"結果不明",cls:"bg-gray-200 text-gray-600"}:Jd[M.status]??Jd.sending,H=b===M.id,W=D===M.id,Ne=O0(M,w,g),re=Ne&&(M.status==="partial"||M.status==="failed"||M.stale)&&!M.line.retryBlocked,ee=Ne&&I0(M),Z=w&&M.line.outcomeUnknown;return n.jsxs("li",{id:Nf(M.id),className:"border border-gray-100 rounded-lg scroll-mt-4",children:[n.jsxs("button",{type:"button",onClick:()=>v(H?null:M.id),className:"w-full text-left p-3 hover:bg-gray-50/60 min-h-11",children:[M.scheduledFor&&n.jsx("div",{className:"mb-1",children:n.jsxs("span",{className:"text-xs font-medium px-2 py-0.5 rounded-full bg-sky-100 text-sky-700",children:["予約配信 ",R0(M.scheduledFor)]})}),n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full flex-shrink-0 ${J.cls}`,children:J.label}),n.jsx("span",{className:"flex-1 min-w-0 truncate font-medium text-gray-800",children:M.title}),n.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0 hidden sm:inline",children:M.createdByLabel??M.createdBy}),n.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0",children:A0(M.createdAt)}),H?n.jsx(zo,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}):n.jsx(Tl,{className:"w-4 h-4 text-gray-400 flex-shrink-0"})]})]}),H&&n.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-gray-100 pt-3",children:[n.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:M.body}),M.line.retryBlocked&&n.jsx("p",{className:"text-xs text-amber-700 bg-amber-50 border border-amber-200 rounded px-2 py-1.5",children:"LINE の配信結果が24時間以上不明のままです。管理者による確認が必要です。"}),n.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2 text-sm",children:[n.jsxs("div",{className:"bg-gray-50 rounded p-2",children:[n.jsxs("p",{className:"font-medium text-gray-600 mb-0.5",children:["ホームページ",M.channels.includes("wordpress")&&n.jsxs("span",{className:"font-normal text-gray-500",children:[" (投稿アカウント: ",M.wpAccount==="staff"?"スタッフ用":"理事長",")"]})]}),M.channels.includes("wordpress")?M.wp.postUrl?n.jsxs("a",{href:M.wp.postUrl,target:"_blank",rel:"noopener noreferrer",className:"text-accent-fg hover:underline inline-flex items-center gap-1",children:["掲載済み ",n.jsx(jl,{className:"w-3 h-3"})]}):M.wp.error?n.jsxs("span",{className:"text-red-600",children:["失敗: ",M.wp.error]}):n.jsx("span",{className:"text-gray-500",children:"未送信"}):n.jsx("span",{className:"text-gray-400",children:"(対象外)"})]}),n.jsxs("div",{className:"bg-gray-50 rounded p-2",children:[n.jsx("p",{className:"font-medium text-gray-600 mb-0.5",children:"公式LINE"}),M.channels.includes("line")?M.line.sentAt?n.jsx("span",{className:"text-green-700",children:"送信済み"}):M.line.error?n.jsxs("span",{className:"text-red-600",children:["失敗: ",M.line.error]}):n.jsx("span",{className:"text-gray-500",children:M.line.outcomeUnknown?"結果不明":"未送信"}):n.jsx("span",{className:"text-gray-400",children:"(対象外)"})]})]}),(re||ee||Z)&&n.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[re&&n.jsxs(le,{variant:"secondary",size:"sm",disabled:W,onClick:()=>void V(M),children:[n.jsx(Lp,{className:"w-3.5 h-3.5","aria-hidden":!0})," 再送する"]}),ee&&n.jsxs(le,{variant:"ghost",size:"sm",disabled:W,onClick:()=>F(M.id,()=>j(M.id)),children:[n.jsx(hr,{className:"w-3.5 h-3.5","aria-hidden":!0})," 削除"]}),Z&&n.jsxs(n.Fragment,{children:[n.jsxs(le,{variant:"secondary",size:"sm",disabled:W,onClick:()=>F(M.id,()=>N(M.id,"mark_sent")),children:[n.jsx(tf,{className:"w-3.5 h-3.5","aria-hidden":!0})," LINE送信済みとして記録"]}),n.jsxs(le,{variant:"ghost",size:"sm",disabled:W,onClick:()=>F(M.id,()=>N(M.id,"mark_not_sent")),children:[n.jsx(Ro,{className:"w-3.5 h-3.5","aria-hidden":!0})," 未送信として戻す"]})]})]})]})]},M.id)})}),n.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 text-sm text-gray-600",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("label",{className:"text-gray-500",children:"表示件数"}),n.jsx("select",{value:h,onChange:M=>x(Number(M.target.value)),className:"border border-gray-200 rounded px-1.5 py-1 text-xs bg-white",children:[10,25,50,100].map(M=>n.jsxs("option",{value:M,children:[M,"件"]},M))}),n.jsxs("span",{className:"text-gray-500",children:["全 ",o," 件中 ",(c-1)*h+1,"–",Math.min(c*h,o)," 件"]})]}),z>1&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>d(Math.max(1,c-1)),disabled:c<=1,children:"前へ"}),n.jsxs("span",{children:[c," / ",z]}
428),n.jsx(le,{variant:"ghost",size:"sm",onClick:()=>d(Math.min(z,c+1)),disabled:c>=z,children:"次へ"})]})]})]})}const F0=["日","月","火","æ°´","木","金","土"];function qd(l){const[o,c,d]=l.split("-").map(Number),h=F0[new Date(Date.UTC(o,c-1,d)).getUTCDay()];return`${c}/${d}(${h})9:00`}function H0({items:l,isAdmin:o,currentUserIdentity:c,onCancel:d}){const h=rn(),x=Kn(),[m,p]=f.useState(null),[w,g]=f.useState(null),[k,j]=f.useState(10);if(l.length===0)return null;const N=l.slice(0,k),R=async T=>{if(await x({title:"予約を取り消します",tone:"warn",confirmLabel:"取り消す",message:n.jsxs("div",{className:"space-y-1 text-left",children:[n.jsx("p",{className:"font-bold",children:T.title}),n.jsxs("p",{className:"text-sm text-gray-600",children:[qd(T.scheduledFor)," の配信予約を取り消します。"]})]})})){g(T.id);try{await d(T.id)==="gone"&&h("既に自動実行されました。配信履歴をご確認ください","info")}catch(v){h(v instanceof Error?v.message:"取り消しに失敗しました","error")}finally{g(null)}}};return n.jsxs("div",{className:"space-y-3",children:[n.jsx("ul",{className:"space-y-2",children:N.map(T=>{const b=m===T.id,v=w===T.id,D=o||c!=null&&T.createdBy===c;return n.jsxs("li",{id:Sf(T.id),className:"border border-gray-100 rounded-lg scroll-mt-4",children:[n.jsxs("button",{type:"button",onClick:()=>p(b?null:T.id),className:"w-full text-left p-3 flex items-center gap-3 hover:bg-gray-50/60 min-h-11",children:[n.jsx("span",{className:`text-xs font-medium px-2 py-0.5 rounded-full flex-shrink-0 ${T.overdue?"bg-red-100 text-red-700":"bg-sky-100 text-sky-700"}`,children:T.overdue?"未実行":qd(T.scheduledFor)}),n.jsx("span",{className:"flex-1 min-w-0 truncate font-medium text-gray-800",children:T.title}),n.jsx("span",{className:"text-xs text-gray-500 flex-shrink-0 hidden sm:inline",children:T.createdByLabel??T.createdBy}),b?n.jsx(zo,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}):n.jsx(Tl,{className:"w-4 h-4 text-gray-400 flex-shrink-0"})]}),b&&n.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-gray-100 pt-3",children:[T.overdue&&n.jsx("p",{className:"text-xs text-red-700 bg-red-50 border border-red-200 rounded px-2 py-1.5",children:"自動実行が遅れている可能性があります。しばらくして再読み込みしてください。9:30 を過ぎても残っていれば管理者に連絡してください。"}),n.jsx("p",{className:"text-sm text-gray-700 whitespace-pre-wrap",children:T.body}),n.jsxs("p",{className:"text-xs text-gray-500",children:["配信先: ",T.channels.map(_=>_==="wordpress"?"ホームページ":"公式LINE").join(" / "),T.channels.includes("wordpress")&&`(投稿アカウント: ${T.wpAccount==="staff"?"スタッフ用":"理事長"})`]}),D&&n.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:n.jsxs(le,{variant:"ghost",size:"sm",className:"min-h-11",disabled:v,onClick:()=>void R(T),children:[n.jsx(mr,{className:"w-3.5 h-3.5","aria-hidden":!0})," 取り消す"]})})]})]},T.id)})}),l.length>10&&n.jsxs("div",{className:"flex items-center gap-2 text-sm text-gray-600",children:[n.jsx("label",{className:"text-gray-500",children:"表示件数"}),n.jsx("select",{value:k,onChange:T=>j(Number(T.target.value)),className:"border border-gray-200 rounded px-1.5 py-1 text-xs bg-white",children:[10,25,50,100].map(T=>n.jsxs("option",{value:T,children:[T,"ä»¶"]},T))}),n.jsxs("span",{className:"text-gray-500",children:["全 ",l.length," 件中 ",N.length," 件を表示"]})]})]})}const W0={already_in_progress:"現在、送信処理中です。しばらくしてから履歴でご確認ください",already_sent:"この配信は既に完了しています。履歴をご確認ください",not_found:"この配信は見つかりませんでした(既に削除された可能性があります)",line_outcome_unknown:"LINE の配信結果が24時間以上不明のままです。管理者による確認が必要です",Unauthorized:"この操作は許可されていません(ログインの有効期限切れの可能性があります。再読み込みしてください)","Not Found":"対象が見つかりませんでした",scheduled_for_invalid:"予約日の指定が不正です",scheduled_for_out_of_range:"予約日は明日から60日後までã
428®ç¯„囲で指定してください",wp_credentials_missing:"ホームページの投稿アカウントが設定されていません(管理者にご連絡ください)",schedule_insert_failed:"予約の作成に失敗しました。もう一度お試しください",client_key_conflict:"この操作を完了できませんでした。時間をおいてもう一度お試しください"};class ls extends Error{constructor(c,d){const h=d&&typeof d=="object"&&"error"in d&&typeof d.error=="string"?d.error:null,x=h!=null?W0[h]??h:`HTTP ${c}`;super(x);fo(this,"status");fo(this,"body");this.name="UrgentApiError",this.status=c,this.body=d}}async function Tt(l,o){const c=await fetch(l,{credentials:"same-origin",...o}),d=await c.json().catch(()=>null);if(!c.ok||d===null)throw new ls(c.ok?502:c.status,d);return d}const B0=1e3,V0=6e4,Y0=10;async function Q0(l,o={}){const c=o.intervalMs??B0,d=o.timeoutMs??V0,h=Date.now()+d;let x=null,m=null;for(;;){try{const p=await Tt(`/api/urgent-announcements/${l}`);if(!p.announcement||typeof p.announcement!="object")throw new ls(502,null);if(x=p.announcement,m=null,p.announcement.status!=="sending")return p.announcement}catch(p){m=p}if(Date.now()>=h){if(x)return x;throw m instanceof Error?m:new Error("結果を確認できませんでした。履歴でご確認ください")}await new Promise(p=>setTimeout(p,c))}}async function K0(l){try{return{already:!1,scheduled:(await Tt("/api/urgent-announcements/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})).scheduled}}catch(o){if(o instanceof ls&&o.status===409&&o.body&&typeof o.body=="object"&&"already"in o.body)return{already:!0,scheduled:o.body.scheduled??null};throw o}}async function J0(l){const o=await fetch(`/api/urgent-announcements/scheduled/${l}`,{method:"DELETE",credentials:"same-origin"});if(o.status===404)return"gone";if(!o.ok){const c=await o.json().catch(()=>null);throw new ls(o.status,c)}return"deleted"}function q0(){const[l,o]=f.useState([]),[c,d]=f.useState(0),[h,x]=f.useState(1),[m,p]=f.useState(Y0),[w,g]=f.useState(!1),[k,j]=f.useState(""),[N,R]=f.useState([]),[T,b]=f.useState([]),[v,D]=f.useState(!1),[_,z]=f.useState(null),[F,V]=f.useState([]),[M,J]=f.useState(0),H=f.useCallback(async()=>{g(!0),j("");try{const G=await Tt(`/api/urgent-announcements?page=${h}&pageSize=${m}`);o(G.items),d(G.total)}catch(G){j(G instanceof Error?G.message:"取得に失敗しました")}finally{g(!1)}},[h,m]);f.useEffect(()=>{H()},[H]),f.useEffect(()=>{const G=Math.max(1,Math.ceil(c/m));h>G&&x(G)},[c,m,h]);const W=G=>{p(G),x(1)},Ne=f.useCallback(async()=>{try{const G=await Tt("/api/urgent-announcements/attention");R(G.items),b(Array.isArray(G.scheduledOverdue)?G.scheduledOverdue:[]),D(G.scheduledRunStale===!0)}catch{}},[]);f.useEffect(()=>{Ne()},[Ne]);const re=f.useCallback(async()=>{try{const G=await Tt("/api/urgent-announcements/scheduled");V(G.items),J(G.total)}catch{}},[]);f.useEffect(()=>{re()},[re]);const ee=f.useCallback(async()=>{try{const G=await Tt("/api/urgent-announcements/settings");z(G.staffCanSend)}catch{}},[]);f.useEffect(()=>{ee()},[ee]);const Z=f.useCallback(async G=>{const fe=await Tt("/api/urgent-announcements/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({staffCanSend:G})});z(fe.staffCanSend)},[]),xe=f.useCallback((G,fe)=>Tt("/api/urgent-announcements/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:G,body:fe})}),[]),be=f.useCallback(G=>Tt("/api/urgent-announcements/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({bullets:G})}),[]),je=f.useCallback(async G=>{try{return{already:!1,announcement:(await Tt("/api/urgent-announcements/send",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)})).announcement}}catch(fe){if(fe instanceof ls&&fe.status===409&&fe.body&&typeof fe.body=="object"&&"already"in fe.body)return{already:!0,announcement:fe.body.announcement??null};throw fe}},[]),ne=f.useCallback(G=>K0(G),[]),I=f.useCallback(G=>J0(G),[]),ie=f.useCallback(G=>Q0(G),[]),B=f.useCallback(async G=>(await Tt(`/api/urgent-announcements/${G}/send`,{method:"POST"})).announcement,[]),C=f.useCallback(async G=>{const fe=await fetch(`/api/urgent-announcements/${G}`,{method:"DELETE",credentials:"same-origin"});if(!fe.ok){const ke=await fe.json().catch(()=>null);throw new ls(fe.status,ke)}},[]),O=f.useCallback(async(G,fe)=>(await Tt(`/api/urgent-announcements/${G}/resolve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({line:fe})})).announcement,[]),ye=f.useCallback(()=>Tt("/api/urgent-announcements/line-quota"),[]);return{items:l,total:c,page:h,setPage:x,pageSize:m,setPageSize:W,historyLoading:w,historyError:k,reloadHistory:H,attentionItems:N,scheduledOverdue:T,scheduledRunStale:v,reloadAttention:Ne,scheduledItems:F,scheduledTotal:M,reloadScheduled:re,staffCanSend:_,reloadSettings:ee,updateStaffCanSend:Z,check:xe,generate:be,send:je,schedule:ne,cancelScheduled:I,pollUntilDone:ie,retry:B,remove:C,resolveLine:O,fetchQuota:ye}}function G0({isAdmin:l,currentUserIdentity:o}){const c=q0(),d=rn(),h=()=>{c.reloadHistory(),c.reloadAttention()},x=()=>{c.reloadScheduled(),c.reloadAttention()};return n.jsxs("div",{className:"space-y-6 animate-in fade-in duration-300",children:[n.jsx(m0,{items:c.attentionItems,scheduledOverdue:c.scheduledOverdue,scheduledRunStale:c.scheduledRunStale,isAdmin:l}),n.jsx(Ue,{title:"臨時お知らせを配信",icon:ss,children:n.jsx(z0,{hook:c,isAdmin:l,onSent:h,onScheduled:x})}),c.scheduledItems.length>0&&n.jsx(Ue,{title:"予約中の配信",icon:Cl,children:n.jsx(H0,{items:c.scheduledItems,isAdmin:l,currentUserIdentity:o,onCancel:async m=>{const p=await c.cancelScheduled(m);return await c.reloadScheduled(),await c.reloadAttention(),p==="gone"&&await c.reloadHistory(),p}})}),n.jsx(Ue,{title:"配信履歴",icon:ra,headerExtra:l&&c.staffCanSend!==null?n.jsxs("label",{className:"flex items-center gap-2 text-sm text-gray-600 min-h-11",children:[n.jsx("input",{type:"checkbox",checked:c.staffCanSend,onChange:m=>{c.updateStaffCanSend(m.target.checked).catch(p=>{d(p instanceof Error?p.message:"更新に失敗しました","error")})},className:"w-4 h-4"}),"職員の配信を許可する"]}):void 0,children:n.jsx(U0,{items:c.items,total:c.total,page:c.page,setPage:c.setPage,pageSize:c.pageSize,setPageSize:c.setPageSize,loading:c.historyLoading,error:c.historyError,isAdmin:l,currentUserIdentity:o,onRetry:async m=>{const p=await c.retry(m);if(await c.reloadHistory(),await c.reloadAttention(),(p==null?void 0:p.status)==="sending"){try{await c.pollUntilDone(p.id)}catch{}await c.reloadHistory(),await c.reloadAttention()}},onDelete:async m=>{await c.remove(m),await c.reloadHistory()},onResolve:async(m,p)=>{await c.resolveLine(m,p),await c.reloadHistory(),await c.reloadAttention()}})})]})}const X0=600*1e3;function Z0(l){const[o,c]=f.useState(0);return f.useEffect(()=>{let d=!1;const h=async()=>{var m,p;try{const w=await fetch("/api/urgent-announcements/attention",{credentials:"same-origin"});if(!w.ok)return;const g=await w.json().catch(()=>null);if(d||!g)return;const k=(((m=g.items)==null?void 0:m.length)??0)+(((p=g.scheduledOverdue)==null?void 0:p.length)??0)+(l&&g.scheduledRunStale?1:0);c(k)}catch{}};h();const x=setInterval(()=>{h()},X0);return()=>{d=!0,clearInterval(x)}},[l]),o}const eg=[{date:"2026-10-01",title:"月次配信の「1月分」を、年頭の挨拶として作れるようにしました",points:["毎年12月に作る「1月分」の配信案は、診療スケジュールのお知らせではなく、年頭の挨拶(ホームページ+公式LINE)として自動で作られます。1月分以外の月は今までどおりです。","ホームページの記事タイトルは「年頭の挨拶」です。これまでの挨拶記事と同じ調子で、新年の干支にちなんだ文章をAIが作ります。公式LINEは簡潔な挨拶と、ホームページの記事へのリンク(URL)だけです。","「本年の取り組み」を入れたいときは、12月のうちに「お知らせメモ」へ書いてから「Claudeでメッセージを生成」で作り直してください(メモが空のときは、その段落は入りません)。","公開の順番は、①WordPressを1/1 0:00に予約 → ②画面に「✔ URL確認済み」が出てから ③LINEを1/1に予約、です。元旦の朝の自動送信は、ホームページの記事が公開されていると確認できたときだけ行い、まだなら送らずに通知でお知らせします。","配信管理タブに案内と「年頭の挨拶として扱う」のチェックが出ます(外すと通常のスケジュール記事を作れます)。年内に送信・公開しようとしたときや、URLが確認できていないときは、確認画面に赤字で警告が出ます。","配信済みの挨拶は、2月以降の文面づくりの参考例ã
428«ã¯ä½¿ã‚ã‚Œã¾ã›ã‚“。","1月の臨時休診・臨時診療・担当医の変更は、LINEの締めの言葉の前と、ホームページの挨拶の後に「1月の診療予定」として自動で入ります(臨時予定タブの登録から作ります。年始の休診は先に登録してください)。ホームページの一番下には1月の診療カレンダーが付きます。","生成したあとに臨時予定を変えたときは、作り直してください。予約したLINEの一覧が登録と違うと、年内は毎朝お知らせが届き、元旦の自動送信は止まります(誤った休診日を送らないため)。","ホームページの診療カレンダーが読み込むデータから、臨時予定のメモ(院内向けの記入欄)とお知らせメモを外しました。これまで外部から読める状態でした。カレンダーの見た目(担当医の表示を含む)は変わりません。"]},{date:"2026-09-29",title:"「Claude でメッセージを生成」で文面が空になる不具合を直しました",points:["新しいAIモデル(Claude Sonnet 5.5)への自動切り替えの影響で、LINE用メッセージとWordPress用記事の本文が空のまま表示されていました。正しく生成されるよう修正しました。","月次配信案の自動生成と、臨時お知らせのAI文面作成にも同じ修正を入れています。","今後AIが文面を返せなかった場合は、空欄のまま進まずにエラーを表示するようにしました。表示されたら、もう一度生成してください。"]},{date:"2026-09-15",title:"新タブ「臨時お知らせ」を追加しました(休診・時間変更等をホームページ+公式LINEへ即時配信)",points:["月次の配信管理とは別に、臨時休診・診療時間変更・システム障害などをすぐに伝えるための新しいタブを追加しました。職員も利用できます。","本文は直接入力するか、伝えたい内容を箇条書きすればAIが文面を作成します。ホームページ(WordPress)と公式LINEへ同じ内容を1回の操作で配信します。","医療広告ガイドラインに触れる表現の自動チェック・配信前の内容確認・LINEの残り通数表示など、誤配信を防ぐしくみを備えています。管理者は職員の配信を一時的に止めるスイッチも使えます。","「配信タイミング」で指定日の朝9時に自動配信する予約機能を追加しました。予約は配信されるまで「予約中の配信」からいつでも取り消せます。","ホームページへの投稿アカウントを、配信した人に応じて自動的に使い分けるようにしました(理事長はご自身のアカウント、それ以外の職員はスタッフ用アカウントで投稿されます)。"]},{date:"2026-09-03",title:"AI配信文生成のモデル管理を秘書チャットに一元化しました(動作・見た目は変わりません)",points:["配信文(LINE・WordPress)を生成するAIモデルの指定方法を内部で整理し、秘書チャットアプリが一括管理する方式に変更しました。新しいAIモデルが登場した際、各アプリを個別に改修しなくても追従できるようにするための変更です。","生成内容や料金の目安は変わりません。"]},{date:"2026-07-30",title:"配信案生成・担当医の色設定のしくみを内部整理しました(動作・見た目は変わりません)",points:["毎月の配信案(LINE・WordPress)を自動生成するしくみを1つにまとめ、今後の不具合を防ぎやすくしました。生成に失敗した場合は秘書チャットへ通知するようにしました。","担当医の色分けの管理方法を内部で整理しました。バッジの色・カレンダーの表示は変わりません。","電話ルーティングの「曜日・時間帯ルール」表を、支援技術(読み上げソフト等)でも操作しやすいよう改善しました。"]},{date:"2026-07-29",title:"タブ構成の見直し・API利用料金の表示・その他の改善",points:["「配信管理」タブと「配信アーカイブ」タブを1つに統合しました。「配信管理」タブ内の「配信作成」/「配信履歴」の切り替えで、これまでどおり両方の内容を確認・操作できます。","基本設定タブに「API利用料金(月次合計)」を追加しました。当月のAPI利用料金の合計と、直近の推移を確認できます。","患者向けHP埋め込みカレンダーに、スマートフォン幅で見やすい縦一覧表示を追加しました(休診・臨時診療・祝日の日を色分けして強調表示します)。"]},{date:"2026-07-28",title:"アプリ全体のUIを見直しました(総合見直し Phase 1〜6)",points:["Vercel時代の古い説明文(「時刻は9時固定」等の理由や連携方法の記載)を現在の仕組ã
428¿ã«åˆã‚ã›ã¦ä¿®æ­£ã—ました。","配信管理タブの「変更は自動保存されます」という誤った案内を、実際の挙動(保存・公開ボタンを押すと保存されます)に合わせて修正しました。","色のコントラストを見直し、文字が薄くて読みにくかった箇所を改善しました(患者向けカレンダーも含む)。","ボタン・モーダル(ポップアップ)の見た目を全画面で統一し、Escキーでの閉じる操作やキーボード操作にも対応しました。","削除操作の確認方法を統一しました(重要な削除には確認ダイアログが表示されます)。","編集内容を保存し忘れないよう、未保存の変更があるときはヘッダーに表示するようにしました。閉じる前にリロードしても、前回の編集内容を復元できます。","ヘッダーの「保存・公開」ボタンを廃止しました。臨時予定・曜日別スケジュール・担当医は確定操作(追加/編集/削除)と同時に自動保存されます。クリニック名・お知らせは各項目内の保存ボタンで保存します。","LINE配信・WordPress公開の前に、送信内容を確認するダイアログを追加しました。","タブの並び順を業務の流れ(診療カレンダー・臨時予定・基本設定/お知らせ・配信管理・配信アーカイブ/電話・着信・チャット)に整理し、「プレビュー」タブを「診療カレンダー」に改称しました。","電話ルーティングタブの休業日表示を、電話専用の設定と、カレンダーから自動反映される休業日(確認専用)とに分けて分かりやすくしました。","配信アーカイブ・着信ログ・臨時予定の一覧に表示件数の選択(10/25/50/100件)を追加しました。","スマートフォンでのタップしやすさ・読み上げソフトでの操作性を改善しました(ボタンのタップ範囲拡大、アイコンボタンへの説明文追加など)。"]}];function tg(l){const[o,c,d]=l.split("-");return!o||!c||!d?l:`${o}å¹´${Number(c)}月${Number(d)}日`}function ng({entry:l,isNew:o}){const[c,d]=f.useState(o);return n.jsxs("li",{className:"px-5 py-3.5",children:[n.jsxs("button",{type:"button",onClick:()=>d(h=>!h),"aria-expanded":c,className:"w-full flex items-start gap-2 text-left",children:[n.jsx("span",{className:"flex-shrink-0 mt-0.5 text-gray-400",children:c?n.jsx(Tl,{size:16,"aria-hidden":!0}):n.jsx(pr,{size:16,"aria-hidden":!0})}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[n.jsx("time",{className:"text-xs text-gray-400 tabular-nums",children:tg(l.date)}),o&&n.jsx("span",{className:"inline-flex items-center h-4 px-1.5 rounded-full bg-semantic-error text-white text-[10px] font-semibold leading-none",children:"NEW"})]}),n.jsx("span",{className:`block mt-1 font-medium text-gray-900 ${c?"":"truncate"}`,children:l.title})]})]}),c&&n.jsx("div",{className:"pl-6 mt-2",children:n.jsx("ul",{className:"space-y-1",children:l.points.map((h,x)=>n.jsx("li",{className:"text-sm text-gray-600 leading-relaxed pl-4 relative before:content-['・'] before:absolute before:left-0 before:text-accent-fg",children:h},x))})})]})}const Gd="cc_updates_seen_date",rg=5;function sg(){var x;const[l]=f.useState(()=>{try{return localStorage.getItem(Gd)??""}catch{return""}}),o=f.useMemo(()=>[...eg].sort((m,p)=>p.date.localeCompare(m.date)),[]),c=((x=o[0])==null?void 0:x.date)??"",d=f.useMemo(()=>o.filter(m=>m.date>l).length,[o,l]);if(f.useEffect(()=>{if(c&&c>l)try{localStorage.setItem(Gd,c)}catch{}},[c,l]),o.length===0)return null;const h=o.slice(0,rg);return n.jsxs("section",{"aria-labelledby":"whats-new-heading",className:"bg-white border border-gray-200 rounded-xl overflow-hidden",children:[n.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 px-5 py-3 border-b border-gray-100",children:[n.jsx(Uo,{size:16,className:"text-accent-fg","aria-hidden":!0}),n.jsx("h3",{id:"whats-new-heading",className:"text-sm font-semibold text-gray-800",children:"更新情報"}),d>0&&n.jsxs("span",{className:"inline-flex items-center justify-center min-w-5 h-5 px-1.5 rounded-full bg-semantic-error text-white text-[10px] font-semibold leading-none","aria-label":`新着 ${d} ä»¶`,children:["NEW ",d]})]}),n.jsx("ul",{className:"divide-y divide-gray-100",children:h.map(m=>n.jsx(ng,{entry:m,isNew:m.date>l},`${m.date}-${m.title}`))})]})}const ag=[{id:"preview",label:"診療カレンダー",icon:n.jsx(Ao,{className:"w-4 h-4"}),adminOnly:!1,group:1},{id:"temp",label:"臨時予定",icon:n.jsx(_l,{className:"w-4 h-4"}),adminOnly:!1,group:1},{id:"basic",label:"基本設定",icon:n.jsx(Pp,{className:"w-4 h-4"}),adminOnly:!0,group:1},{id:"urgent",label:"臨時お知らせ",icon:n.jsx($p,{className:"w-4 h-4"}),adminOnly:!1,group:2},{id:"announcement",label:"お知らせ管理",icon:n.jsx(af,{className:"w-4 h-4"}),adminOnly:!1,group:2},{id:"delivery",label:"配信管理",icon:n.jsx(ss,{className:"w-4 h-4"}),adminOnly:!0,group:2},{id:"phone",label:"電話ルーティング",icon:n.jsx(Oo,{className:"w-4 h-4"}),adminOnly:!1,group:3},{id:"callLog",label:"着信ログ",icon:n.jsx(lf,{className:"w-4 h-4"}),adminOnly:!1,group:3},{id:"chatbot",label:"チャット問い合わせ",icon:n.jsx(Io,{className:"w-4 h-4"}),adminOnly:!1,group:3}];function lg(){const l=Fp(),o=Hp(),c=rn(),[d,h]=f.useState("staff"),[x,m]=f.useState(null),[p,w]=f.useState(!1),[g,k]=f.useState(()=>{if(typeof window>"u")return"temp";const V=new URLSearchParams(window.location.search).get("tab");return V==="archive"?"delivery":["temp","urgent","announcement","preview","delivery","basic","phone","callLog","chatbot"].includes(V??"")?V:"temp"}),[j,N]=f.useState(null),[R,T]=f.useState(new Date),[b,v]=f.useState(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("tab")==="archive");f.useEffect(()=>{document.title="外来診療予定&お知らせ管理",document.documentElement.style.colorScheme="light"},[]),f.useEffect(()=>{const V=new URLSearchParams(window.location.search),M=V.get("sso");if(M){const H=V.get("redirect")??"/";window.location.replace(`/api/auth/sso?token=${encodeURIComponent(M)}&redirect=${encodeURIComponent(H)}`);return}let J=!1;return fetch("/api/auth/me",{credentials:"same-origin"}).then(H=>H.ok?H.json():null).then(H=>{J||!H||(h(H.role),m(H.identity),w(!0),l.loadFromServer())}).catch(()=>{}),()=>{J=!0}},[]);const D=ag.filter(V=>!V.adminOnly||d==="admin"),_=Z0(d==="admin");f.useEffect(()=>{p&&(D.find(V=>V.id===g)||k("temp"))},[d,p]);const z=async()=>{try{await fetch("/api/auth/logout",{method:"POST",credentials:"same-origin"})}catch{}w(!1),h("staff"),k("temp")};if(!p)return n.jsx(Wp,{clinicName:l.data.clinicSettings.name});const F=async V=>
428{const M=await l.deleteDoctorCascade(V);M.ok||c(M.error==="conflict"?"他の変更と競合しました。もう一度お試しください":`削除に失敗しました: ${M.error}`,"error")};return n.jsxs("div",{className:"min-h-screen bg-gray-50 text-gray-800 font-sans pb-12",children:[n.jsx("header",{className:"bg-white shadow-sm sticky top-0 z-40 pt-safe-header",children:n.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-4 flex flex-col gap-4",children:[n.jsxs("div",{className:"flex items-center justify-between gap-4 min-w-0",children:[n.jsxs("h1",{className:"text-xl font-bold text-accent-fg-strong flex items-center gap-2 min-w-0 truncate",children:[n.jsx(Do,{className:"w-6 h-6 flex-shrink-0","aria-hidden":!0}),n.jsx("span",{className:"truncate",children:l.data.clinicSettings.name}),n.jsx("span",{className:"hidden sm:inline whitespace-nowrap",children:"外来診療予定&お知らせ管理"})]}),n.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[n.jsxs("div",{className:`hidden sm:flex items-center gap-1.5 text-xs font-medium px-2.5 py-1.5 rounded-full border
429                ${d==="admin"?"bg-accent-subtle text-accent-hover border-accent-border":"bg-gray-50 text-gray-600 border-gray-200"}`,children:[d==="admin"?n.jsx(Mp,{className:"w-3.5 h-3.5"}):n.jsx(Fo,{className:"w-3.5 h-3.5"}),d==="admin"?"管理者":"スタッフ"]}),l.isDirty?n.jsx("span",{className:"hidden sm:inline text-xs font-medium text-amber-700 bg-amber-50 border border-amber-200 rounded-full px-2.5 py-1.5",children:"未保存の変更あり"}):l.lastSavedAt?n.jsxs("span",{className:"hidden sm:inline text-xs text-gray-500",children:["最終保存: ",new Date(l.lastSavedAt).toLocaleTimeString("ja-JP",{hour:"2-digit",minute:"2-digit"})]}):null,n.jsxs("button",{onClick:z,"aria-label":"ログアウト",className:"flex items-center gap-1.5 text-sm text-gray-500 hover:text-gray-800 border border-gray-200 hover:border-gray-300 px-3 py-1.5 rounded-lg transition-colors",children:[n.jsx(_p,{className:"w-4 h-4","aria-hidden":!0}),n.jsx("span",{className:"hidden sm:inline",children:"ログアウト"})]})]})]}),n.jsx("nav",{"aria-label":"メインタブ",className:"self-start max-w-full",children:n.jsx(Qt,{fadeFrom:"from-gray-100",children:n.jsx("div",{className:"flex bg-gray-100 rounded-lg p-1 overflow-x-auto hide-scrollbar touch-pan-x overscroll-x-contain",style:{touchAction:"pan-x"},children:D.flatMap((V,M)=>{const J=[];return M>0&&V.group!==D[M-1].group&&J.push(n.jsx("div",{className:"w-px bg-gray-200 mx-1 self-stretch","aria-hidden":"true"},`divider-${V.id}`)),J.push(n.jsxs("button",{onClick:()=>k(V.id),"aria-current":g===V.id?"page":void 0,className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-medium whitespace-nowrap transition-colors
430                        ${g===V.id?"bg-white shadow text-accent-fg":"text-gray-600 hover:text-gray-900"}`,children:[V.icon," ",V.label,V.id==="urgent"&&_>0&&n.jsx("span",{className:"inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1 rounded-full bg-red-600 text-white text-xs font-bold",children:_})]},V.id)),J})})})})]})}),_>0&&g!=="urgent"&&n.jsx("div",{className:"bg-red-50 border-b border-red-200",children:n.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-2 flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("span",{className:"text-sm text-red-700",children:["臨時お知らせに要対応が ",_," 件あります"]}),n.jsx(le,{variant:"secondary",size:"sm",className:"min-h-11",onClick:()=>k("urgent"),children:"確認する"})]})}),l.showRestoreBanner&&n.jsx("div",{className:"bg-amber-50 border-b border-amber-200",children:n.jsxs("div",{className:"max-w-6xl mx-auto px-4 py-2.5 flex flex-wrap items-center justify-between gap-2",children:[n.jsx("span",{className:"text-sm text-amber-800",children:"前回保存されていない編集が残っています。復元しますか?"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{variant:"secondary",size:"sm",onClick:l.discardDraft,children:"破棄する"}),n.jsx(le,{variant:"primary",size:"sm",onClick:l.restoreDraft,children:"復元する"})]})]})}),n.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[g==="temp"&&n.jsxs("div",{className:"space-y-6",children:[n.jsx(sg,{}),n.jsx(Gp,{exceptions:l.data.exceptions,saveExceptions:l.saveExceptions,doctors:l.data.doctors,onOpenModal:N,userRole:d})]}),g==="urgent"&&n.jsx(G0,{isAdmin:d==="admin",currentUserIdentity:x}),g==="announcement"&&n.jsx(Xp,{announcement:l.data.announcement,setAnnouncement:l.setAnnouncement,saveAnnouncement:l.saveAnnouncement,isAnnouncementDirty:l.isAnnouncementDirty}),g==="preview"&&n.jsx(ch,{...l.data,holidays:o,currentDate:R,setCurrentDate:T,onDateClick:(V,M)=>{const J=ah(V,M,l.data.weeklySchedule,l.data.exceptions,o);N(J.existing?{initialData:J.existing}:{initialDate:V,initialTime:M,initialType:J.type,initialDoctors:J.doctors})}}),g==="delivery"&&d==="admin"&&n.jsx(ax,{...l.data,holidays:o,set
430LinePrompt:l.setLinePrompt,setWpPrompt:l.setWpPrompt,setDeliverySettings:l.setDeliverySettings,saveDelivery:l.saveDelivery,clearPendingMessages:l.clearPendingMessages,loadFromServer:l.loadFromServer,setScheduledLine:l.setScheduledLine,initialSegment:b?"archive":"create",onInitialSegmentConsumed:()=>v(!1)}),g==="phone"&&n.jsx(Hx,{}),g==="callLog"&&n.jsx(l0,{}),g==="chatbot"&&n.jsx(u0,{}),g==="basic"&&d==="admin"&&n.jsx(ux,{data:l.data,setClinicSettings:l.setClinicSettings,saveClinicSettings:l.saveClinicSettings,isClinicSettingsDirty:l.isClinicSettingsDirty,saveWeeklySchedule:l.saveWeeklySchedule,saveDoctors:l.saveDoctors,onDeleteDoctor:F})]}),j&&n.jsx(Qp,{initialData:j.initialData,initialDate:j.initialDate,initialTime:j.initialTime,initialType:j.initialType,initialDoctors:j.initialDoctors,exceptions:l.data.exceptions,saveExceptions:l.saveExceptions,doctors:l.data.doctors,onClose:()=>N(null)})]})}const ig=6e4;async function og(){try{const l=await fetch(`/version.json?t=${Date.now()}`,{cache:"no-store",credentials:"omit"});if(!l.ok)return null;const o=await l.json();return typeof o.version=="string"?o.version:null}catch{return null}}function cg(){const[l,o]=f.useState(!1),c="1790843324390",d=f.useRef(null),h=f.useCallback(async()=>{const m=await og();m&&m!==c&&o(!0)},[c]);f.useEffect(()=>{h();const m=()=>{d.current===null&&(d.current=window.setInterval(()=>{document.visibilityState==="visible"&&h()},ig))},p=()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},w=()=>{document.visibilityState==="visible"?(h(),m()):p()},g=()=>void h();return document.visibilityState==="visible"&&m(),document.addEventListener("visibilitychange",w),window.addEventListener("focus",g),()=>{p(),document.removeEventListener("visibilitychange",w),window.removeEventListener("focus",g)}},[h]);const x=f.useCallback(async()=>{try{if("serviceWorker"in navigator){const m=await navigator.serviceWorker.getRegistrations();await Promise.all(m.map(async p=>{var w;try{await p.update()}catch{}(w=p.waiting)==null||w.postMessage({type:"SKIP_WAITING"})}))}}catch{}window.location.reload()},[]);return{updateAvailable:l,applyUpdate:x}}function ug(){const[l,o]=f.useState(!1);return f.useEffect(()=>{const c=d=>{const h=d.detail;o(!!(h!=null&&h.isDirty))};return window.addEventListener("cc:dirty-change",c),()=>window.removeEventListener("cc:dirty-change",c)},[]),l}const dg=8e3;function fg(){const{updateAvailable:l,applyUpdate:o}=cg(),c=ug(),[d,h]=f.useState(!1),[x,m]=f.useState(!1),[p,w]=f.useState(!1);if(!l)return null;const g=async()=>{d||(h(!0),window.dispatchEvent(new CustomEvent("cc:suppress-unload-guard")),await o())},k=()=>{if(x||d)return;w(!1),m(!0);let j=!1;const N=window.setTimeout(()=>{j||(j=!0,window.removeEventListener("cc:save-result",R),m(!1),w(!0))},dg),R=T=>{if(j)return;j=!0,window.clearTimeout(N),window.removeEventListener("cc:save-result",R);const b=T.detail;m(!1),b!=null&&b.success?g():w(!0)};window.addEventListener("cc:save-result",R),window.dispatchEvent(new CustomEvent("cc:request-save"))};return n.jsx("div",{className:"fixed left-1/2 -translate-x-1/2 z-[9999] px-4 pointer-events-none",style:{top:"max(env(safe-area-inset-top, 0px), 12px)"},role:"status","aria-live":"polite",children:c?n.jsxs("div",{className:"pointer-events-auto flex flex-col gap-2 px-4 py-3 rounded-2xl shadow-lg bg-white border border-gray-200",children:[n.jsx("span",{className:"text-sm font-medium text-gray-800",children:"新しいバージョンがあります。未保存の変更があります。"}),p&&n.jsx("span",{className:"text-xs text-semantic-error",children:"保存に失敗しました。もう一度お試しください。"}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("button",{type:"button",onClick:k,disabled:x||d,className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-[13px] font-bold transition-colors disabled:opacity-70 bg-accent text-white hover:bg-accent-hover",children:x?"保存中…":"保存してから更新"}),n.jsx("button",{type:"button",onClick:g,disabled:d,className:"flex items-center gap-1.5 px-3.5 py-1.5 rounded-full text-[13px] font-bold transition-colors disabled:opacity-70 bg-gray-100 text-gray-700 hover:bg-gray-200 border border-gray-200",children:d?"更新中…":"更新する"})]})]}):n.jsxs("button",{type:"button",onClick:g,disabled:d,className:"pointer-events-auto flex items-center gap-3 px-4 py-2.5 rounded-full shadow-lg text-sm font-medium transition-opacity disabled:opacity-70 bg-accent text-white border border-black/5 hover:bg-accent-hover",children:[n.jsx("span",{"aria-hidden":"true",children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:[n.jsx("path",{d:"M21 12a9 9 0 1 1-3.05-6.74"}),n.jsx("path",{d:"M21 4v6h-6"})]})}),n.jsx("span",{children:d?"更新中…":"新しいバージョンがあります — タップで更新"})]})})}function mg({children:l}){const[o,c]=f.useState(null),[d,h]=f.useState(""),x=f.useRef(null),m=f.useCallback(j=>new Promise(N=>
430{x.current=N,h(""),c(j)}),[]),p=f.useCallback(j=>{const N=x.current;x.current=null,c(null),N==null||N(j)},[]),w=!(o!=null&&o.requireTypedText)||d===o.requireTypedText;f.useEffect(()=>{if(!o)return;const j=N=>{N.key==="Escape"&&p(!1)};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[o,p]);const k=((o==null?void 0:o.tone)??"danger")==="warn"?{text:"text-amber-700",btn:"bg-amber-700 hover:bg-amber-800",icon:"text-amber-600"}:{text:"text-rose-700",btn:"bg-rose-600 hover:bg-rose-700",icon:"text-rose-600"};return n.jsxs(df.Provider,{value:m,children:[l,o&&Ho.createPortal(n.jsx("div",{className:"fixed inset-0 z-[100] bg-stone-900/50 flex items-center justify-center p-4",role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onClick:()=>p(!1),children:n.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full p-5 space-y-4",onClick:j=>j.stopPropagation(),children:[n.jsxs("h3",{id:"confirm-dialog-title",className:`text-lg font-semibold flex items-center gap-2 ${k.text}`,children:[n.jsx(xr,{size:18,className:k.icon,"aria-hidden":!0})," ",o.title]}),o.message!=null&&n.jsx("div",{className:"text-sm text-stone-700 whitespace-pre-wrap leading-relaxed",children:o.message}),o.requireTypedText!=null&&n.jsxs("label",{className:"block text-sm text-stone-700 space-y-1",children:[n.jsx("span",{children:o.typedTextLabel??`確認のため「${o.requireTypedText}」を入力してください`}),n.jsx("input",{type:"text",autoFocus:!0,value:d,onChange:j=>h(j.target.value),className:"w-full px-3 py-2 min-h-11 rounded border border-stone-300 text-sm"})]}),n.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[n.jsx("button",{type:"button",autoFocus:o.requireTypedText==null,onClick:()=>p(!1),className:"px-4 py-2 min-h-11 rounded border border-stone-300 text-sm text-stone-700 hover:bg-stone-50",children:o.cancelLabel??"キャンセル"}),n.jsx("button",{type:"button",disabled:!w,onClick:()=>p(!0),className:`px-4 py-2 min-h-11 rounded text-white text-sm ${k.btn} disabled:opacity-40 disabled:cursor-not-allowed`,children:o.confirmLabel??"実行する"})]})]})}),document.body)]})}const pg={success:"bg-semantic-success text-white",error:"bg-semantic-error text-white",info:"bg-gray-800 text-white"},hg={success:Ot,error:Ro,info:sf},xg=3500;function gg({children:l}){const[o,c]=f.useState([]),d=f.useRef(0),h=f.useCallback(m=>{c(p=>p.filter(w=>w.id!==m))},[]),x=f.useCallback((m,p="success",w)=>{const g=++d.current;c(k=>[...k,{id:g,message:m,tone:p,action:w==null?void 0:w.action}]),setTimeout(()=>h(g),(w==null?void 0:w.durationMs)??xg)},[h]);return n.jsxs(uf.Provider,{value:x,children:[l,Ho.createPortal(n.jsx("div",{className:"fixed left-1/2 -translate-x-1/2 z-[9998] flex flex-col items-center gap-2 px-4 pointer-events-none",style:{bottom:"max(env(safe-area-inset-bottom, 0px), 16px)"},role:"status","aria-live":"polite",children:o.map(m=>{const p=hg[m.tone];return n.jsxs("div",{className:`pointer-events-auto flex items-center gap-2 px-4 py-2.5 rounded-full shadow-lg text-sm font-medium ${pg[m.tone]}`,children:[n.jsx(p,{className:"w-4 h-4 flex-shrink-0","aria-hidden":!0}),n.jsx("span",{children:m.message}),m.action&&n.jsx("button",{type:"button",onClick:()=>{m.action.onClick(),h(m.id)},className:"ml-1 underline underline-offset-2 font-bold hover:opacity-80",children:m.action.label})]},m.id)})}),document.body)]})}pp.createRoot(document.getElementById("root")).render(n.jsx(f.StrictMode,{children:n.jsx(gg,{children:n.jsxs(mg,{children:[n.jsx(fg,{}),n.jsx(lg,{})]})})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.