1 line
90 KiB
JavaScript
1 line
90 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,23951,42469,62345,432,76637,e=>{"use strict";let r,n;var a,i,l,s,o=e.i(36792),h=e.i(34346),d=e.i(9991),c=e.i(77627),f=e.i(75985),u=e.i(35904),g=e.i(50314),m=e.i(49326),m=m,p=e.i(21446),w=e.i(27706);let x=(0,w.default)("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);var v=e.i(43359);let y=(0,w.default)("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);e.s(["Images",()=>y],42469);var b=e.i(27458),A=e.i(10743),C=e.i(59786),j=e.i(90432),I=e.i(26922),N=e.i(41610);let F=(0,w.default)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),U=(0,w.default)("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);var D=e.i(76584);let E="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),S=new Uint8Array(16),M=[];for(let e=0;e<256;++e)M.push((e+256).toString(16).slice(1));let R=function(e,n,a){if(E&&!n&&!e)return E();var i=e,l=a;let s=(i=i||{}).random??i.rng?.()??function(){if(!r){if("undefined"==typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");r=crypto.getRandomValues.bind(crypto)}return r(S)}();if(s.length<16)throw Error("Random bytes length must be >= 16");if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,n){if((l=l||0)<0||l+16>n.length)throw RangeError(`UUID byte range ${l}:${l+15} is out of buffer bounds`);for(let e=0;e<16;++e)n[l+e]=s[e];return n}return function(e,r=0){return(M[e[r+0]]+M[e[r+1]]+M[e[r+2]]+M[e[r+3]]+"-"+M[e[r+4]]+M[e[r+5]]+"-"+M[e[r+6]]+M[e[r+7]]+"-"+M[e[r+8]]+M[e[r+9]]+"-"+M[e[r+10]]+M[e[r+11]]+M[e[r+12]]+M[e[r+13]]+M[e[r+14]]+M[e[r+15]]).toLowerCase()}(s)};var _=h,B=Object.defineProperty,k=(e,r,n)=>{let a;return(a="symbol"!=typeof r?r+"":r)in e?B(e,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[a]=n};let L={x:0,y:0,width:0,height:0,unit:"px"},T=(e,r,n)=>Math.min(Math.max(e,r),n),P=(e,r)=>e===r||e.width===r.width&&e.height===r.height&&e.x===r.x&&e.y===r.y&&e.unit===r.unit;function O(e,r,n){return"%"===e.unit?{...L,...e,unit:"%"}:{unit:"%",x:e.x?e.x/r*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/r*100:0,height:e.height?e.height/n*100:0}}function H(e,r,n){return e.unit?"px"===e.unit?{...L,...e,unit:"px"}:{unit:"px",x:e.x?e.x*r/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*r/100:0,height:e.height?e.height*n/100:0}:{...L,...e,unit:"px"}}function Q(e,r,n,a,i,l=0,s=0,o=a,h=i){let d={...e},c=Math.min(l,a),f=Math.min(s,i),u=Math.min(o,a),g=Math.min(h,i);r&&(r>1?(f=(c=s?s*r:c)/r,u=o*r):(c=(f=l?l/r:f)*r,g=h/r)),d.y<0&&(d.height=Math.max(d.height+d.y,f),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,c),d.x=0);let m=a-(d.x+d.width);m<0&&(d.x=Math.min(d.x,a-c),d.width+=m);let p=i-(d.y+d.height);if(p<0&&(d.y=Math.min(d.y,i-f),d.height+=p),d.width<c&&(("sw"===n||"nw"==n)&&(d.x-=c-d.width),d.width=c),d.height<f&&(("nw"===n||"ne"==n)&&(d.y-=f-d.height),d.height=f),d.width>u&&(("sw"===n||"nw"==n)&&(d.x-=u-d.width),d.width=u),d.height>g&&(("nw"===n||"ne"==n)&&(d.y-=g-d.height),d.height=g),r){let e=d.width/d.height;if(e<r){let e=Math.max(d.width/r,f);("nw"===n||"ne"==n)&&(d.y-=e-d.height),d.height=e}else if(e>r){let e=Math.max(d.height*r,c);("sw"===n||"nw"==n)&&(d.x-=e-d.width),d.width=e}}return d}let z={capture:!0,passive:!1},X=0,$=class e extends _.PureComponent{constructor(){super(...arguments),k(this,"docMoveBound",!1),k(this,"mouseDownOnCrop",!1),k(this,"dragStarted",!1),k(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),k(this,"componentRef",(0,_.createRef)()),k(this,"mediaRef",(0,_.createRef)()),k(this,"resizeObserver"),k(this,"initChangeCalled",!1),k(this,"instanceId",`rc-${X++}`),k(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),k(this,"onCropPointerDown",e=>{let{crop:r,disabled:n}=this.props,a=this.getBox();if(!r)return;let i=H(r,a.width,a.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let l=e.target.dataset.ord,s=e.clientX,o=e.clientY,h=i.x,d=i.y;if(l){let r=e.clientX-a.x,n=e.clientY-a.y,c=0,f=0;"ne"===l||"e"==l?(c=r-(i.x+i.width),f=n-i.y,h=i.x,d=i.y+i.height):"se"===l||"s"===l?(c=r-(i.x+i.width),f=n-(i.y+i.height),h=i.x,d=i.y):"sw"===l||"w"==l?(c=r-i.x,f=n-(i.y+i.height),h=i.x+i.width,d=i.y):("nw"===l||"n"==l)&&(c=r-i.x,f=n-i.y,h=i.x+i.width,d=i.y+i.height),s=h+a.x+c,o=d+a.y+f}this.evData={startClientX:s,startClientY:o,startCropX:h,startCropY:d,clientX:e.clientX,clientY:e.clientY,isResize:!!l,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),k(this,"onComponentPointerDown",e=>{let{crop:r,disabled:n,locked:a,keepSelection:i,onChange:l}=this.props,s=this.getBox();if(n||a||i&&r)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});let o=e.clientX-s.x,h=e.clientY-s.y,d={unit:"px",x:o,y:h,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:o,startCropY:h,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(H(d,s.width,s.height),O(d,s.width,s.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),k(this,"onDocPointerMove",e=>{let r,{crop:n,disabled:a,onChange:i,onDragStart:l}=this.props,s=this.getBox();if(a||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,l&&l(e));let{evData:o}=this;o.clientX=e.clientX,o.clientY=e.clientY,P(n,r=o.isResize?this.resizeCrop():this.dragCrop())||i(H(r,s.width,s.height),O(r,s.width,s.height))}),k(this,"onComponentKeyDown",r=>{let{crop:n,disabled:a,onChange:i,onComplete:l}=this.props;if(a)return;let s=r.key,o=!1;if(!n)return;let h=this.getBox(),d=this.makePixelCrop(h),c=(navigator.platform.match("Mac")?r.metaKey:r.ctrlKey)?e.nudgeStepLarge:r.shiftKey?e.nudgeStepMedium:e.nudgeStep;if("ArrowLeft"===s?(d.x-=c,o=!0):"ArrowRight"===s?(d.x+=c,o=!0):"ArrowUp"===s?(d.y-=c,o=!0):"ArrowDown"===s&&(d.y+=c,o=!0),o){r.cancelable&&r.preventDefault(),d.x=T(d.x,0,h.width-d.width),d.y=T(d.y,0,h.height-d.height);let e=H(d,h.width,h.height),n=O(d,h.width,h.height);i(e,n),l&&l(e,n)}}),k(this,"onHandlerKeyDown",(r,n)=>{var a,i;let l,{aspect:s=0,crop:o,disabled:h,minWidth:d=0,minHeight:c=0,maxWidth:f,maxHeight:u,onChange:g,onComplete:m}=this.props,p=this.getBox();if(h||!o||"ArrowUp"!==r.key&&"ArrowDown"!==r.key&&"ArrowLeft"!==r.key&&"ArrowRight"!==r.key)return;r.stopPropagation(),r.preventDefault();let w=(navigator.platform.match("Mac")?r.metaKey:r.ctrlKey)?e.nudgeStepLarge:r.shiftKey?e.nudgeStepMedium:e.nudgeStep,x=Q((a=H(o,p.width,p.height),i=r.key,l={...a},"ArrowLeft"===i?"nw"===n?(l.x-=w,l.y-=w,l.width+=w,l.height+=w):"w"===n?(l.x-=w,l.width+=w):"sw"===n?(l.x-=w,l.width+=w,l.height+=w):"ne"===n?(l.y+=w,l.width-=w,l.height-=w):"e"===n?l.width-=w:"se"===n&&(l.width-=w,l.height-=w):"ArrowRight"===i&&("nw"===n?(l.x+=w,l.y+=w,l.width-=w,l.height-=w):"w"===n?(l.x+=w,l.width-=w):"sw"===n?(l.x+=w,l.width-=w,l.height-=w):"ne"===n?(l.y-=w,l.width+=w,l.height+=w):"e"===n?l.width+=w:"se"===n&&(l.width+=w,l.height+=w)),"ArrowUp"===i?"nw"===n?(l.x-=w,l.y-=w,l.width+=w,l.height+=w):"n"===n?(l.y-=w,l.height+=w):"ne"===n?(l.y-=w,l.width+=w,l.height+=w):"sw"===n?(l.x+=w,l.width-=w,l.height-=w):"s"===n?l.height-=w:"se"===n&&(l.width-=w,l.height-=w):"ArrowDown"===i&&("nw"===n?(l.x+=w,l.y+=w,l.width-=w,l.height-=w):"n"===n?(l.y+=w,l.height-=w):"ne"===n?(l.y+=w,l.width-=w,l.height-=w):"sw"===n?(l.x-=w,l.width+=w,l.height+=w):"s"===n?l.height+=w:"se"===n&&(l.width+=w,l.height+=w)),l),s,n,p.width,p.height,d,c,f,u);if(!P(o,x)){let e=O(x,p.width,p.height);g(x,e),m&&m(x,e)}}),k(this,"onDocPointerDone",e=>{let{crop:r,disabled:n,onComplete:a,onDragEnd:i}=this.props,l=this.getBox();this.unbindDocMove(),!(n||!r)&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,i&&i(e),a&&a(H(r,l.width,l.height),O(r,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),k(this,"onDragFocus",()=>{var e;null==(e=this.componentRef.current)||e.scrollTo(0,0)})}get document(){return document}getBox(){let e=this.mediaRef.current;if(!e)return{x:0,y:0,width:0,height:0};let{x:r,y:n,width:a,height:i}=e.getBoundingClientRect();return{x:r,y:n,width:a,height:i}}componentDidUpdate(e){let{crop:r,onComplete:n}=this.props;if(n&&!e.crop&&r){let{width:e,height:a}=this.getBox();e&&a&&n(H(r,e,a),O(r,e,a))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,z),this.document.addEventListener("pointerup",this.onDocPointerDone,z),this.document.addEventListener("pointercancel",this.onDocPointerDone,z),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,z),this.document.removeEventListener("pointerup",this.onDocPointerDone,z),this.document.removeEventListener("pointercancel",this.onDocPointerDone,z),this.docMoveBound=!1)}getCropStyle(){let{crop:e}=this.props;if(e)return{top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){let{evData:e}=this,r=this.getBox(),n=this.makePixelCrop(r),a=e.clientX-e.startClientX,i=e.clientY-e.startClientY;return n.x=T(e.startCropX+a,0,r.width-n.width),n.y=T(e.startCropY+i,0,r.height-n.height),n}getPointRegion(e,r,n,a){let i,{evData:l}=this,s=l.clientX-e.x,o=l.clientY-e.y;return i=a&&r?"nw"===r||"n"===r||"ne"===r:o<l.startCropY,(n&&r?"nw"===r||"w"===r||"sw"===r:s<l.startCropX)?i?"nw":"sw":i?"ne":"se"}resolveMinDimensions(e,r,n=0,a=0){let i=Math.min(n,e.width),l=Math.min(a,e.height);return r&&(i||l)?r>1?i?[i,i/r]:[l*r,l]:l?[l*r,l]:[i,i/r]:[i,l]}resizeCrop(){let{evData:r}=this,{aspect:n=0,maxWidth:a,maxHeight:i}=this.props,l=this.getBox(),[s,o]=this.resolveMinDimensions(l,n,this.props.minWidth,this.props.minHeight),h=this.makePixelCrop(l),d=this.getPointRegion(l,r.ord,s,o),c=r.ord||d,f=r.clientX-r.startClientX,u=r.clientY-r.startClientY;(s&&"nw"===c||"w"===c||"sw"===c)&&(f=Math.min(f,-s)),(o&&"nw"===c||"n"===c||"ne"===c)&&(u=Math.min(u,-o));let g={unit:"px",x:0,y:0,width:0,height:0};"ne"===d?(g.x=r.startCropX,g.width=f,n?g.height=g.width/n:g.height=Math.abs(u),g.y=r.startCropY-g.height):"se"===d?(g.x=r.startCropX,g.y=r.startCropY,g.width=f,n?g.height=g.width/n:g.height=u):"sw"===d?(g.x=r.startCropX+f,g.y=r.startCropY,g.width=Math.abs(f),n?g.height=g.width/n:g.height=u):"nw"===d&&(g.x=r.startCropX+f,g.width=Math.abs(f),n?(g.height=g.width/n,g.y=r.startCropY-g.height):(g.height=Math.abs(u),g.y=r.startCropY+u));let m=Q(g,n,d,l.width,l.height,s,o,a,i);return n||e.xyOrds.indexOf(c)>-1?h=m:e.xOrds.indexOf(c)>-1?(h.x=m.x,h.width=m.width):e.yOrds.indexOf(c)>-1&&(h.y=m.y,h.height=m.height),h.x=T(h.x,0,l.width-h.width),h.y=T(h.y,0,l.height-h.height),h}renderCropSelection(){let{ariaLabels:r=e.defaultProps.ariaLabels,disabled:n,locked:a,renderSelectionAddon:i,ruleOfThirds:l,crop:s}=this.props,o=this.getCropStyle();if(s)return _.default.createElement("div",{style:o,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":r.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!a&&_.default.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},_.default.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),_.default.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),_.default.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),_.default.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":r.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":r.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":r.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":r.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":r.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":r.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":r.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),_.default.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":r.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),i&&_.default.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:e=>e.stopPropagation()},i(this.state)),l&&_.default.createElement(_.default.Fragment,null,_.default.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),_.default.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){return H({...L,...this.props.crop||{}},e.width,e.height)}render(){let{aspect:e,children:r,circularCrop:n,className:a,crop:i,disabled:l,locked:s,style:o,ruleOfThirds:h}=this.props,{cropIsActive:d,newCropIsBeingDrawn:c}=this.state,f=i?this.renderCropSelection():null,u=((...e)=>e.filter(e=>e&&"string"==typeof e).join(" "))("ReactCrop",a,d&&"ReactCrop--active",l&&"ReactCrop--disabled",s&&"ReactCrop--locked",c&&"ReactCrop--new-crop",i&&e&&"ReactCrop--fixed-aspect",i&&n&&"ReactCrop--circular-crop",i&&h&&"ReactCrop--rule-of-thirds",!this.dragStarted&&i&&!i.width&&!i.height&&"ReactCrop--invisible-crop",n&&"ReactCrop--no-animate");return _.default.createElement("div",{ref:this.componentRef,className:u,style:o},_.default.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},r),i?_.default.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},_.default.createElement("defs",null,_.default.createElement("mask",{id:`hole-${this.instanceId}`},_.default.createElement("rect",{width:"100%",height:"100%",fill:"white"}),n?_.default.createElement("ellipse",{cx:`${i.x+i.width/2}${i.unit}`,cy:`${i.y+i.height/2}${i.unit}`,rx:`${i.width/2}${i.unit}`,ry:`${i.height/2}${i.unit}`,fill:"black"}):_.default.createElement("rect",{x:`${i.x}${i.unit}`,y:`${i.y}${i.unit}`,width:`${i.width}${i.unit}`,height:`${i.height}${i.unit}`,fill:"black"}))),_.default.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,f)}};function K(e,r){return new Promise(function(n,a){let i;return Y(e).then(function(e){try{return i=e,n(new Blob([r.slice(0,2),i,r.slice(2)],{type:"image/jpeg"}))}catch(e){return a(e)}},a)})}k($,"xOrds",["e","w"]),k($,"yOrds",["n","s"]),k($,"xyOrds",["nw","ne","se","sw"]),k($,"nudgeStep",1),k($,"nudgeStepMedium",10),k($,"nudgeStepLarge",100),k($,"defaultProps",{ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}});let Y=e=>new Promise((r,n)=>{let a=new FileReader;a.addEventListener("load",({target:{result:e}})=>{let a=new DataView(e),i=0;if(65496!==a.getUint16(i))return n("not a valid JPEG");for(i+=2;;){let l=a.getUint16(i);if(65498===l)break;let s=a.getUint16(i+2);if(65505===l&&0x45786966===a.getUint32(i+4)){let l,o=i+10;switch(a.getUint16(o)){case 18761:l=!0;break;case 19789:l=!1;break;default:return n("TIFF header contains invalid endian")}if(42!==a.getUint16(o+2,l))return n("TIFF header contains invalid version");let h=a.getUint32(o+4,l),d=o+h+2+12*a.getUint16(o+h,l);for(let e=o+h+2;e<d;e+=12)if(274==a.getUint16(e,l)){if(3!==a.getUint16(e+2,l))return n("Orientation data type is invalid");if(1!==a.getUint32(e+4,l))return n("Orientation data count is invalid");a.setUint16(e+8,1,l);break}return r(e.slice(i,i+2+s))}i+=2+s}return r(new Blob)}),a.readAsArrayBuffer(e)});var W={};({get exports(){return W},set exports(t){W=t}}).exports=l={},l.parse=function(e,r){for(var n=l.bin.readUshort,a=l.bin.readUint,i=0,s={},o=new Uint8Array(e),h=o.length-4;0x6054b50!=a(o,h);)h--;var d=n(o,i=h+4+4);n(o,i+=2);var c=a(o,i+=2),f=a(o,i+=4);i+=4,i=f;for(var u=0;u<d;u++){a(o,i),i+=4,i+=4,i+=4,a(o,i+=4),c=a(o,i+=4);var g=a(o,i+=4),m=n(o,i+=4),p=n(o,i+2),w=n(o,i+4);i+=6;var x=a(o,i+=8);i+=4,i+=m+p+w,l._readLocal(o,x,s,c,g,r)}return s},l._readLocal=function(e,r,n,a,i,s){var o=l.bin.readUshort,h=l.bin.readUint;h(e,r),o(e,r+=4),o(e,r+=2);var d=o(e,r+=2);h(e,r+=2),h(e,r+=4),r+=4;var c=o(e,r+=8),f=o(e,r+=2);r+=2;var u=l.bin.readUTF8(e,r,c);if(r+=c,r+=f,s)n[u]={size:i,csize:a};else{var g=new Uint8Array(e.buffer,r);if(0==d)n[u]=new Uint8Array(g.buffer.slice(r,r+a));else{if(8!=d)throw"unknown compression method: "+d;var m=new Uint8Array(i);l.inflateRaw(g,m),n[u]=m}}},l.inflateRaw=function(e,r){return l.F.inflate(e,r)},l.inflate=function(e,r){return e[0],e[1],l.inflateRaw(new Uint8Array(e.buffer,e.byteOffset+2,e.length-6),r)},l.deflate=function(e,r){null==r&&(r={level:6});var n=0,a=new Uint8Array(50+Math.floor(1.1*e.length));a[n]=120,a[n+1]=156,n+=2,n=l.F.deflateRaw(e,a,n,r.level);var i=l.adler(e,0,e.length);return a[n+0]=i>>>24&255,a[n+1]=i>>>16&255,a[n+2]=i>>>8&255,a[n+3]=i>>>0&255,new Uint8Array(a.buffer,0,n+4)},l.deflateRaw=function(e,r){null==r&&(r={level:6});var n=new Uint8Array(50+Math.floor(1.1*e.length)),a=l.F.deflateRaw(e,n,a,r.level);return new Uint8Array(n.buffer,0,a)},l.encode=function(e,r){null==r&&(r=!1);var n=0,a=l.bin.writeUint,i=l.bin.writeUshort,s={};for(var o in e){var h=!l._noNeed(o)&&!r,d=e[o],c=l.crc.crc(d,0,d.length);s[o]={cpr:h,usize:d.length,crc:c,file:h?l.deflateRaw(d):d}}for(var o in s)n+=s[o].file.length+30+46+2*l.bin.sizeUTF8(o);var f=new Uint8Array(n+=22),u=0,g=[];for(var o in s){var m=s[o];g.push(u),u=l._writeHeader(f,u,o,m,0)}var p=0,w=u;for(var o in s)m=s[o],g.push(u),u=l._writeHeader(f,u,o,m,1,g[p++]);var x=u-w;return a(f,u,0x6054b50),u+=4,i(f,u+=4,p),i(f,u+=2,p),a(f,u+=2,x),a(f,u+=4,w),u+=4,u+=2,f.buffer},l._noNeed=function(e){var r=e.split(".").pop().toLowerCase();return -1!="png,jpg,jpeg,zip".indexOf(r)},l._writeHeader=function(e,r,n,a,i,s){var o=l.bin.writeUint,h=l.bin.writeUshort,d=a.file;return o(e,r,0==i?0x4034b50:0x2014b50),r+=4,1==i&&(r+=2),h(e,r,20),h(e,r+=2,0),h(e,r+=2,8*!!a.cpr),o(e,r+=2,0),o(e,r+=4,a.crc),o(e,r+=4,d.length),o(e,r+=4,a.usize),h(e,r+=4,l.bin.sizeUTF8(n)),h(e,r+=2,0),r+=2,1==i&&(r+=2,r+=2,o(e,r+=6,s),r+=4),r+=l.bin.writeUTF8(e,r,n),0==i&&(e.set(d,r),r+=d.length),r},l.crc={table:function(){for(var e=new Uint32Array(256),r=0;r<256;r++){for(var n=r,a=0;a<8;a++)1&n?n=0xedb88320^n>>>1:n>>>=1;e[r]=n}return e}(),update:function(e,r,n,a){for(var i=0;i<a;i++)e=l.crc.table[255&(e^r[n+i])]^e>>>8;return e},crc:function(e,r,n){return 0xffffffff^l.crc.update(0xffffffff,e,r,n)}},l.adler=function(e,r,n){for(var a=1,i=0,l=r,s=r+n;l<s;){for(var o=Math.min(l+5552,s);l<o;)i+=a+=e[l++];a%=65521,i%=65521}return i<<16|a},l.bin={readUshort:function(e,r){return e[r]|e[r+1]<<8},writeUshort:function(e,r,n){e[r]=255&n,e[r+1]=n>>8&255},readUint:function(e,r){return 0x1000000*e[r+3]+(e[r+2]<<16|e[r+1]<<8|e[r])},writeUint:function(e,r,n){e[r]=255&n,e[r+1]=n>>8&255,e[r+2]=n>>16&255,e[r+3]=n>>24&255},readASCII:function(e,r,n){for(var a="",i=0;i<n;i++)a+=String.fromCharCode(e[r+i]);return a},writeASCII:function(e,r,n){for(var a=0;a<n.length;a++)e[r+a]=n.charCodeAt(a)},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,r,n){for(var a,i="",s=0;s<n;s++)i+="%"+l.bin.pad(e[r+s].toString(16));try{a=decodeURIComponent(i)}catch(a){return l.bin.readASCII(e,r,n)}return a},writeUTF8:function(e,r,n){for(var a=n.length,i=0,l=0;l<a;l++){var s=n.charCodeAt(l);if(0==(0xffffff80&s))e[r+i]=s,i++;else if(0==(0xfffff800&s))e[r+i]=192|s>>6,e[r+i+1]=128|63&s,i+=2;else if(0==(0xffff0000&s))e[r+i]=224|s>>12,e[r+i+1]=128|s>>6&63,e[r+i+2]=128|63&s,i+=3;else{if(0!=(0xffe00000&s))throw"e";e[r+i]=240|s>>18,e[r+i+1]=128|s>>12&63,e[r+i+2]=128|s>>6&63,e[r+i+3]=128|63&s,i+=4}}return i},sizeUTF8:function(e){for(var r=e.length,n=0,a=0;a<r;a++){var i=e.charCodeAt(a);if(0==(0xffffff80&i))n++;else if(0==(0xfffff800&i))n+=2;else if(0==(0xffff0000&i))n+=3;else{if(0!=(0xffe00000&i))throw"e";n+=4}}return n}},l.F={},l.F.deflateRaw=function(e,r,n,a){var i=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][a],s=l.F.U,o=l.F._goodIndex;l.F._hash;var h=l.F._putsE,d=0,c=n<<3,f=0,u=e.length;if(0==a){for(;d<u;)h(r,c,+(d+(I=Math.min(65535,u-d))==u)),c=l.F._copyExact(e,d,I,r,c+8),d+=I;return c>>>3}var g=s.lits,m=s.strt,p=s.prev,w=0,x=0,v=0,y=0,b=0,A=0;for(u>2&&(m[A=l.F._hash(e,0)]=0),d=0;d<u;d++){if(b=A,d+1<u-2){A=l.F._hash(e,d+1);var C=d+1&32767;p[C]=m[A],m[A]=C}if(f<=d){(w>14e3||x>26697)&&u-d>100&&(f<d&&(g[w]=d-f,w+=2,f=d),c=l.F._writeBlock(+(d==u-1||f==u),g,w,y,e,v,d-v,r,c),w=x=y=0,v=d);var j=0;d<u-2&&(j=l.F._bestMatch(e,d,p,b,Math.min(i[2],u-d),i[3]));var I=j>>>16,N=65535&j;if(0!=j){N=65535&j;var F=o(I=j>>>16,s.of0);s.lhst[257+F]++;var U=o(N,s.df0);s.dhst[U]++,y+=s.exb[F]+s.dxb[U],g[w]=I<<23|d-f,g[w+1]=N<<16|F<<8|U,w+=2,f=d+I}else s.lhst[e[d]]++;x++}}for(v==d&&0!=e.length||(f<d&&(g[w]=d-f,w+=2,f=d),c=l.F._writeBlock(1,g,w,y,e,v,d-v,r,c),w=0,x=0,w=x=y=0,v=d);0!=(7&c);)c++;return c>>>3},l.F._bestMatch=function(e,r,n,a,i,s){var o=32767&r,h=n[o],d=o-h+32768&32767;if(h==o||a!=l.F._hash(e,r-d))return 0;for(var c=0,f=0,u=Math.min(32767,r);d<=u&&0!=--s&&h!=o;){if(0==c||e[r+c]==e[r+c-d]){var g=l.F._howLong(e,r,d);if(g>c){if(f=d,(c=g)>=i)break;d+2<g&&(g=d+2);for(var m=0,p=0;p<g-2;p++){var w=r-d+p+32768&32767,x=w-n[w]+32768&32767;x>m&&(m=x,h=w)}}}d+=(o=h)-(h=n[o])+32768&32767}return c<<16|f},l.F._howLong=function(e,r,n){if(e[r]!=e[r-n]||e[r+1]!=e[r+1-n]||e[r+2]!=e[r+2-n])return 0;var a=r,i=Math.min(e.length,r+258);for(r+=3;r<i&&e[r]==e[r-n];)r++;return r-a},l.F._hash=function(e,r){return(e[r]<<8|e[r+1])+(e[r+2]<<4)&65535},l.saved=0,l.F._writeBlock=function(e,r,n,a,i,s,o,h,d){var c,f,u,g,m,p,w,x,v,y,b,A=l.F.U,C=l.F._putsF,j=l.F._putsE;A.lhst[256]++,g=(u=l.F.getTrees())[0],m=u[1],p=u[2],w=u[3],x=u[4],v=u[5],y=u[6],b=u[7];var I=32+(0==(d+3&7)?0:8-(d+3&7))+(o<<3),N=a+l.F.contSize(A.fltree,A.lhst)+l.F.contSize(A.fdtree,A.dhst),F=a+l.F.contSize(A.ltree,A.lhst)+l.F.contSize(A.dtree,A.dhst);F+=14+3*v+l.F.contSize(A.itree,A.ihst)+(2*A.ihst[16]+3*A.ihst[17]+7*A.ihst[18]);for(var U=0;U<286;U++)A.lhst[U]=0;for(U=0;U<30;U++)A.dhst[U]=0;for(U=0;U<19;U++)A.ihst[U]=0;var D=I<N&&I<F?0:N<F?1:2;if(C(h,d,e),C(h,d+1,D),d+=3,0==D){for(;0!=(7&d);)d++;d=l.F._copyExact(i,s,o,h,d)}else{if(1==D&&(c=A.fltree,f=A.fdtree),2==D){l.F.makeCodes(A.ltree,g),l.F.revCodes(A.ltree,g),l.F.makeCodes(A.dtree,m),l.F.revCodes(A.dtree,m),l.F.makeCodes(A.itree,p),l.F.revCodes(A.itree,p),c=A.ltree,f=A.dtree,j(h,d,w-257),j(h,d+=5,x-1),j(h,d+=5,v-4),d+=4;for(var E=0;E<v;E++)j(h,d+3*E,A.itree[1+(A.ordr[E]<<1)]);d+=3*v,d=l.F._codeTiny(y,A.itree,h,d),d=l.F._codeTiny(b,A.itree,h,d)}for(var S=s,M=0;M<n;M+=2){for(var R=r[M],_=R>>>23,B=S+(8388607&R);S<B;)d=l.F._writeLit(i[S++],c,h,d);if(0!=_){var k=r[M+1],L=k>>16,T=k>>8&255,P=255&k;j(h,d=l.F._writeLit(257+T,c,h,d),_-A.of0[T]),d+=A.exb[T],C(h,d=l.F._writeLit(P,f,h,d),L-A.df0[P]),d+=A.dxb[P],S+=_}}d=l.F._writeLit(256,c,h,d)}return d},l.F._copyExact=function(e,r,n,a,i){var l=i>>>3;return a[l]=n,a[l+1]=n>>>8,a[l+2]=255-a[l],a[l+3]=255-a[l+1],l+=4,a.set(new Uint8Array(e.buffer,r,n),l),i+(n+4<<3)},l.F.getTrees=function(){for(var e=l.F.U,r=l.F._hufTree(e.lhst,e.ltree,15),n=l.F._hufTree(e.dhst,e.dtree,15),a=[],i=l.F._lenCodes(e.ltree,a),s=[],o=l.F._lenCodes(e.dtree,s),h=0;h<a.length;h+=2)e.ihst[a[h]]++;for(h=0;h<s.length;h+=2)e.ihst[s[h]]++;for(var d=l.F._hufTree(e.ihst,e.itree,7),c=19;c>4&&0==e.itree[1+(e.ordr[c-1]<<1)];)c--;return[r,n,d,i,o,c,a,s]},l.F.getSecond=function(e){for(var r=[],n=0;n<e.length;n+=2)r.push(e[n+1]);return r},l.F.nonZero=function(e){for(var r="",n=0;n<e.length;n+=2)0!=e[n+1]&&(r+=(n>>1)+",");return r},l.F.contSize=function(e,r){for(var n=0,a=0;a<r.length;a++)n+=r[a]*e[1+(a<<1)];return n},l.F._codeTiny=function(e,r,n,a){for(var i=0;i<e.length;i+=2){var s=e[i],o=e[i+1];a=l.F._writeLit(s,r,n,a);var h=16==s?2:17==s?3:7;s>15&&(l.F._putsE(n,a,o,h),a+=h)}return a},l.F._lenCodes=function(e,r){for(var n=e.length;2!=n&&0==e[n-1];)n-=2;for(var a=0;a<n;a+=2){var i=e[a+1],l=a+3<n?e[a+3]:-1,s=a+5<n?e[a+5]:-1,o=0==a?-1:e[a-1];if(0==i&&l==i&&s==i){for(var h=a+5;h+2<n&&e[h+2]==i;)h+=2;(d=Math.min(h+1-a>>>1,138))<11?r.push(17,d-3):r.push(18,d-11),a+=2*d-2}else if(i==o&&l==i&&s==i){for(h=a+5;h+2<n&&e[h+2]==i;)h+=2;var d=Math.min(h+1-a>>>1,6);r.push(16,d-3),a+=2*d-2}else r.push(i,0)}return n>>>1},l.F._hufTree=function(e,r,n){var a=[],i=e.length,s=r.length,o=0;for(o=0;o<s;o+=2)r[o]=0,r[o+1]=0;for(o=0;o<i;o++)0!=e[o]&&a.push({lit:o,f:e[o]});var h=a.length,d=a.slice(0);if(0==h)return 0;if(1==h){var c=a[0].lit;return d=+(0==c),r[1+(c<<1)]=1,r[1+(d<<1)]=1,1}a.sort(function(e,r){return e.f-r.f});var f=a[0],u=a[1],g=0,m=1,p=2;for(a[0]={lit:-1,f:f.f+u.f,l:f,r:u,d:0};m!=h-1;)f=g!=m&&(p==h||a[g].f<a[p].f)?a[g++]:a[p++],u=g!=m&&(p==h||a[g].f<a[p].f)?a[g++]:a[p++],a[m++]={lit:-1,f:f.f+u.f,l:f,r:u};var w=l.F.setDepth(a[m-1],0);for(w>n&&(l.F.restrictDepth(d,n,w),w=n),o=0;o<h;o++)r[1+(d[o].lit<<1)]=d[o].d;return w},l.F.setDepth=function(e,r){return -1!=e.lit?(e.d=r,r):Math.max(l.F.setDepth(e.l,r+1),l.F.setDepth(e.r,r+1))},l.F.restrictDepth=function(e,r,n){var a=0,i=1<<n-r,l=0;for(e.sort(function(e,r){return r.d==e.d?e.f-r.f:r.d-e.d}),a=0;a<e.length&&e[a].d>r;a++){var s=e[a].d;e[a].d=r,l+=i-(1<<n-s)}for(l>>>=n-r;l>0;)(s=e[a].d)<r?(e[a].d++,l-=1<<r-s-1):a++;for(;a>=0;a--)e[a].d==r&&l<0&&(e[a].d--,l++);0!=l&&console.log("debt left")},l.F._goodIndex=function(e,r){var n=0;return r[16]<=e&&(n|=16),r[8|n]<=e&&(n|=8),r[4|n]<=e&&(n|=4),r[2|n]<=e&&(n|=2),r[1|n]<=e&&(n|=1),n},l.F._writeLit=function(e,r,n,a){return l.F._putsF(n,a,r[e<<1]),a+r[1+(e<<1)]},l.F.inflate=function(e,r){var n=Uint8Array;if(3==e[0]&&0==e[1])return r||new n(0);var a=l.F,i=a._bitsF,s=a._bitsE,o=a._decodeTiny,h=a.makeCodes,d=a.codes2map,c=a._get17,f=a.U,u=null==r;u&&(r=new n(e.length>>>2<<3));for(var g,m,p=0,w=0,x=0,v=0,y=0,b=0,A=0,C=0,j=0;0==p;)if(p=i(e,j,1),w=i(e,j+1,2),j+=3,0!=w){if(u&&(r=l.F._check(r,C+131072)),1==w&&(g=f.flmap,m=f.fdmap,b=511,A=31),2==w){x=s(e,j,5)+257,v=s(e,j+5,5)+1,y=s(e,j+10,4)+4,j+=14;for(var I=0;I<38;I+=2)f.itree[I]=0,f.itree[I+1]=0;var N=1;for(I=0;I<y;I++){var F=s(e,j+3*I,3);f.itree[1+(f.ordr[I]<<1)]=F,F>N&&(N=F)}j+=3*y,h(f.itree,N),d(f.itree,N,f.imap),g=f.lmap,m=f.dmap,j=o(f.imap,(1<<N)-1,x+v,e,j,f.ttree);var U=a._copyOut(f.ttree,0,x,f.ltree);b=(1<<U)-1;var D=a._copyOut(f.ttree,x,v,f.dtree);A=(1<<D)-1,h(f.ltree,U),d(f.ltree,U,g),h(f.dtree,D),d(f.dtree,D,m)}for(;;){var E=g[c(e,j)&b];j+=15&E;var S=E>>>4;if(S>>>8==0)r[C++]=S;else{if(256==S)break;var M=C+S-254;if(S>264){var R=f.ldef[S-257];M=C+(R>>>3)+s(e,j,7&R),j+=7&R}var _=m[c(e,j)&A];j+=15&_;var B=_>>>4,k=f.ddef[B],L=(k>>>4)+i(e,j,15&k);for(j+=15&k,u&&(r=l.F._check(r,C+131072));C<M;)r[C]=r[C++-L],r[C]=r[C++-L],r[C]=r[C++-L],r[C]=r[C++-L];C=M}}}else{0!=(7&j)&&(j+=8-(7&j));var T=4+(j>>>3),P=e[T-4]|e[T-3]<<8;u&&(r=l.F._check(r,C+P)),r.set(new n(e.buffer,e.byteOffset+T,P),C),j=T+P<<3,C+=P}return r.length==C?r:r.slice(0,C)},l.F._check=function(e,r){var n=e.length;if(r<=n)return e;var a=new Uint8Array(Math.max(n<<1,r));return a.set(e,0),a},l.F._decodeTiny=function(e,r,n,a,i,s){for(var o=l.F._bitsE,h=l.F._get17,d=0;d<n;){var c=e[h(a,i)&r];i+=15&c;var f=c>>>4;if(f<=15)s[d]=f,d++;else{var u=0,g=0;16==f?(g=3+o(a,i,2),i+=2,u=s[d-1]):17==f?(g=3+o(a,i,3),i+=3):18==f&&(g=11+o(a,i,7),i+=7);for(var m=d+g;d<m;)s[d]=u,d++}}return i},l.F._copyOut=function(e,r,n,a){for(var i=0,l=0,s=a.length>>>1;l<n;){var o=e[l+r];a[l<<1]=0,a[1+(l<<1)]=o,o>i&&(i=o),l++}for(;l<s;)a[l<<1]=0,a[1+(l<<1)]=0,l++;return i},l.F.makeCodes=function(e,r){for(var n,a,i,s,o=l.F.U,h=e.length,d=o.bl_count,c=0;c<=r;c++)d[c]=0;for(c=1;c<h;c+=2)d[e[c]]++;var f=o.next_code;for(n=0,d[0]=0,a=1;a<=r;a++)n=n+d[a-1]<<1,f[a]=n;for(i=0;i<h;i+=2)0!=(s=e[i+1])&&(e[i]=f[s],f[s]++)},l.F.codes2map=function(e,r,n){for(var a=e.length,i=l.F.U.rev15,s=0;s<a;s+=2)if(0!=e[s+1])for(var o=s>>1,h=e[s+1],d=o<<4|h,c=r-h,f=e[s]<<c,u=f+(1<<c);f!=u;)n[i[f]>>>15-r]=d,f++},l.F.revCodes=function(e,r){for(var n=l.F.U.rev15,a=15-r,i=0;i<e.length;i+=2){var s=e[i]<<r-e[i+1];e[i]=n[s]>>>a}},l.F._putsE=function(e,r,n){n<<=7&r;var a=r>>>3;e[a]|=n,e[a+1]|=n>>>8},l.F._putsF=function(e,r,n){n<<=7&r;var a=r>>>3;e[a]|=n,e[a+1]|=n>>>8,e[a+2]|=n>>>16},l.F._bitsE=function(e,r,n){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1<<n)-1},l.F._bitsF=function(e,r,n){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1<<n)-1},l.F._get17=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},l.F._get25=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},l.F.U=(a=Uint16Array,i=Uint32Array,{next_code:new a(16),bl_count:new a(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new a(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new i(32),flmap:new a(512),fltree:[],fdmap:new a(32),fdtree:[],lmap:new a(32768),ltree:[],ttree:[],dmap:new a(32768),dtree:[],imap:new a(512),itree:[],rev15:new a(32768),lhst:new i(286),dhst:new i(30),ihst:new i(19),lits:new i(15e3),strt:new a(65536),prev:new a(32768)}),function(){for(var e=l.F.U,r=0;r<32768;r++){var n=r;n=(0xff00ff00&(n=(0xf0f0f0f0&(n=(0xcccccccc&(n=(0xaaaaaaaa&n)>>>1|(0x55555555&n)<<1))>>>2|(0x33333333&n)<<2))>>>4|(0xf0f0f0f&n)<<4))>>>8|(0xff00ff&n)<<8,e.rev15[r]=(n>>>16|n<<16)>>>17}function a(e,r,n){for(;0!=r--;)e.push(0,n)}for(r=0;r<32;r++)e.ldef[r]=e.of0[r]<<3|e.exb[r],e.ddef[r]=e.df0[r]<<4|e.dxb[r];a(e.fltree,144,8),a(e.fltree,112,9),a(e.fltree,24,7),a(e.fltree,8,8),l.F.makeCodes(e.fltree,9),l.F.codes2map(e.fltree,9,e.flmap),l.F.revCodes(e.fltree,9),a(e.fdtree,32,5),l.F.makeCodes(e.fdtree,5),l.F.codes2map(e.fdtree,5,e.fdmap),l.F.revCodes(e.fdtree,5),a(e.itree,19,0),a(e.ltree,286,0),a(e.dtree,30,0),a(e.ttree,320,0)}();var V=(s={__proto__:null,default:W},[W].forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(r){if("default"!==r&&!(r in s)){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})}),Object.freeze(s));let G=function(){let e,r,n;var a={nextZero(e,r){for(;0!=e[r];)r++;return r},readUshort:(e,r)=>e[r]<<8|e[r+1],writeUshort(e,r,n){e[r]=n>>8&255,e[r+1]=255&n},readUint:(e,r)=>0x1000000*e[r]+(e[r+1]<<16|e[r+2]<<8|e[r+3]),writeUint(e,r,n){e[r]=n>>24&255,e[r+1]=n>>16&255,e[r+2]=n>>8&255,e[r+3]=255&n},readASCII(e,r,n){let a="";for(let i=0;i<n;i++)a+=String.fromCharCode(e[r+i]);return a},writeASCII(e,r,n){for(let a=0;a<n.length;a++)e[r+a]=n.charCodeAt(a)},readBytes(e,r,n){let a=[];for(let i=0;i<n;i++)a.push(e[r+i]);return a},pad:e=>e.length<2?`0${e}`:e,readUTF8(e,r,n){let i,l="";for(let i=0;i<n;i++)l+=`%${a.pad(e[r+i].toString(16))}`;try{i=decodeURIComponent(l)}catch(i){return a.readASCII(e,r,n)}return i}};function i(e,r,n,i){let l=r*n,s=Math.ceil(r*h(i)/8),o=new Uint8Array(4*l),d=new Uint32Array(o.buffer),{ctype:c}=i,{depth:f}=i,u=a.readUshort;if(6==c){let r=l<<2;if(8==f)for(var g=0;g<r;g+=4)o[g]=e[g],o[g+1]=e[g+1],o[g+2]=e[g+2],o[g+3]=e[g+3];if(16==f)for(g=0;g<r;g++)o[g]=e[g<<1]}else if(2==c){let r=i.tabs.tRNS;if(null==r){if(8==f)for(g=0;g<l;g++){var m=3*g;d[g]=-0x1000000|e[m+2]<<16|e[m+1]<<8|e[m]}if(16==f)for(g=0;g<l;g++)m=6*g,d[g]=-0x1000000|e[m+4]<<16|e[m+2]<<8|e[m]}else{var p=r[0];let n=r[1],a=r[2];if(8==f)for(g=0;g<l;g++){var w=g<<2;m=3*g,d[g]=-0x1000000|e[m+2]<<16|e[m+1]<<8|e[m],e[m]==p&&e[m+1]==n&&e[m+2]==a&&(o[w+3]=0)}if(16==f)for(g=0;g<l;g++)w=g<<2,m=6*g,d[g]=-0x1000000|e[m+4]<<16|e[m+2]<<8|e[m],u(e,m)==p&&u(e,m+2)==n&&u(e,m+4)==a&&(o[w+3]=0)}}else if(3==c){let a=i.tabs.PLTE,h=i.tabs.tRNS,d=h?h.length:0;if(1==f)for(var x,v=0;v<n;v++){var y=v*s,b=v*r;for(g=0;g<r;g++){w=b+g<<2;var A=3*(x=e[y+(g>>3)]>>7-(7&g)&1);o[w]=a[A],o[w+1]=a[A+1],o[w+2]=a[A+2],o[w+3]=x<d?h[x]:255}}if(2==f)for(v=0;v<n;v++)for(y=v*s,b=v*r,g=0;g<r;g++)w=b+g<<2,A=3*(x=e[y+(g>>2)]>>6-((3&g)<<1)&3),o[w]=a[A],o[w+1]=a[A+1],o[w+2]=a[A+2],o[w+3]=x<d?h[x]:255;if(4==f)for(v=0;v<n;v++)for(y=v*s,b=v*r,g=0;g<r;g++)w=b+g<<2,A=3*(x=e[y+(g>>1)]>>4-((1&g)<<2)&15),o[w]=a[A],o[w+1]=a[A+1],o[w+2]=a[A+2],o[w+3]=x<d?h[x]:255;if(8==f)for(g=0;g<l;g++)w=g<<2,A=3*(x=e[g]),o[w]=a[A],o[w+1]=a[A+1],o[w+2]=a[A+2],o[w+3]=x<d?h[x]:255}else if(4==c){if(8==f)for(g=0;g<l;g++){w=g<<2;var C,j=e[C=g<<1];o[w]=j,o[w+1]=j,o[w+2]=j,o[w+3]=e[C+1]}if(16==f)for(g=0;g<l;g++)w=g<<2,j=e[C=g<<2],o[w]=j,o[w+1]=j,o[w+2]=j,o[w+3]=e[C+2]}else if(0==c)for(p=i.tabs.tRNS?i.tabs.tRNS:-1,v=0;v<n;v++){let n=v*s,a=v*r;if(1==f)for(var I=0;I<r;I++){var N=255*((j=255*(e[n+(I>>>3)]>>>7-(7&I)&1))!=255*p);d[a+I]=N<<24|j<<16|j<<8|j}else if(2==f)for(I=0;I<r;I++)N=255*((j=85*(e[n+(I>>>2)]>>>6-((3&I)<<1)&3))!=85*p),d[a+I]=N<<24|j<<16|j<<8|j;else if(4==f)for(I=0;I<r;I++)N=255*((j=17*(e[n+(I>>>1)]>>>4-((1&I)<<2)&15))!=17*p),d[a+I]=N<<24|j<<16|j<<8|j;else if(8==f)for(I=0;I<r;I++)N=255*((j=e[n+I])!=p),d[a+I]=N<<24|j<<16|j<<8|j;else if(16==f)for(I=0;I<r;I++)j=e[n+(I<<1)],N=255*(u(e,n+(I<<1))!=p),d[a+I]=N<<24|j<<16|j<<8|j}return o}function l(e,r,n,a){let i=new Uint8Array((Math.ceil(n*h(e)/8)+1+e.interlace)*a);return r=e.tabs.CgBI?o(r,i):s(r,i),0==e.interlace?r=d(r,e,0,n,a):1==e.interlace&&(r=function(e,r){let n=r.width,a=r.height,i=h(r),l=i>>3,s=Math.ceil(n*i/8),o=new Uint8Array(a*s),c=0,f=[0,0,4,0,2,0,1],u=[0,4,0,2,0,1,0],g=[8,8,8,4,4,2,2],m=[8,8,4,4,2,2,1],p=0;for(;p<7;){let h=g[p],x=m[p],v=0,y=0,b=f[p];for(;b<a;)b+=h,y++;let A=u[p];for(;A<n;)A+=x,v++;let C=Math.ceil(v*i/8);d(e,r,c,v,y);let j=0,I=f[p];for(;I<a;){let r=u[p],a=c+j*C<<3;for(;r<n;){var w;if(1==i&&(w=(w=e[a>>3])>>7-(7&a)&1,o[I*s+(r>>3)]|=w<<7-(7&r)),2==i&&(w=(w=e[a>>3])>>6-(7&a)&3,o[I*s+(r>>2)]|=w<<6-((3&r)<<1)),4==i&&(w=(w=e[a>>3])>>4-(7&a)&15,o[I*s+(r>>1)]|=w<<4-((1&r)<<2)),i>=8){let n=I*s+r*l;for(let r=0;r<l;r++)o[n+r]=e[(a>>3)+r]}a+=i,r+=x}j++,I+=h}v*y!=0&&(c+=y*(1+C)),p+=1}return o}(r,e)),r}function s(e,r){return o(new Uint8Array(e.buffer,2,e.length-6),r)}var o=((e={}).N=function(r,n){let a=Uint8Array,i,l,s=0,o=0,h=0,d=0,c=0,f=0,u=0,g=0,m=0;if(3==r[0]&&0==r[1])return n||new a(0);let p=e.b,w=e.e,x=e.R,v=e.n,y=e.A,b=e.Z,A=e.m,C=null==n;for(C&&(n=new a(r.length>>>2<<5));0==s;)if(s=p(r,m,1),o=p(r,m+1,2),m+=3,0!=o){if(C&&(n=e.W(n,g+131072)),1==o&&(i=A.J,l=A.h,f=511,u=31),2==o){h=w(r,m,5)+257,d=w(r,m+5,5)+1,c=w(r,m+10,4)+4,m+=14;let n=1;for(var j=0;j<38;j+=2)A.Q[j]=0,A.Q[j+1]=0;for(j=0;j<c;j++){let e=w(r,m+3*j,3);A.Q[1+(A.X[j]<<1)]=e,e>n&&(n=e)}m+=3*c,v(A.Q,n),y(A.Q,n,A.u),i=A.w,l=A.d,m=x(A.u,(1<<n)-1,h+d,r,m,A.v);let a=e.V(A.v,0,h,A.C);f=(1<<a)-1;let s=e.V(A.v,h,d,A.D);u=(1<<s)-1,v(A.C,a),y(A.C,a,i),v(A.D,s),y(A.D,s,l)}for(;;){let e=i[b(r,m)&f];m+=15&e;let a=e>>>4;if(a>>>8==0)n[g++]=a;else{if(256==a)break;{let e=g+a-254;if(a>264){let n=A.q[a-257];e=g+(n>>>3)+w(r,m,7&n),m+=7&n}let i=l[b(r,m)&u];m+=15&i;let s=i>>>4,o=A.c[s],h=(o>>>4)+p(r,m,15&o);for(m+=15&o;g<e;)n[g]=n[g++-h],n[g]=n[g++-h],n[g]=n[g++-h],n[g]=n[g++-h];g=e}}}}else{0!=(7&m)&&(m+=8-(7&m));let i=4+(m>>>3),l=r[i-4]|r[i-3]<<8;C&&(n=e.W(n,g+l)),n.set(new a(r.buffer,r.byteOffset+i,l),g),m=i+l<<3,g+=l}return n.length==g?n:n.slice(0,g)},e.W=function(e,r){let n=e.length;if(r<=n)return e;let a=new Uint8Array(n<<1);return a.set(e,0),a},e.R=function(r,n,a,i,l,s){let o=e.e,h=e.Z,d=0;for(;d<a;){let e=r[h(i,l)&n];l+=15&e;let a=e>>>4;if(a<=15)s[d]=a,d++;else{let e=0,r=0;16==a?(r=3+o(i,l,2),l+=2,e=s[d-1]):17==a?(r=3+o(i,l,3),l+=3):18==a&&(r=11+o(i,l,7),l+=7);let n=d+r;for(;d<n;)s[d]=e,d++}}return l},e.V=function(e,r,n,a){let i=0,l=0,s=a.length>>>1;for(;l<n;){let n=e[l+r];a[l<<1]=0,a[1+(l<<1)]=n,n>i&&(i=n),l++}for(;l<s;)a[l<<1]=0,a[1+(l<<1)]=0,l++;return i},e.n=function(r,n){let a,i,l,s,o=e.m,h=r.length,d=o.j;for(var c=0;c<=n;c++)d[c]=0;for(c=1;c<h;c+=2)d[r[c]]++;let f=o.K;for(a=0,d[0]=0,i=1;i<=n;i++)a=a+d[i-1]<<1,f[i]=a;for(l=0;l<h;l+=2)0!=(s=r[l+1])&&(r[l]=f[s],f[s]++)},e.A=function(r,n,a){let i=r.length,l=e.m.r;for(let e=0;e<i;e+=2)if(0!=r[e+1]){let i=e>>1,s=r[e+1],o=i<<4|s,h=n-s,d=r[e]<<h,c=d+(1<<h);for(;d!=c;)a[l[d]>>>15-n]=o,d++}},e.l=function(r,n){let a=e.m.r,i=15-n;for(let e=0;e<r.length;e+=2){let l=r[e]<<n-r[e+1];r[e]=a[l]>>>i}},e.M=function(e,r,n){n<<=7&r;let a=r>>>3;e[a]|=n,e[a+1]|=n>>>8},e.I=function(e,r,n){n<<=7&r;let a=r>>>3;e[a]|=n,e[a+1]|=n>>>8,e[a+2]|=n>>>16},e.e=function(e,r,n){return(e[r>>>3]|e[1+(r>>>3)]<<8)>>>(7&r)&(1<<n)-1},e.b=function(e,r,n){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)&(1<<n)-1},e.Z=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16)>>>(7&r)},e.i=function(e,r){return(e[r>>>3]|e[1+(r>>>3)]<<8|e[2+(r>>>3)]<<16|e[3+(r>>>3)]<<24)>>>(7&r)},r=Uint16Array,n=Uint32Array,e.m={K:new r(16),j:new r(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new r(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new n(32),J:new r(512),_:[],h:new r(32),$:[],w:new r(32768),C:[],v:[],d:new r(32768),D:[],u:new r(512),Q:[],r:new r(32768),s:new n(286),Y:new n(30),a:new n(19),t:new n(15e3),k:new r(65536),g:new r(32768)},function(){let r=e.m;for(var n=0;n<32768;n++){let e=n;e=(0xff00ff00&(e=(0xf0f0f0f0&(e=(0xcccccccc&(e=(0xaaaaaaaa&e)>>>1|(0x55555555&e)<<1))>>>2|(0x33333333&e)<<2))>>>4|(0xf0f0f0f&e)<<4))>>>8|(0xff00ff&e)<<8,r.r[n]=(e>>>16|e<<16)>>>17}function a(e,r,n){for(;0!=r--;)e.push(0,n)}for(n=0;n<32;n++)r.q[n]=r.S[n]<<3|r.T[n],r.c[n]=r.p[n]<<4|r.z[n];a(r._,144,8),a(r._,112,9),a(r._,24,7),a(r._,8,8),e.n(r._,9),e.A(r._,9,r.J),e.l(r._,9),a(r.$,32,5),e.n(r.$,5),e.A(r.$,5,r.h),e.l(r.$,5),a(r.Q,19,0),a(r.C,286,0),a(r.D,30,0),a(r.v,320,0)}(),e.N);function h(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth}function d(e,r,n,a,i){let l,s,o=h(r),d=Math.ceil(a*o/8);o=Math.ceil(o/8);let f=e[n],u=0;if(f>1&&(e[n]=[0,0,1][f-2]),3==f)for(u=o;u<d;u++)e[u+1]=e[u+1]+(e[u+1-o]>>>1)&255;for(let r=0;r<i;r++)if(f=e[(s=(l=n+r*d)+r+1)-1],u=0,0==f)for(;u<d;u++)e[l+u]=e[s+u];else if(1==f){for(;u<o;u++)e[l+u]=e[s+u];for(;u<d;u++)e[l+u]=e[s+u]+e[l+u-o]}else if(2==f)for(;u<d;u++)e[l+u]=e[s+u]+e[l+u-d];else if(3==f){for(;u<o;u++)e[l+u]=e[s+u]+(e[l+u-d]>>>1);for(;u<d;u++)e[l+u]=e[s+u]+(e[l+u-d]+e[l+u-o]>>>1)}else{for(;u<o;u++)e[l+u]=e[s+u]+c(0,e[l+u-d],0);for(;u<d;u++)e[l+u]=e[s+u]+c(e[l+u-o],e[l+u-d],e[l+u-o-d])}return e}function c(e,r,n){let a=e+r-n,i=a-e,l=a-r,s=a-n;return i*i<=l*l&&i*i<=s*s?e:l*l<=s*s?r:n}function f(e,r,n,a,i,l,s,o,h){let d=Math.min(r,i),c=Math.min(n,l),f=0,u=0;for(let n=0;n<c;n++)for(let l=0;l<d;l++)if(s>=0&&o>=0?(f=n*r+l<<2,u=(o+n)*i+s+l<<2):(f=(-o+n)*r-s+l<<2,u=n*i+l<<2),0==h)a[u]=e[f],a[u+1]=e[f+1],a[u+2]=e[f+2],a[u+3]=e[f+3];else if(1==h){var g=e[f+3]*(1/255),m=e[f]*g,p=e[f+1]*g,w=e[f+2]*g,x=a[u+3]*(1/255),v=a[u]*x,y=a[u+1]*x,b=a[u+2]*x;let r=1-g,n=g+x*r,i=0==n?0:1/n;a[u+3]=255*n,a[u+0]=(m+v*r)*i,a[u+1]=(p+y*r)*i,a[u+2]=(w+b*r)*i}else if(2==h)g=e[f+3],m=e[f],p=e[f+1],w=e[f+2],x=a[u+3],v=a[u],y=a[u+1],b=a[u+2],g==x&&m==v&&p==y&&w==b?(a[u]=0,a[u+1]=0,a[u+2]=0,a[u+3]=0):(a[u]=m,a[u+1]=p,a[u+2]=w,a[u+3]=g);else if(3==h){if(g=e[f+3],m=e[f],p=e[f+1],w=e[f+2],x=a[u+3],v=a[u],y=a[u+1],b=a[u+2],g==x&&m==v&&p==y&&w==b)continue;if(g<220&&x>20)return!1}return!0}return{decode:function(e){let r=new Uint8Array(e),n=8,i=a.readUshort,h=a.readUint,d={tabs:{},frames:[]},c=new Uint8Array(r.length),f,u=0,g=0,m=[137,80,78,71,13,10,26,10];for(var p,w=0;w<8;w++)if(r[w]!=m[w])throw"The input is not a PNG file!";for(;n<r.length;){let e=a.readUint(r,n);n+=4;let m=a.readASCII(r,n,4);if(n+=4,"IHDR"==m)x=n,d.width=a.readUint(r,x),x+=4,d.height=a.readUint(r,x),d.depth=r[x+=4],d.ctype=r[++x],d.compress=r[++x],d.filter=r[++x],d.interlace=r[++x],x++;else if("iCCP"==m){for(var x,v,y=n;0!=r[y];)y++;a.readASCII(r,n,y-n),r[y+1];let i=r.slice(y+2,n+e),l=null;try{l=s(i)}catch(e){l=o(i)}d.tabs[m]=l}else if("CgBI"==m)d.tabs[m]=r.slice(n,n+4);else if("IDAT"==m){for(w=0;w<e;w++)c[u+w]=r[n+w];u+=e}else if("acTL"==m)d.tabs[m]={num_frames:h(r,n),num_plays:h(r,n+4)},f=new Uint8Array(r.length);else if("fcTL"==m){0!=g&&((p=d.frames[d.frames.length-1]).data=l(d,f.slice(0,g),p.rect.width,p.rect.height),g=0);let e={x:h(r,n+12),y:h(r,n+16),width:h(r,n+4),height:h(r,n+8)},a=i(r,n+22),s={rect:e,delay:Math.round(1e3*(a=i(r,n+20)/(0==a?100:a))),dispose:r[n+24],blend:r[n+25]};d.frames.push(s)}else if("fdAT"==m){for(w=0;w<e-4;w++)f[g+w]=r[n+w+4];g+=e-4}else if("pHYs"==m)d.tabs[m]=[a.readUint(r,n),a.readUint(r,n+4),r[n+8]];else if("cHRM"==m)for(w=0,d.tabs[m]=[];w<8;w++)d.tabs[m].push(a.readUint(r,n+4*w));else if("tEXt"==m||"zTXt"==m){null==d.tabs[m]&&(d.tabs[m]={});var b=a.nextZero(r,n),A=a.readASCII(r,n,b-n),C=n+e-b-1;if("tEXt"==m)v=a.readASCII(r,b+1,C);else{var j=s(r.slice(b+2,b+2+C));v=a.readUTF8(j,0,j.length)}d.tabs[m][A]=v}else if("iTXt"==m){null==d.tabs[m]&&(d.tabs[m]={}),b=0,y=n,b=a.nextZero(r,y),A=a.readASCII(r,y,b-y);let i=r[y=b+1];r[y+1],y+=2,b=a.nextZero(r,y),a.readASCII(r,y,b-y),y=b+1,b=a.nextZero(r,y),a.readUTF8(r,y,b-y),C=e-((y=b+1)-n),0==i?v=a.readUTF8(r,y,C):(j=s(r.slice(y,y+C)),v=a.readUTF8(j,0,j.length)),d.tabs[m][A]=v}else if("PLTE"==m)d.tabs[m]=a.readBytes(r,n,e);else if("hIST"==m){let e=d.tabs.PLTE.length/3;for(w=0,d.tabs[m]=[];w<e;w++)d.tabs[m].push(i(r,n+2*w))}else if("tRNS"==m)3==d.ctype?d.tabs[m]=a.readBytes(r,n,e):0==d.ctype?d.tabs[m]=i(r,n):2==d.ctype&&(d.tabs[m]=[i(r,n),i(r,n+2),i(r,n+4)]);else if("gAMA"==m)d.tabs[m]=a.readUint(r,n)/1e5;else if("sRGB"==m)d.tabs[m]=r[n];else if("bKGD"==m)0==d.ctype||4==d.ctype?d.tabs[m]=[i(r,n)]:2==d.ctype||6==d.ctype?d.tabs[m]=[i(r,n),i(r,n+2),i(r,n+4)]:3==d.ctype&&(d.tabs[m]=r[n]);else if("IEND"==m)break;n+=e,a.readUint(r,n),n+=4}return 0!=g&&((p=d.frames[d.frames.length-1]).data=l(d,f.slice(0,g),p.rect.width,p.rect.height)),d.data=l(d,c,d.width,d.height),delete d.compress,delete d.interlace,delete d.filter,d},toRGBA8:function(e){let r=e.width,n=e.height;if(null==e.tabs.acTL)return[i(e.data,r,n,e).buffer];let a=[];null==e.frames[0].data&&(e.frames[0].data=e.data);let l=r*n*4,s=new Uint8Array(l),o=new Uint8Array(l),h=new Uint8Array(l);for(let c=0;c<e.frames.length;c++){let u=e.frames[c],g=u.rect.x,m=u.rect.y,p=u.rect.width,w=u.rect.height,x=i(u.data,p,w,e);if(0!=c)for(var d=0;d<l;d++)h[d]=s[d];if(0==u.blend?f(x,p,w,s,r,n,g,m,0):1==u.blend&&f(x,p,w,s,r,n,g,m,1),a.push(s.buffer.slice(0)),0==u.dispose);else if(1==u.dispose)f(o,p,w,s,r,n,g,m,0);else if(2==u.dispose)for(d=0;d<l;d++)s[d]=h[d]}return a},_paeth:c,_copyTile:f,_bin:a}}();!function(){let{_copyTile:e}=G,{_bin:r}=G,n=G._paeth;var a={table:function(){let e=new Uint32Array(256);for(let r=0;r<256;r++){let n=r;for(let e=0;e<8;e++)1&n?n=0xedb88320^n>>>1:n>>>=1;e[r]=n}return e}(),update(e,r,n,i){for(let l=0;l<i;l++)e=a.table[255&(e^r[n+l])]^e>>>8;return e},crc:(e,r,n)=>0xffffffff^a.update(0xffffffff,e,r,n)};function i(e,r,n,a){r[n]+=e[0]*a>>4,r[n+1]+=e[1]*a>>4,r[n+2]+=e[2]*a>>4,r[n+3]+=e[3]*a>>4}function l(e){return Math.max(0,Math.min(255,e))}function s(e,r){let n=e[0]-r[0],a=e[1]-r[1],i=e[2]-r[2],l=e[3]-r[3];return n*n+a*a+i*i+l*l}function o(e,r,n,a,o,h,d){null==d&&(d=1);let c=a.length,f=[];for(var u,g=0;g<c;g++){let e=a[g];f.push([e>>>0&255,e>>>8&255,e>>>16&255,e>>>24&255])}for(g=0;g<c;g++){let e=0xffffffff;for(var m=0,p=0;p<c;p++){var w=s(f[g],f[p]);p!=g&&w<e&&(e=w,m=p)}}let x=new Uint32Array(o.buffer),v=new Int16Array(r*n*4),y=[0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5];for(g=0;g<y.length;g++)y[g]=255*((y[g]+.5)/16-.5);for(let o=0;o<n;o++)for(let b=0;b<r;b++){g=4*(o*r+b),2!=d?u=[l(e[g]+v[g]),l(e[g+1]+v[g+1]),l(e[g+2]+v[g+2]),l(e[g+3]+v[g+3])]:(w=y[4*(3&o)+(3&b)],u=[l(e[g]+w),l(e[g+1]+w),l(e[g+2]+w),l(e[g+3]+w)]),m=0;let A=0xffffff;for(p=0;p<c;p++){let e=s(u,f[p]);e<A&&(A=e,m=p)}let C=f[m],j=[u[0]-C[0],u[1]-C[1],u[2]-C[2],u[3]-C[3]];1==d&&(b!=r-1&&i(j,v,g+4,7),o!=n-1&&(0!=b&&i(j,v,g+4*r-4,3),i(j,v,g+4*r,5),b!=r-1&&i(j,v,g+4*r+4,1))),h[g>>2]=m,x[g>>2]=a[m]}}function h(e,n,i,l,s){null==s&&(s={});let{crc:o}=a,h=r.writeUint,d=r.writeUshort,c=r.writeASCII,f=8,u=e.frames.length>1,g,m=!1,p=33+20*!!u;if(null!=s.sRGB&&(p+=13),null!=s.pHYs&&(p+=21),null!=s.iCCP&&(p+=21+(g=pako.deflate(s.iCCP)).length+4),3==e.ctype){for(var w=e.plte.length,x=0;x<w;x++)e.plte[x]>>>24!=255&&(m=!0);p+=8+3*w+4+(m?8+ +w+4:0)}for(var v=0;v<e.frames.length;v++)u&&(p+=38),p+=(C=e.frames[v]).cimg.length+12,0!=v&&(p+=4);let y=new Uint8Array(p+=12),b=[137,80,78,71,13,10,26,10];for(x=0;x<8;x++)y[x]=b[x];if(h(y,f,13),c(y,f+=4,"IHDR"),h(y,f+=4,n),h(y,f+=4,i),y[f+=4]=e.depth,y[++f]=e.ctype,y[++f]=0,y[++f]=0,y[++f]=0,h(y,++f,o(y,f-17,17)),f+=4,null!=s.sRGB&&(h(y,f,1),c(y,f+=4,"sRGB"),y[f+=4]=s.sRGB,h(y,++f,o(y,f-5,5)),f+=4),null!=s.iCCP){let e=13+g.length;h(y,f,e),c(y,f+=4,"iCCP"),c(y,f+=4,"ICC profile"),f+=11,f+=2,y.set(g,f),h(y,f+=g.length,o(y,f-(e+4),e+4)),f+=4}if(null!=s.pHYs&&(h(y,f,9),c(y,f+=4,"pHYs"),h(y,f+=4,s.pHYs[0]),h(y,f+=4,s.pHYs[1]),y[f+=4]=s.pHYs[2],h(y,++f,o(y,f-13,13)),f+=4),u&&(h(y,f,8),c(y,f+=4,"acTL"),h(y,f+=4,e.frames.length),h(y,f+=4,null!=s.loop?s.loop:0),h(y,f+=4,o(y,f-12,12)),f+=4),3==e.ctype){for(h(y,f,3*(w=e.plte.length)),c(y,f+=4,"PLTE"),f+=4,x=0;x<w;x++){let r=3*x,n=e.plte[x],a=255&n,i=n>>>8&255,l=n>>>16&255;y[f+r+0]=a,y[f+r+1]=i,y[f+r+2]=l}if(h(y,f+=3*w,o(y,f-3*w-4,3*w+4)),f+=4,m){for(h(y,f,w),c(y,f+=4,"tRNS"),f+=4,x=0;x<w;x++)y[f+x]=e.plte[x]>>>24&255;h(y,f+=w,o(y,f-w-4,w+4)),f+=4}}let A=0;for(v=0;v<e.frames.length;v++){var C=e.frames[v];u&&(h(y,f,26),c(y,f+=4,"fcTL"),h(y,f+=4,A++),h(y,f+=4,C.rect.width),h(y,f+=4,C.rect.height),h(y,f+=4,C.rect.x),h(y,f+=4,C.rect.y),d(y,f+=4,l[v]),d(y,f+=2,1e3),y[f+=2]=C.dispose,y[++f]=C.blend,h(y,++f,o(y,f-30,30)),f+=4);let r=C.cimg;h(y,f,(w=r.length)+4*(0!=v));let n=f+=4;c(y,f,0==v?"IDAT":"fdAT"),f+=4,0!=v&&(h(y,f,A++),f+=4),y.set(r,f),h(y,f+=w,o(y,n,f-n)),f+=4}return h(y,f,0),c(y,f+=4,"IEND"),h(y,f+=4,o(y,f-4,4)),f+=4,y.buffer}function d(e,r,a){for(let i=0;i<e.frames.length;i++){let l=e.frames[i];l.rect.width;let s=l.rect.height,o=new Uint8Array(s*l.bpl+s);l.cimg=function(e,r,a,i,l,s,o){let h=[],d,c=[0,1,2,3,4];-1!=s?c=[s]:(r*i>5e5||1==a)&&(c=[0]),o&&(d={level:0});for(var f=0;f<c.length;f++){for(let s=0;s<r;s++)!function(e,r,a,i,l,s){let o=a*i,h=o+a;if(e[h]=s,h++,0==s)if(i<500)for(var d=0;d<i;d++)e[h+d]=r[o+d];else e.set(new Uint8Array(r.buffer,o,i),h);else if(1==s){for(d=0;d<l;d++)e[h+d]=r[o+d];for(d=l;d<i;d++)e[h+d]=r[o+d]-r[o+d-l]+256&255}else if(0==a){for(d=0;d<l;d++)e[h+d]=r[o+d];if(2==s)for(d=l;d<i;d++)e[h+d]=r[o+d];if(3==s)for(d=l;d<i;d++)e[h+d]=r[o+d]-(r[o+d-l]>>1)+256&255;if(4==s)for(d=l;d<i;d++)e[h+d]=r[o+d]-n(r[o+d-l],0,0)+256&255}else{if(2==s)for(d=0;d<i;d++)e[h+d]=r[o+d]+256-r[o+d-i]&255;if(3==s){for(d=0;d<l;d++)e[h+d]=r[o+d]+256-(r[o+d-i]>>1)&255;for(d=l;d<i;d++)e[h+d]=r[o+d]+256-(r[o+d-i]+r[o+d-l]>>1)&255}if(4==s){for(d=0;d<l;d++)e[h+d]=r[o+d]+256-n(0,r[o+d-i],0)&255;for(d=l;d<i;d++)e[h+d]=r[o+d]+256-n(r[o+d-l],r[o+d-i],r[o+d-l-i])&255}}}(l,e,s,i,a,c[f]);h.push(V.deflate(l,d))}let u,g=1e9;for(f=0;f<h.length;f++)h[f].length<g&&(u=f,g=h[f].length);return h[u]}(l.img,s,l.bpp,l.bpl,o,r,a)}}function c(r,n,a,i,l){let s=l[0],h=l[1],d=l[2],c=l[3],m=l[4],p=l[5],w=6,x=8,v=255;for(var y=0;y<r.length;y++){let e=new Uint8Array(r[y]);for(var b=e.length,A=0;A<b;A+=4)v&=e[A+3]}let C=255!=v,j=function(r,n,a,i,l,s){let o=[];for(var h,d=0;d<r.length;d++){let h=new Uint8Array(r[d]),f=new Uint32Array(h.buffer),p=0,w=0,x=n,v=a,y=+!!i;if(0!=d){let b=s||i||1==d||0!=o[d-2].dispose?1:2,A=0,C=1e9;for(let e=0;e<b;e++){var c,g=new Uint8Array(r[d-1-e]);let i=new Uint32Array(r[d-1-e]),s=n,o=a,h=-1,u=-1;for(let e=0;e<a;e++)for(let r=0;r<n;r++)f[m=e*n+r]!=i[m]&&(r<s&&(s=r),r>h&&(h=r),e<o&&(o=e),e>u&&(u=e));-1==h&&(s=o=h=u=0),l&&(1==(1&s)&&s--,1==(1&o)&&o--);let y=(h-s+1)*(u-o+1);y<C&&(C=y,A=e,p=s,w=o,x=h-s+1,v=u-o+1)}g=new Uint8Array(r[d-1-A]),1==A&&(o[d-1].dispose=2),e(g,n,a,c=new Uint8Array(x*v*4),x,v,-p,-w,0),1==(y=+!!e(h,n,a,c,x,v,-p,-w,3))?u(h,n,a,c,{x:p,y:w,width:x,height:v}):e(h,n,a,c,x,v,-p,-w,0)}else c=h.slice(0);o.push({rect:{x:p,y:w,width:x,height:v},img:c,blend:y,dispose:0})}if(i)for(d=0;d<o.length;d++){if(1==(h=o[d]).blend)continue;let e=h.rect,i=o[d-1].rect,s=Math.min(e.x,i.x),c=Math.min(e.y,i.y),u={x:s,y:c,width:Math.max(e.x+e.width,i.x+i.width)-s,height:Math.max(e.y+e.height,i.y+i.height)-c};o[d-1].dispose=1,d-1!=0&&f(r,n,a,o,d-1,u,l),f(r,n,a,o,d,u,l)}if(1!=r.length)for(var m=0;m<o.length;m++)(h=o[m]).rect.width,h.rect.height;return o}(r,n,a,s,h,d),I={},N=[],F=[];if(0!=i){let e=[];for(A=0;A<j.length;A++)e.push(j[A].img.buffer);let r=g(function(e){let r=0;for(var n=0;n<e.length;n++)r+=e[n].byteLength;let a=new Uint8Array(r),i=0;for(n=0;n<e.length;n++){let r=new Uint8Array(e[n]),l=r.length;for(let e=0;e<l;e+=4){let n=r[e],l=r[e+1],s=r[e+2],o=r[e+3];0==o&&(n=l=s=0),a[i+e]=n,a[i+e+1]=l,a[i+e+2]=s,a[i+e+3]=o}i+=l}return a.buffer}(e),i);for(A=0;A<r.plte.length;A++)N.push(r.plte[A].est.rgba);let n=0;for(A=0;A<j.length;A++){let e=(D=j[A]).img.length;var U=new Uint8Array(r.inds.buffer,n>>2,e>>2);F.push(U);let a=new Uint8Array(r.abuf,n,e);p&&o(D.img,D.rect.width,D.rect.height,N,a,U),D.img.set(a),n+=e}}else for(y=0;y<j.length;y++){var D=j[y];let e=new Uint32Array(D.img.buffer);var E=D.rect.width;for(U=new Uint8Array(b=e.length),F.push(U),A=0;A<b;A++){let r=e[A];if(0!=A&&r==e[A-1])U[A]=U[A-1];else if(A>E&&r==e[A-E])U[A]=U[A-E];else{let e=I[r];if(null==e&&(I[r]=e=N.length,N.push(r),N.length>=300))break;U[A]=e}}}let S=N.length;for(S<=256&&0==m&&(x=Math.max(x=S<=2?1:S<=4?2:S<=16?4:8,c)),y=0;y<j.length;y++){(D=j[y]).rect.x,D.rect.y,E=D.rect.width;let e=D.rect.height,r=D.img;new Uint32Array(r.buffer);let n=4*E,a=4;if(S<=256&&0==m){var M=new Uint8Array((n=Math.ceil(x*E/8))*e);let i=F[y];for(let r=0;r<e;r++){A=r*n;let e=r*E;if(8==x)for(var R=0;R<E;R++)M[A+R]=i[e+R];else if(4==x)for(R=0;R<E;R++)M[A+(R>>1)]|=i[e+R]<<4-4*(1&R);else if(2==x)for(R=0;R<E;R++)M[A+(R>>2)]|=i[e+R]<<6-2*(3&R);else if(1==x)for(R=0;R<E;R++)M[A+(R>>3)]|=i[e+R]<<7-(7&R)}r=M,w=3,a=1}else if(0==C&&1==j.length){M=new Uint8Array(E*e*3);let i=E*e;for(A=0;A<i;A++){let e=3*A,n=4*A;M[e]=r[n],M[e+1]=r[n+1],M[e+2]=r[n+2]}r=M,w=2,a=3,n=3*E}D.img=r,D.bpl=n,D.bpp=a}return{ctype:w,depth:x,plte:N,frames:j}}function f(r,n,a,i,l,s,o){let h=Uint8Array,d=Uint32Array,c=new h(r[l-1]),f=new d(r[l-1]),g=l+1<r.length?new h(r[l+1]):null,m=new h(r[l]),p=new d(m.buffer),w=n,x=a,v=-1,y=-1;for(let e=0;e<s.height;e++)for(let r=0;r<s.width;r++){let a=s.x+r,o=s.y+e,h=o*n+a,d=p[h];0==d||0==i[l-1].dispose&&f[h]==d&&(null==g||0!=g[4*h+3])||(a<w&&(w=a),a>v&&(v=a),o<x&&(x=o),o>y&&(y=o))}-1==v&&(w=x=v=y=0),o&&(1==(1&w)&&w--,1==(1&x)&&x--),s={x:w,y:x,width:v-w+1,height:y-x+1};let b=i[l];b.rect=s,b.blend=1,b.img=new Uint8Array(s.width*s.height*4),0==i[l-1].dispose?(e(c,n,a,b.img,s.width,s.height,-s.x,-s.y,0),u(m,n,a,b.img,s)):e(m,n,a,b.img,s.width,s.height,-s.x,-s.y,0)}function u(r,n,a,i,l){e(r,n,a,i,l.width,l.height,-l.x,-l.y,2)}function g(e,r){let n,a=new Uint8Array(e),i=a.slice(0),l=new Uint32Array(i.buffer),s=m(i,r),o=s[0],h=s[1],d=a.length,c=new Uint8Array(d>>2);if(a.length<2e7)for(var f=0;f<d;f+=4)n=p(o,u=a[f]*(1/255),g=a[f+1]*(1/255),x=a[f+2]*(1/255),v=a[f+3]*(1/255)),c[f>>2]=n.ind,l[f>>2]=n.est.rgba;else for(f=0;f<d;f+=4){var u=a[f]*(1/255),g=a[f+1]*(1/255),x=a[f+2]*(1/255),v=a[f+3]*(1/255);for(n=o;n.left;)n=0>=w(n.est,u,g,x,v)?n.left:n.right;c[f>>2]=n.ind,l[f>>2]=n.est.rgba}return{abuf:i.buffer,inds:c,plte:h}}function m(e,r,n){null==n&&(n=1e-4);let a=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=v(e,i.i0,i.i1),i.est=y(i.bst);let l=[i];for(;l.length<r;){let r=0,i=0;for(var s=0;s<l.length;s++)l[s].est.L>r&&(r=l[s].est.L,i=s);if(r<n)break;let o=l[i],h=function(e,r,n,a,i,l){for(a-=4;n<a;){for(;x(e,n,i)<=l;)n+=4;for(;x(e,a,i)>l;)a-=4;if(n>=a)break;let s=r[n>>2];r[n>>2]=r[a>>2],r[a>>2]=s,n+=4,a-=4}for(;x(e,n,i)>l;)n-=4;return n+4}(e,a,o.i0,o.i1,o.est.e,o.est.eMq255);if(o.i0>=h||o.i1<=h){o.est.L=0;continue}let d={i0:o.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};d.bst=v(e,d.i0,d.i1),d.est=y(d.bst);let c={i0:h,i1:o.i1,bst:null,est:null,tdst:0,left:null,right:null};for(s=0,c.bst={R:[],m:[],N:o.bst.N-d.bst.N};s<16;s++)c.bst.R[s]=o.bst.R[s]-d.bst.R[s];for(s=0;s<4;s++)c.bst.m[s]=o.bst.m[s]-d.bst.m[s];c.est=y(c.bst),o.left=d,o.right=c,l[i]=d,l.push(c)}for(l.sort((e,r)=>r.bst.N-e.bst.N),s=0;s<l.length;s++)l[s].ind=s;return[i,l]}function p(e,r,n,a,i){if(null==e.left){var l;let s,o,h,d;return l=e.est.q,s=r-l[0],o=n-l[1],h=a-l[2],e.tdst=s*s+o*o+h*h+(d=i-l[3])*d,e}let s=w(e.est,r,n,a,i),o=e.left,h=e.right;s>0&&(o=e.right,h=e.left);let d=p(o,r,n,a,i);if(d.tdst<=s*s)return d;let c=p(h,r,n,a,i);return c.tdst<d.tdst?c:d}function w(e,r,n,a,i){let{e:l}=e;return l[0]*r+l[1]*n+l[2]*a+l[3]*i-e.eMq}function x(e,r,n){return e[r]*n[0]+e[r+1]*n[1]+e[r+2]*n[2]+e[r+3]*n[3]}function v(e,r,n){let a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0];for(let l=r;l<n;l+=4){let r=e[l]*(1/255),n=e[l+1]*(1/255),s=e[l+2]*(1/255),o=e[l+3]*(1/255);i[0]+=r,i[1]+=n,i[2]+=s,i[3]+=o,a[0]+=r*r,a[1]+=r*n,a[2]+=r*s,a[3]+=r*o,a[5]+=n*n,a[6]+=n*s,a[7]+=n*o,a[10]+=s*s,a[11]+=s*o,a[15]+=o*o}return a[4]=a[1],a[8]=a[2],a[9]=a[6],a[12]=a[3],a[13]=a[7],a[14]=a[11],{R:a,m:i,N:n-r>>2}}function y(e){let{R:r}=e,{m:n}=e,{N:a}=e,i=n[0],l=n[1],s=n[2],o=n[3],h=0==a?0:1/a,d=[r[0]-i*i*h,r[1]-i*l*h,r[2]-i*s*h,r[3]-i*o*h,r[4]-l*i*h,r[5]-l*l*h,r[6]-l*s*h,r[7]-l*o*h,r[8]-s*i*h,r[9]-s*l*h,r[10]-s*s*h,r[11]-s*o*h,r[12]-o*i*h,r[13]-o*l*h,r[14]-o*s*h,r[15]-o*o*h],c=[Math.random(),Math.random(),Math.random(),Math.random()],f=0,u=0;if(0!=a)for(let e=0;e<16&&(c=b.multVec(d,c),u=Math.sqrt(b.dot(c,c)),c=b.sml(1/u,c),!(0!=e&&1e-9>Math.abs(u-f)));e++)f=u;let g=[i*h,l*h,s*h,o*h];return{Cov:d,q:g,e:c,L:f,eMq255:b.dot(b.sml(255,g),c),eMq:b.dot(c,g),rgba:(Math.round(255*g[3])<<24|Math.round(255*g[2])<<16|Math.round(255*g[1])<<8|(0|Math.round(255*g[0])))>>>0}}var b={multVec:(e,r)=>[e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3],e[4]*r[0]+e[5]*r[1]+e[6]*r[2]+e[7]*r[3],e[8]*r[0]+e[9]*r[1]+e[10]*r[2]+e[11]*r[3],e[12]*r[0]+e[13]*r[1]+e[14]*r[2]+e[15]*r[3]],dot:(e,r)=>e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]*r[3],sml:(e,r)=>[e*r[0],e*r[1],e*r[2],e*r[3]]};G.encode=function(e,r,n,a,i,l,s){null==a&&(a=0),null==s&&(s=!1);let o=c(e,r,n,a,[!1,!1,!1,0,s,!1]);return d(o,-1),h(o,r,n,i,l)},G.encodeLL=function(e,r,n,a,i,l,s,o){let c={ctype:0+2*(1!=a)+4*(0!=i),depth:l,frames:[]},f=(a+i)*l,u=f*r;for(let a=0;a<e.length;a++)c.frames.push({rect:{x:0,y:0,width:r,height:n},img:new Uint8Array(e[a]),blend:0,dispose:1,bpp:Math.ceil(f/8),bpl:Math.ceil(u/8)});return d(c,0,!0),h(c,r,n,s,o)},G.encode.compress=c,G.encode.dither=o,G.quantize=g,G.quantize.getKDtree=m,G.quantize.getNearest=p}();let q={toArrayBuffer(e,r){let n=e.width,a=e.height,i=n<<2,l=new Uint32Array(e.getContext("2d").getImageData(0,0,n,a).data.buffer),s=(32*n+31)/32<<2,o=s*a,h=122+o,d=new ArrayBuffer(h),c=new DataView(d),f,u,g,m,p=1048576,w=0,x=0,v=0;function y(e){c.setUint16(x,e,!0),x+=2}function b(e){c.setUint32(x,e,!0),x+=4}y(19778),b(h),x+=4,b(122),b(108),b(n),b(-a>>>0),y(1),y(32),b(3),b(o),b(2835),b(2835),x+=8,b(0xff0000),b(65280),b(255),b(0xff000000),b(0x57696e20),function e(){for(;w<a&&p>0;){for(m=122+w*s,f=0;f<i;)p--,g=(u=l[v++])>>>24,c.setUint32(m+f,u<<8|g),f+=4;w++}v<l.length?(p=1048576,setTimeout(e,q._dly)):r(d)}()},toBlob(e,r){this.toArrayBuffer(e,e=>{r(new Blob([e],{type:"image/bmp"}))})},_dly:9};var Z={CHROME:"CHROME",FIREFOX:"FIREFOX",DESKTOP_SAFARI:"DESKTOP_SAFARI",IE:"IE",IOS:"IOS",ETC:"ETC"},J={[Z.CHROME]:16384,[Z.FIREFOX]:11180,[Z.DESKTOP_SAFARI]:16384,[Z.IE]:8192,[Z.IOS]:4096,[Z.ETC]:8192};let ee="undefined"!=typeof window,et="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,er=ee&&window.cordova&&window.cordova.require&&window.cordova.require("cordova/modulemapper"),en=(ee||et)&&(er&&er.getOriginalSymbol(window,"File")||"undefined"!=typeof File&&File),ea=(ee||et)&&(er&&er.getOriginalSymbol(window,"FileReader")||"undefined"!=typeof FileReader&&FileReader);function ei(e,r,n=Date.now()){return new Promise(a=>{let i=e.split(","),l=i[0].match(/:(.*?);/)[1],s=globalThis.atob(i[1]),o=s.length,h=new Uint8Array(o);for(;o--;)h[o]=s.charCodeAt(o);let d=new Blob([h],{type:l});d.name=r,d.lastModified=n,a(d)})}function el(e){return new Promise((r,n)=>{let a=new ea;a.onload=()=>r(a.result),a.onerror=e=>n(e),a.readAsDataURL(e)})}function es(e){return new Promise((r,n)=>{let a=new Image;a.onload=()=>r(a),a.onerror=e=>n(e),a.src=e})}function eo(){if(void 0!==eo.cachedResult)return eo.cachedResult;let e=Z.ETC,{userAgent:r}=navigator;return/Chrom(e|ium)/i.test(r)?e=Z.CHROME:/iP(ad|od|hone)/i.test(r)&&/WebKit/i.test(r)?e=Z.IOS:/Safari/i.test(r)?e=Z.DESKTOP_SAFARI:/Firefox/i.test(r)?e=Z.FIREFOX:(/MSIE/i.test(r)||!0==!!document.documentMode)&&(e=Z.IE),eo.cachedResult=e,eo.cachedResult}function eh(e,r){let n=J[eo()],a=e,i=r,l=a*i,s=a>i?i/a:a/i;for(;l>n*n;){let e=(n+a)/2,r=(n+i)/2;e<r?(i=r,a=r*s):(i=e*s,a=e),l=a*i}return{width:a,height:i}}function ed(e,r){let n,a;try{if(a=(n=new OffscreenCanvas(e,r)).getContext("2d"),null===a)throw Error("getContext of OffscreenCanvas returns null")}catch(e){a=(n=document.createElement("canvas")).getContext("2d")}return n.width=e,n.height=r,[n,a]}function ec(e,r){let{width:n,height:a}=eh(e.width,e.height),[i,l]=ed(n,a);return r&&/jpe?g/.test(r)&&(l.fillStyle="white",l.fillRect(0,0,i.width,i.height)),l.drawImage(e,0,0,i.width,i.height),i}function ef(){return void 0!==ef.cachedResult||(ef.cachedResult=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"undefined"!=typeof document&&"ontouchend"in document),ef.cachedResult}function eu(e,r={}){return new Promise(function(n,a){let i,l;var s=function(){try{return l=ec(i,r.fileType||e.type),n([i,l])}catch(e){return a(e)}},o=function(r){try{var n=function(e){try{throw e}catch(e){return a(e)}};try{let r;return el(e).then(function(e){try{return r=e,es(r).then(function(e){try{return i=e,function(){try{return s()}catch(e){return a(e)}}()}catch(e){return n(e)}},n)}catch(e){return n(e)}},n)}catch(e){n(e)}}catch(e){return a(e)}};try{if(ef()||[Z.DESKTOP_SAFARI,Z.MOBILE_SAFARI].includes(eo()))throw Error("Skip createImageBitmap on IOS and Safari");return createImageBitmap(e).then(function(e){try{return i=e,s()}catch(e){return o()}},o)}catch(e){o()}})}function eg(e,r,n,a,i=1){return new Promise(function(l,s){let o;if("image/png"===r){let l,s;return l=e.getContext("2d"),{data:s}=l.getImageData(0,0,e.width,e.height),(o=new Blob([G.encode([s.buffer],e.width,e.height,4096*i)],{type:r})).name=n,o.lastModified=a,c.call(this)}if("image/bmp"===r)return new Promise(r=>q.toBlob(e,r)).then((function(e){try{return(o=e).name=n,o.lastModified=a,d.call(this)}catch(e){return s(e)}}).bind(this),s);if("function"==typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:r,quality:i}).then((function(e){try{return(o=e).name=n,o.lastModified=a,h.call(this)}catch(e){return s(e)}}).bind(this),s);return ei(e.toDataURL(r,i),n,a).then((function(e){try{return o=e,h.call(this)}catch(e){return s(e)}}).bind(this),s);function h(){return d.call(this)}function d(){return c.call(this)}function c(){return l(o)}})}function em(e){e.width=0,e.height=0}function ep(){return new Promise(function(e,r){let n,a,i,l;return void 0!==ep.cachedResult?e(ep.cachedResult):ei("data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q==","test.jpg",Date.now()).then(function(s){try{return n=s,eu(n).then(function(s){try{return a=s[1],eg(a,n.type,n.name,n.lastModified).then(function(n){try{return i=n,em(a),eu(i).then(function(n){try{return l=n[0],ep.cachedResult=1===l.width&&2===l.height,e(ep.cachedResult)}catch(e){return r(e)}},r)}catch(e){return r(e)}},r)}catch(e){return r(e)}},r)}catch(e){return r(e)}},r)})}function ew(e){return new Promise((r,n)=>{let a=new ea;a.onload=e=>{let n=new DataView(e.target.result);if(65496!=n.getUint16(0,!1))return r(-2);let a=n.byteLength,i=2;for(;i<a&&!(8>=n.getUint16(i+2,!1));){let e=n.getUint16(i,!1);if(i+=2,65505==e){if(0x45786966!=n.getUint32(i+=2,!1))return r(-1);let e=18761==n.getUint16(i+=6,!1);i+=n.getUint32(i+4,e);let a=n.getUint16(i,e);i+=2;for(let l=0;l<a;l++)if(274==n.getUint16(i+12*l,e))return r(n.getUint16(i+12*l+8,e))}else{if(65280!=(65280&e))break;i+=n.getUint16(i,!1)}}return r(-1)},a.onerror=e=>n(e),a.readAsArrayBuffer(e)})}function ex(e,r){let{width:n}=e,{height:a}=e,{maxWidthOrHeight:i}=r,l,s=e;return isFinite(i)&&(n>i||a>i)&&([s,l]=ed(n,a),n>a?(s.width=i,s.height=a/n*i):(s.width=n/a*i,s.height=i),l.drawImage(e,0,0,s.width,s.height),em(e)),s}function ev(e,r){let{width:n}=e,{height:a}=e,[i,l]=ed(n,a);switch(r>4&&r<9?(i.width=a,i.height=n):(i.width=n,i.height=a),r){case 2:l.transform(-1,0,0,1,n,0);break;case 3:l.transform(-1,0,0,-1,n,a);break;case 4:l.transform(1,0,0,-1,0,a);break;case 5:l.transform(0,1,1,0,0,0);break;case 6:l.transform(0,1,-1,0,a,0);break;case 7:l.transform(0,-1,-1,0,a,n);break;case 8:l.transform(0,-1,1,0,0,n)}return l.drawImage(e,0,0,n,a),em(e),i}function ey(e,r,n=0){return new Promise(function(a,i){let l,s,o,h,d,c,f,u,g,m,p,w,x,v,y,b,A,C,j,I;function N(e=5){if(r.signal&&r.signal.aborted)throw r.signal.reason;l+=e,r.onProgress(Math.min(l,100))}function F(e){if(r.signal&&r.signal.aborted)throw r.signal.reason;l=Math.min(Math.max(e,l),100),r.onProgress(l)}return l=n,s=r.maxIteration||10,o=1024*r.maxSizeMB*1024,N(),eu(e,r).then((function(n){try{return[,h]=n,N(),d=ex(h,r),N(),new Promise(function(n,a){var i;if(!(i=r.exifOrientation))return ew(e).then((function(e){try{return i=e,l.call(this)}catch(e){return a(e)}}).bind(this),a);function l(){return n(i)}return l.call(this)}).then((function(n){try{return c=n,N(),ep().then((function(n){try{return f=n?d:ev(d,c),N(),u=r.initialQuality||1,g=r.fileType||e.type,eg(f,g,e.name,e.lastModified,u).then((function(n){try{var l;if(m=n,N(),p=m.size>o,w=m.size>e.size,!p&&!w)return F(100),a(m);function c(){if(s--&&(y>o||y>x)){let r,n;return r=I?.95*j.width:j.width,n=I?.95*j.height:j.height,[A,C]=ed(r,n),C.drawImage(j,0,0,r,n),u*="image/png"===g?.85:.95,eg(A,g,e.name,e.lastModified,u).then(function(e){try{return b=e,em(j),j=A,y=b.size,F(Math.min(99,Math.floor((v-y)/(v-o)*100))),c}catch(e){return i(e)}},i)}return[1]}return x=e.size,y=v=m.size,j=f,I=!r.alwaysKeepResolution&&p,(l=(function(e){for(;e;){if(e.then)return void e.then(l,i);try{if(e.pop){if(e.length)return e.pop()?U.call(this):e;e=c}else e=e.call(this)}catch(e){return i(e)}}}).bind(this))(c);function U(){return em(j),em(A),em(d),em(f),em(h),F(100),a(b)}}catch(e){return i(e)}}).bind(this),i)}catch(e){return i(e)}}).bind(this),i)}catch(e){return i(e)}}).bind(this),i)}catch(e){return i(e)}}).bind(this),i)})}function eb(e,r){return new Promise(function(a,i){let l,s,o,h,d,c;if(l={...r},o=0,{onProgress:h}=l,l.maxSizeMB=l.maxSizeMB||1/0,d="boolean"!=typeof l.useWebWorker||l.useWebWorker,delete l.useWebWorker,l.onProgress=e=>{o=e,"function"==typeof h&&h(o)},!(e instanceof Blob||e instanceof en))return i(Error("The file given is not an instance of Blob or File"));if(!/^image/.test(e.type))return i(Error("The file given is not an image"));if(c="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,!d||"function"!=typeof Worker||c)return ey(e,l).then((function(e){try{return s=e,g.call(this)}catch(e){return i(e)}}).bind(this),i);var f=(function(){try{return g.call(this)}catch(e){return i(e)}}).bind(this),u=function(r){try{return ey(e,l).then(function(e){try{return s=e,f()}catch(e){return i(e)}},i)}catch(e){return i(e)}};try{return l.libURL=l.libURL||"https://cdn.jsdelivr.net/npm/browser-image-compression@2.0.2/dist/browser-image-compression.js",new Promise((r,a)=>{var i;let s;n||(s=[],"function"==typeof(i="\nlet scriptImported = false\nself.addEventListener('message', async (e) => {\n const { file, id, imageCompressionLibUrl, options } = e.data\n options.onProgress = (progress) => self.postMessage({ progress, id })\n try {\n if (!scriptImported) {\n // console.log('[worker] importScripts', imageCompressionLibUrl)\n self.importScripts(imageCompressionLibUrl)\n scriptImported = true\n }\n // console.log('[worker] self', self)\n const compressedFile = await imageCompression(file, options)\n self.postMessage({ file: compressedFile, id })\n } catch (e) {\n // console.error('[worker] error', e)\n self.postMessage({ error: e.message + '\\n' + e.stack, id })\n }\n})\n")?s.push(`(${i})()`):s.push(i),n=URL.createObjectURL(new Blob(s)));let o=new Worker(n);o.addEventListener("message",function(e){if(l.signal&&l.signal.aborted)o.terminate();else if(void 0===e.data.progress){if(e.data.error)return a(Error(e.data.error)),void o.terminate();r(e.data.file),o.terminate()}else l.onProgress(e.data.progress)}),o.addEventListener("error",a),l.signal&&l.signal.addEventListener("abort",()=>{a(l.signal.reason),o.terminate()}),o.postMessage({file:e,imageCompressionLibUrl:l.libURL,options:{...l,onProgress:void 0,signal:void 0}})}).then(function(e){try{return s=e,f()}catch(e){return u()}},u)}catch(e){u()}function g(){try{s.name=e.name,s.lastModified=e.lastModified}catch(e){}try{l.preserveExif&&"image/jpeg"===e.type&&(!l.fileType||l.fileType&&l.fileType===e.type)&&(s=K(e,s))}catch(e){}return a(s)}})}function eA({value:e,onChange:r,className:n}){let[a,i]=(0,h.useState)(void 0),[l,s]=(0,h.useState)(!1),[c,f]=(0,h.useState)(!1),[u,g]=(0,h.useState)(null),[m,p]=(0,h.useState)(),[w,x]=(0,h.useState)(),v=(0,h.useRef)(null),y=(0,h.useRef)(null);(0,h.useEffect)(()=>{let r;return(async()=>{if(!e)return i(void 0);try{let n=await D.db.images.get(e);n&&(r=URL.createObjectURL(n.blob),i(r))}catch(e){console.error("Failed to load image:",e)}})(),()=>{r&&URL.revokeObjectURL(r)}},[e]);let b=async e=>{let r=e.target.files?.[0];if(r)try{if(!r.type.startsWith("image/"))return void alert("请选择图片文件");let e=await eb(r,{maxSizeMB:1,maxWidthOrHeight:1024,useWebWorker:!0}),n=new FileReader;n.onload=()=>{g(n.result),f(!0)},n.readAsDataURL(e)}catch(e){console.error("Failed to process image:",e),alert("图片处理失败")}finally{y.current&&(y.current.value="")}},A=async()=>{if(!w||!v.current)return void await E(u);try{s(!0);let e=document.createElement("canvas"),r=v.current.naturalWidth/v.current.width,n=v.current.naturalHeight/v.current.height;e.width=w.width,e.height=w.height;let a=e.getContext("2d");a&&a.drawImage(v.current,w.x*r,w.y*n,w.width*r,w.height*n,0,0,w.width,w.height),e.toBlob(async e=>{e&&await E(URL.createObjectURL(e),e)},"image/jpeg",.9)}catch(e){console.error("Failed to crop image:",e),alert("图片裁剪失败")}finally{s(!1),f(!1),g(null)}},E=async(e,n)=>{try{s(!0);let a=n;if(!a){let r=await fetch(e);a=await r.blob()}let i=R();await D.db.images.add({id:i,blob:a,mimeType:a.type,createdAt:new Date().toISOString()}),r(i),f(!1),g(null)}catch(e){console.error("Failed to save image:",e),alert("图片保存失败")}finally{s(!1)}};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:`flex items-center gap-4 ${n}`,children:[(0,o.jsxs)(C.Avatar,{className:"h-20 w-20 border-2 border-dashed border-muted-foreground/50",children:[(0,o.jsx)(C.AvatarImage,{src:a,className:"object-cover"}),(0,o.jsx)(C.AvatarFallback,{className:"bg-transparent",children:l?(0,o.jsx)(F,{className:"h-6 w-6 animate-spin"}):(0,o.jsx)(I.Upload,{className:"h-6 w-6 text-muted-foreground"})})]}),(0,o.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,o.jsx)("input",{type:"file",ref:y,className:"hidden",accept:"image/*",onChange:b}),(0,o.jsx)(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>y.current?.click(),disabled:l,children:e?"更换头像":"上传头像"}),e&&(0,o.jsxs)(d.Button,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{r(void 0)},children:[(0,o.jsx)(N.X,{className:"mr-2 h-3 w-3"})," 移除"]})]})]}),(0,o.jsx)(j.Dialog,{open:c,onOpenChange:f,children:(0,o.jsxs)(j.DialogContent,{className:"max-w-3xl",children:[(0,o.jsx)(j.DialogHeader,{children:(0,o.jsxs)(j.DialogTitle,{className:"flex items-center gap-2",children:[(0,o.jsx)(U,{className:"h-5 w-5"}),"裁剪图片"]})}),(0,o.jsx)("div",{className:"max-h-[60vh] overflow-auto",children:u&&(0,o.jsx)($,{crop:m,onChange:e=>p(e),onComplete:e=>x(e),aspect:1,circularCrop:!0,children:(0,o.jsx)("img",{ref:v,src:u,alt:"待裁剪图片",className:"max-w-full"})})}),(0,o.jsxs)(j.DialogFooter,{children:[(0,o.jsx)(d.Button,{variant:"outline",onClick:()=>{f(!1),g(null)},children:"取消"}),(0,o.jsxs)(d.Button,{onClick:A,disabled:l,children:[l?(0,o.jsx)(F,{className:"mr-2 h-4 w-4 animate-spin"}):null,w?"确认裁剪":"跳过裁剪"]})]})]})})]})}eb.getDataUrlFromFile=el,eb.getFilefromDataUrl=ei,eb.loadImage=es,eb.drawImageInCanvas=ec,eb.drawFileInCanvas=eu,eb.canvasToFile=eg,eb.getExifOrientation=ew,eb.handleMaxWidthOrHeight=ex,eb.followExifOrientation=ev,eb.cleanupCanvasMemory=em,eb.isAutoOrientationInBrowser=ep,eb.approximateBelowMaximumCanvasSizeOfBrowser=eh,eb.copyExifWithoutOrientation=K,eb.getBrowserName=eo,eb.version="2.0.2";var eC=e.i(29300),ej=e.i(78657),eI=e.i(75212);function eN({photoIds:e=[],onChange:r,readonly:n=!1}){let{showAlert:a,showConfirm:i}=(0,eI.useDialog)(),[l,s]=(0,h.useState)([]),[c,f]=(0,h.useState)(null),[u,g]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let r=async()=>{s((await Promise.all(e.map(async e=>{try{let r=await D.db.images.get(e);if(r){let n=URL.createObjectURL(r.blob);return{id:e,url:n}}}catch(e){console.error("加载照片失败:",e)}return null}))).filter(Boolean))};return e.length>0&&r(),()=>{l.forEach(e=>URL.revokeObjectURL(e.url))}},[e]);let m=async n=>{let i=n.target.files;if(i&&0!==i.length){g(!0);try{let n=[];for(let e of Array.from(i)){if(!e.type.startsWith("image/"))continue;let r={maxSizeMB:2,maxWidthOrHeight:1920,useWebWorker:!0},a=await eb(e,r),i=R();await D.db.images.add({id:i,blob:a,mimeType:a.type,createdAt:new Date().toISOString()}),n.push(i)}r([...e,...n])}catch(e){console.error("上传照片失败:",e),await a("上传照片失败","错误")}finally{g(!1),n.target.value=""}}},p=async n=>{await i("确定要删除这张照片吗?","删除照片")&&r(e.filter(e=>e!==n))};return(0,o.jsxs)("div",{className:"space-y-4",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"text-sm font-medium",children:["照片墙 (",l.length,")"]}),!n&&(0,o.jsxs)("label",{children:[(0,o.jsx)("input",{type:"file",multiple:!0,accept:"image/*",className:"hidden",onChange:m,disabled:u}),(0,o.jsx)(d.Button,{type:"button",variant:"outline",size:"sm",disabled:u,asChild:!0,children:(0,o.jsxs)("span",{children:[(0,o.jsx)(eC.Plus,{className:"mr-2 h-4 w-4"}),u?"上传中...":"添加照片"]})})]})]}),l.length>0?(0,o.jsx)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:l.map(e=>(0,o.jsxs)("div",{className:"relative group aspect-square",children:[(0,o.jsx)("img",{src:e.url,alt:"家族照片",className:"w-full h-full object-cover rounded-lg border border-border cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>f(e.url)}),!n&&(0,o.jsx)(d.Button,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>p(e.id),children:(0,o.jsx)(N.X,{className:"h-3 w-3"})}),(0,o.jsx)(d.Button,{type:"button",variant:"secondary",size:"icon",className:"absolute bottom-2 right-2 h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>f(e.url),children:(0,o.jsx)(ej.ZoomIn,{className:"h-3 w-3"})})]},e.id))}):(0,o.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm border border-dashed rounded-lg",children:"暂无照片"}),(0,o.jsx)(j.Dialog,{open:!!c,onOpenChange:()=>f(null),children:(0,o.jsxs)(j.DialogContent,{className:"max-w-4xl",children:[(0,o.jsx)(j.DialogHeader,{children:(0,o.jsx)(j.DialogTitle,{children:"照片预览"})}),c&&(0,o.jsx)("img",{src:c,alt:"照片预览",className:"w-full h-auto max-h-[70vh] object-contain"})]})})]})}e.s(["PhotoGallery",()=>eN],62345);var eF=e.i(7790);let eU=(0,w.default)("Trash",[["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"}]]);e.s(["Trash",()=>eU],432);var eD=e.i(91258);function eE({stories:e=[],onChange:r,readonly:n=!1}){let{showAlert:a,showConfirm:i}=(0,eI.useDialog)(),[l,s]=(0,h.useState)(!1),[g,m]=(0,h.useState)(null),[p,w]=(0,h.useState)({title:"",content:"",date:""}),x=async n=>{await i("确定要删除这个故事吗?","删除故事")&&r(e.filter(e=>e.id!==n))},v=async()=>{if(!p.title||!p.content)return void await a("请填写标题和内容","提示");let n=new Date().toISOString();g?r(e.map(e=>e.id===g.id?{...e,...p,updatedAt:n}:e)):r([...e,{id:R(),title:p.title,content:p.content,date:p.date,imageIds:p.imageIds||[],createdAt:n,updatedAt:n}]),s(!1),w({title:"",content:"",date:""})};return(0,o.jsxs)("div",{className:"space-y-4",children:[(0,o.jsxs)("div",{className:"flex items-center justify-between",children:[(0,o.jsxs)("h3",{className:"text-sm font-medium flex items-center gap-2",children:[(0,o.jsx)(b.BookOpen,{className:"h-4 w-4"}),"家族故事 (",e.length,")"]}),!n&&(0,o.jsxs)(d.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{m(null),w({title:"",content:"",date:""}),s(!0)},children:[(0,o.jsx)(eC.Plus,{className:"mr-2 h-4 w-4"}),"添加故事"]})]}),e.length>0?(0,o.jsx)("div",{className:"space-y-4",children:e.sort((e,r)=>new Date(r.createdAt).getTime()-new Date(e.createdAt).getTime()).map(e=>(0,o.jsxs)(A.Card,{className:"hover:shadow-md transition-shadow",children:[(0,o.jsx)(A.CardHeader,{className:"pb-3",children:(0,o.jsxs)("div",{className:"flex items-start justify-between",children:[(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsx)(A.CardTitle,{className:"text-lg font-serif",children:e.title}),e.date&&(0,o.jsxs)("div",{className:"flex items-center gap-1 text-sm text-muted-foreground mt-1",children:[(0,o.jsx)(eD.Calendar,{className:"h-3 w-3"}),e.date]})]}),!n&&(0,o.jsxs)("div",{className:"flex gap-1",children:[(0,o.jsx)(d.Button,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{m(e),w(e),s(!0)},children:(0,o.jsx)(eF.Edit,{className:"h-3 w-3"})}),(0,o.jsx)(d.Button,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>x(e.id),children:(0,o.jsx)(eU,{className:"h-3 w-3"})})]})]})}),(0,o.jsxs)(A.CardContent,{children:[(0,o.jsx)("p",{className:"text-sm text-muted-foreground whitespace-pre-line leading-relaxed",children:e.content}),(0,o.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground",children:["创建于 ",new Date(e.createdAt).toLocaleDateString("zh-CN")]})]})]},e.id))}):(0,o.jsx)("div",{className:"text-center py-8 text-muted-foreground text-sm border border-dashed rounded-lg",children:"暂无家族故事"}),(0,o.jsx)(j.Dialog,{open:l,onOpenChange:s,children:(0,o.jsxs)(j.DialogContent,{className:"max-w-2xl",children:[(0,o.jsx)(j.DialogHeader,{children:(0,o.jsx)(j.DialogTitle,{children:g?"编辑故事":"添加故事"})}),(0,o.jsxs)("div",{className:"space-y-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"story-title",children:"故事标题 *"}),(0,o.jsx)(c.Input,{id:"story-title",placeholder:"例如:爷爷的创业故事",value:p.title||"",onChange:e=>w({...p,title:e.target.value})})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"story-date",children:"发生日期(可选)"}),(0,o.jsx)(c.Input,{id:"story-date",type:"date",value:p.date||"",onChange:e=>w({...p,date:e.target.value})})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"story-content",children:"故事内容 *"}),(0,o.jsx)(u.Textarea,{id:"story-content",placeholder:"记录家族的珍贵故事...",className:"min-h-[200px]",value:p.content||"",onChange:e=>w({...p,content:e.target.value})})]})]}),(0,o.jsxs)(j.DialogFooter,{children:[(0,o.jsx)(d.Button,{variant:"outline",onClick:()=>s(!1),children:"取消"}),(0,o.jsx)(d.Button,{onClick:v,children:g?"保存":"添加"})]})]})})]})}function eS({initialData:e,existingMembers:r=[],onSubmit:n,onCancel:a}){let i=r.length>0?Math.max(...r.map(e=>e.generation||1)):1,[l,s]=(0,h.useState)({id:e?.id||crypto.randomUUID(),surname:e?.surname||"李",givenName:e?.givenName||"",fullName:e?.fullName||"",gender:(e?.gender||"MALE").toUpperCase(),generation:e?.generation||i,spouseIds:e?.spouseIds||[],childrenIds:e?.childrenIds||[],fatherId:e?.fatherId,motherId:e?.motherId,...e}),[w,C]=(0,h.useState)([]),j=(e,n)=>{s(a=>{let i={...a,[e]:n};if(("surname"===e||"givenName"===e)&&(i.fullName=(i.surname||"")+(i.givenName||"")),"fatherId"===e&&n){let e=r.find(e=>e.id===n);e&&e.spouseIds&&e.spouseIds.length>0&&(i.motherId=e.spouseIds[0])}if("motherId"===e&&n){let e=r.find(e=>e.id===n);e&&e.spouseIds&&e.spouseIds.length>0&&(i.fatherId=e.spouseIds[0])}return i}),w.length>0&&C([])},I=r.filter(e=>e.id!==l.id);return(0,o.jsxs)("form",{onSubmit:e=>{e.preventDefault(),(()=>{let e=[];l.birthDate&&l.deathDate&&new Date(l.birthDate)>new Date(l.deathDate)&&e.push("出生日期不能晚于逝世日期");let n=l.birthDate?new Date(l.birthDate).getFullYear():null;if(n){if(l.fatherId){let a=r.find(e=>e.id===l.fatherId);if(a?.birthDate){let r=new Date(a.birthDate).getFullYear();n-r<15&&e.push(`与父亲的年龄差过小 (${n-r}岁),请确认`),n<r&&e.push("出生日期不能早于父亲")}}if(l.motherId){let a=r.find(e=>e.id===l.motherId);if(a?.birthDate){let r=new Date(a.birthDate).getFullYear();n-r<15&&e.push(`与母亲的年龄差过小 (${n-r}岁),请确认`),n<r&&e.push("出生日期不能早于母亲")}}}if(l.fatherId){let n=r.find(e=>e.id===l.fatherId);n&&l.generation!==n.generation+1&&e.push(`世系错误:父亲是第 ${n.generation} 世,子女应为第 ${n.generation+1} 世`)}if(l.fatherId||l.motherId){let n=new Set,a=e=>{if(e===l.id)return!0;if(n.has(e))return!1;n.add(e);let i=r.find(r=>r.id===e);return!!i&&!!(i.fatherId&&a(i.fatherId)||i.motherId&&a(i.motherId))};l.fatherId&&a(l.fatherId)&&e.push("检测到循环引用:不能将自己的后代设置为父亲"),l.motherId&&a(l.motherId)&&e.push("检测到循环引用:不能将自己的后代设置为母亲")}return l.fatherId===l.id&&e.push("不能将自己设置为自己的父亲"),l.motherId===l.id&&e.push("不能将自己设置为自己的母亲"),l.spouseIds?.includes(l.id||"")&&e.push("不能将自己设置为自己的配偶"),C(e),0===e.length})()&&n(l)},className:"space-y-8 max-w-4xl mx-auto p-6",children:[w.length>0&&(0,o.jsxs)("div",{className:"bg-destructive/15 text-destructive px-4 py-3 rounded-md border border-destructive/20",children:[(0,o.jsx)("p",{className:"font-bold mb-1",children:"请检查以下问题:"}),(0,o.jsx)("ul",{className:"list-disc list-inside text-sm",children:w.map((e,r)=>(0,o.jsx)("li",{children:e},r))})]}),(0,o.jsxs)("div",{className:"space-y-6",children:[(0,o.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,o.jsxs)(A.Card,{children:[(0,o.jsx)(A.CardHeader,{children:(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(p.User,{className:"h-5 w-5"}),"基本信息 (Identity)"]})}),(0,o.jsxs)(A.CardContent,{className:"space-y-4",children:[(0,o.jsx)("div",{className:"flex justify-center mb-4",children:(0,o.jsx)(eA,{value:l.avatarImageId,onChange:e=>j("avatarImageId",e)})}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"surname",children:"姓 (Surname)"}),(0,o.jsx)(c.Input,{id:"surname",value:l.surname,onChange:e=>j("surname",e.target.value)})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"givenName",children:"名 (Given Name)"}),(0,o.jsx)(c.Input,{id:"givenName",value:l.givenName,onChange:e=>j("givenName",e.target.value)})]})]}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"gender",children:"性别 (Gender)"}),(0,o.jsxs)(g.Select,{value:l.gender,onValueChange:e=>j("gender",e),children:[(0,o.jsx)(g.SelectTrigger,{children:(0,o.jsx)(g.SelectValue,{})}),(0,o.jsxs)(g.SelectContent,{children:[(0,o.jsx)(g.SelectItem,{value:"MALE",children:"男 (Male)"}),(0,o.jsx)(g.SelectItem,{value:"FEMALE",children:"女 (Female)"})]})]})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"generation",children:"世系 (Generation)"}),(0,o.jsx)(c.Input,{id:"generation",type:"number",value:l.generation,onChange:e=>j("generation",Number.parseInt(e.target.value))})]})]})]})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsx)(A.CardHeader,{children:(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(v.Users,{className:"h-5 w-5"}),"家庭关系 (Relationships)"]})}),(0,o.jsxs)(A.CardContent,{className:"space-y-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"fatherId",children:"父亲 (Father)"}),(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsxs)(g.Select,{value:l.fatherId||"none",onValueChange:e=>j("fatherId","none"===e?void 0:e),children:[(0,o.jsx)(g.SelectTrigger,{className:"flex-1",children:(0,o.jsx)(g.SelectValue,{placeholder:"选择父亲"})}),(0,o.jsxs)(g.SelectContent,{children:[(0,o.jsx)(g.SelectItem,{value:"none",children:"无 (None)"}),I.filter(e=>"MALE"===e.gender&&e.generation===(l.generation||1)-1).map(e=>(0,o.jsxs)(g.SelectItem,{value:e.id,children:[e.fullName," (",e.generation,"世)"]},e.id))]})]}),!l.fatherId&&(0,o.jsx)(c.Input,{placeholder:"非家族成员填写姓名",value:l.spouseFatherName||"",onChange:e=>j("spouseFatherName",e.target.value),className:"flex-1"})]})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"motherId",children:"母亲 (Mother)"}),(0,o.jsxs)("div",{className:"flex gap-2",children:[(0,o.jsxs)(g.Select,{value:l.motherId||"none",onValueChange:e=>j("motherId","none"===e?void 0:e),children:[(0,o.jsx)(g.SelectTrigger,{className:"flex-1",children:(0,o.jsx)(g.SelectValue,{placeholder:"选择母亲"})}),(0,o.jsxs)(g.SelectContent,{children:[(0,o.jsx)(g.SelectItem,{value:"none",children:"无 (None)"}),I.filter(e=>"FEMALE"===e.gender&&e.generation===(l.generation||1)-1).map(e=>(0,o.jsxs)(g.SelectItem,{value:e.id,children:[e.fullName," (",e.generation,"世)"]},e.id))]})]}),!l.motherId&&(0,o.jsx)(c.Input,{placeholder:"非家族成员填写姓名",value:l.spouseMotherName||"",onChange:e=>j("spouseMotherName",e.target.value),className:"flex-1"})]})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"spouseId",children:"配偶 (Spouse)"}),(0,o.jsxs)(g.Select,{value:l.spouseIds?.[0]||"none",onValueChange:e=>{e?s(r=>({...r,spouseIds:[e]})):s(e=>({...e,spouseIds:[]}))},children:[(0,o.jsx)(g.SelectTrigger,{children:(0,o.jsx)(g.SelectValue,{placeholder:"选择配偶 Select Spouse"})}),(0,o.jsxs)(g.SelectContent,{children:[(0,o.jsx)(g.SelectItem,{value:"none",children:"无 (None)"}),I.filter(e=>!(e.generation!==l.generation||e.id===l.fatherId||e.id===l.motherId||l.childrenIds?.includes(e.id))&&(!l.fatherId||e.fatherId!==l.fatherId)&&(!l.motherId||e.motherId!==l.motherId)).map(e=>(0,o.jsxs)(g.SelectItem,{value:e.id,children:[e.fullName," (",e.generation,"世)"]},e.id))]})]})]})]})]})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsx)(A.CardHeader,{children:(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(x,{className:"h-5 w-5"}),"传统称谓 (Traditional Names)"]})}),(0,o.jsxs)(A.CardContent,{className:"space-y-4",children:[(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"courtesyName",children:"字 (Courtesy Name)"}),(0,o.jsx)(c.Input,{id:"courtesyName",value:l.courtesyName||"",onChange:e=>j("courtesyName",e.target.value),placeholder:"e.g. 伯虎"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"artName",children:"号 (Art Name)"}),(0,o.jsx)(c.Input,{id:"artName",value:l.artName||"",onChange:e=>j("artName",e.target.value),placeholder:"e.g. 六如居士"})]})]}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"generationName",children:"字辈 (Gen. Name)"}),(0,o.jsx)(c.Input,{id:"generationName",value:l.generationName||"",onChange:e=>j("generationName",e.target.value)})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"posthumousName",children:"谥号 (Posthumous)"}),(0,o.jsx)(c.Input,{id:"posthumousName",value:l.posthumousName||"",onChange:e=>j("posthumousName",e.target.value)})]})]})]})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsx)(A.CardHeader,{children:(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(m.default,{className:"h-5 w-5"}),"生平与地点 (Life & Places)"]})}),(0,o.jsxs)(A.CardContent,{className:"space-y-4",children:[(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"birthDate",children:"出生日期 (Birth)"}),(0,o.jsx)(c.Input,{id:"birthDate",type:"date",value:l.birthDate||"",onChange:e=>j("birthDate",e.target.value)})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"deathDate",children:"逝世日期 (Death)"}),(0,o.jsx)(c.Input,{id:"deathDate",type:"date",value:l.deathDate||"",onChange:e=>j("deathDate",e.target.value)})]})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"ancestralHome",children:"籍贯 (Ancestral Home)"}),(0,o.jsx)(c.Input,{id:"ancestralHome",value:l.ancestralHome||"",onChange:e=>j("ancestralHome",e.target.value),placeholder:"e.g. 福建省泉州市"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"burialPlace",children:"葬地 (Burial Place)"}),(0,o.jsx)(c.Input,{id:"burialPlace",value:l.burialPlace||"",onChange:e=>j("burialPlace",e.target.value)})]})]})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsxs)(A.CardHeader,{children:[(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(p.User,{className:"h-5 w-5"}),"联系方式 (Contact Information)"]}),(0,o.jsx)(A.CardDescription,{children:"在世成员的联系方式"})]}),(0,o.jsxs)(A.CardContent,{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"phone",children:"手机号 (Mobile Phone)"}),(0,o.jsx)(c.Input,{id:"phone",type:"tel",value:l.phone||"",onChange:e=>j("phone",e.target.value),placeholder:"e.g. 13800138000"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"telephone",children:"固定电话 (Telephone)"}),(0,o.jsx)(c.Input,{id:"telephone",type:"tel",value:l.telephone||"",onChange:e=>j("telephone",e.target.value),placeholder:"e.g. 0592-1234567"})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(f.Label,{htmlFor:"email",children:"邮箱 (Email)"}),(0,o.jsx)(c.Input,{id:"email",type:"email",value:l.email||"",onChange:e=>j("email",e.target.value),placeholder:"e.g. example@email.com"})]}),(0,o.jsxs)("div",{className:"space-y-2 md:col-span-2",children:[(0,o.jsx)(f.Label,{htmlFor:"address",children:"现居地址 (Address)"}),(0,o.jsx)(c.Input,{id:"address",value:l.address||"",onChange:e=>j("address",e.target.value),placeholder:"e.g. 福建省厦门市思明区XX路XX号"})]})]})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsx)(A.CardHeader,{children:(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(x,{className:"h-5 w-5"}),"生平事迹 (Biography)"]})}),(0,o.jsx)(A.CardContent,{className:"space-y-4",children:(0,o.jsx)(u.Textarea,{className:"min-h-[200px]",placeholder:"记录生平事迹...",value:l.bio||"",onChange:e=>j("bio",e.target.value)})})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsxs)(A.CardHeader,{children:[(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(y,{className:"h-5 w-5"}),"照片墙 (Photo Gallery)"]}),(0,o.jsx)(A.CardDescription,{children:"上传多张照片记录珍贵时刻"})]}),(0,o.jsx)(A.CardContent,{children:(0,o.jsx)(eN,{photoIds:l.photoIds||[],onChange:e=>j("photoIds",e)})})]}),(0,o.jsxs)(A.Card,{children:[(0,o.jsxs)(A.CardHeader,{children:[(0,o.jsxs)(A.CardTitle,{className:"flex items-center gap-2 text-lg font-serif",children:[(0,o.jsx)(b.BookOpen,{className:"h-5 w-5"}),"家族故事 (Family Stories)"]}),(0,o.jsx)(A.CardDescription,{children:"记录与此成员相关的家族故事"})]}),(0,o.jsx)(A.CardContent,{children:(0,o.jsx)(eE,{stories:l.stories||[],onChange:e=>j("stories",e)})})]})]}),(0,o.jsxs)("div",{className:"flex justify-end gap-4 sticky bottom-4 bg-background/90 p-4 border-t border-border backdrop-blur rounded-lg",children:[(0,o.jsx)(d.Button,{type:"button",variant:"outline",onClick:a,children:"取消 (Cancel)"}),(0,o.jsx)(d.Button,{type:"submit",className:"bg-primary text-primary-foreground hover:bg-primary/90",children:"保存 (Save Member)"})]})]})}e.s(["StoryManager",()=>eE],76637),e.s(["MemberForm",()=>eS],23951)}]); |