detect/detect.gui/Embedded/dist/assets/index-b51a6013.js

13 lines
374 KiB
JavaScript
Raw Normal View History

2025-04-21 13:08:40 +08:00
var eb=Object.defineProperty,sb=Object.defineProperties;var ib=Object.getOwnPropertyDescriptors;var Zh=Object.getOwnPropertySymbols,nb=Object.getPrototypeOf,Tp=Object.prototype.hasOwnProperty,Pp=Object.prototype.propertyIsEnumerable,rb=Reflect.get;var uo=Math.pow,Nu=(d,t,e)=>t in d?eb(d,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):d[t]=e,ws=(d,t)=>{for(var e in t||(t={}))Tp.call(t,e)&&Nu(d,e,t[e]);if(Zh)for(var e of Zh(t))Pp.call(t,e)&&Nu(d,e,t[e]);return d},_r=(d,t)=>sb(d,ib(t));var Rp=(d,t)=>{var e={};for(var s in d)Tp.call(d,s)&&t.indexOf(s)<0&&(e[s]=d[s]);if(d!=null&&Zh)for(var s of Zh(d))t.indexOf(s)<0&&Pp.call(d,s)&&(e[s]=d[s]);return e};var O=(d,t,e)=>(Nu(d,typeof t!="symbol"?t+"":t,e),e),Ou=(d,t,e)=>{if(!t.has(d))throw TypeError("Cannot "+e)};var n=(d,t,e)=>(Ou(d,t,"read from private field"),e?e.call(d):t.get(d)),u=(d,t,e)=>{if(t.has(d))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(d):t.set(d,e)},p=(d,t,e,s)=>(Ou(d,t,"write to private field"),s?s.call(d,e):t.set(d,e),e);var qt=(d,t,e,s)=>({set _(i){p(d,t,i,e)},get _(){return n(d,t,s)}}),b=(d,t,e)=>(Ou(d,t,"access private method"),e),ji=(d,t,e)=>rb(nb(d),e,t);var I=(d,t,e)=>new Promise((s,i)=>{var r=l=>{try{o(e.next(l))}catch(h){i(h)}},a=l=>{try{o(e.throw(l))}catch(h){i(h)}},o=l=>l.done?s(l.value):Promise.resolve(l.value).then(r,a);o((e=e.apply(d,t)).next())});import{k as ab,_ as Jp,l as ob,S as lb,m as hb,L as cb,j as db}from"./index.js";import{u as ub,B as fb}from"./useTable-e949a6b7.js";import{T as pb}from"./useForm-baba730a.js";import{O as gb,N as Zp,Q as mb,R as bb,U as Ab,V as yb,W as wb,j as Bu}from"./antd-0679333d.js";import{T as vb,r as _b,s as Sb,c as Eb,a as kp}from"./drawer-20246748.js";import{u as Cb}from"./index-679d8a0a.js";import{l as bo,a6 as tg,m as Hu,A as zu,Z as Dc,_ as qu,$ as ys,ad as Mp,a8 as eg,k as oe,a0 as xb,a5 as si,G as kr,d as Tb,f as Wi,c as Pb,o as Rb,b as kb,u as he,a4 as Mb}from"./vue-72a104e4.js";import{u as Lb}from"./index-8a6826ba.js";import Ib from"./result-f5f59bf1.js";import"./useWindowSizeFn-1db11f4f.js";import"./onMountedOrActivated-ee461833.js";import"./sortable.esm-15c0a34e.js";import"./copyTextToClipboard-3ca69a78.js";import"./deviceApi-260fcde9.js";import"./modal-62c07bbb.js";var Do={};Do.d=(d,t)=>{for(var e in t)Do.o(t,e)&&!Do.o(d,e)&&Object.defineProperty(d,e,{enumerable:!0,get:t[e]})};Do.o=(d,t)=>Object.prototype.hasOwnProperty.call(d,t);var H=globalThis.pdfjsLib={};Do.d(H,{AbortException:()=>$i,AnnotationEditorLayer:()=>np,AnnotationEditorParamsType:()=>K,AnnotationEditorType:()=>G,AnnotationEditorUIManager:()=>Ar,AnnotationLayer:()=>Py,AnnotationMode:()=>ii,ColorPicker:()=>zc,DOMSVGFactory:()=>Ap,DrawLayer:()=>op,FeatureTest:()=>te,GlobalWorkerOptions:()=>ti,ImageKind:()=>nc,InvalidPDFException:()=>Ku,MissingPDFException:()=>Fo,OPS:()=>Fe,OutputScale:()=>Ju,PDFDataRangeTransport:()=>im,PDFDateString:()=>pp,PDFWorker:()=>Dr,PasswordResponses:()=>Ob,PermissionFlag:()=>Nb,PixelsPerInch:()=>Gi,RenderingCancelledException:()=>up,TextLayer:()=>No,TouchManager:()=>Bc,UnexpectedResponseException:()=>Fc,Util:()=>F,VerbosityLevel:()=>Tu,XfaLayer:()=>rm,build:()=>ly,createValidAbsoluteUrl:()=>$b,fetchData:()=>Mu,getDocument:()=>ZA,getFilenameFromUrl:()=>Kb,getPdfFilenameFromUrl:()=>Qb,getXfaPageViewport:()=>Jb,isDataScheme:()=>Lu,isPdfFile:()=>fp,noContextMenu:()=>Ke,normalizeUnicode:()=>Xb,setLayerDimensions:()=>br,shadow:()=>X,stopEvent:()=>Se,version:()=>oy});const Xt=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),sg=[1,0,0,1,0,0],Yu=[.001,0,0,.001,0,0],Db=1e7,$u=1.35,_e={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},ii={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Fb="pdfjs_internal_editor_",G={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},K={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHL
`);return t.join("")}}function Ao(d,t){try{const{protocol:e}=t?new URL(d,t):new URL(d);return e==="http:"||e==="https:"}catch(e){return!1}}function Ke(d){d.preventDefault()}function Se(d){d.preventDefault(),d.stopPropagation()}var Ho;class pp{static toDateObject(t){if(!t||typeof t!="string")return null;n(this,Ho)||p(this,Ho,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=n(this,Ho).exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(e[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let f=parseInt(e[9],10)||0;return f=f>=0&&f<=59?f:0,h==="-"?(a+=c,o+=f):h==="+"&&(a-=c,o-=f),new Date(Date.UTC(s,i,r,a,o,l))}}Ho=new WeakMap,u(pp,Ho,void 0);function Jb(d,{scale:t=1,rotation:e=0}){const{width:s,height:i}=d.attributes.style,r=[0,0,parseInt(s),parseInt(i)];return new Kh({viewBox:r,userUnit:1,scale:t,rotation:e})}function gp(d){if(d.startsWith("#")){const t=parseInt(d.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return d.startsWith("rgb(")?d.slice(4,-1).split(",").map(t=>parseInt(t)):d.startsWith("rgba(")?d.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(V(`Not a valid color format: "${d}"`),[0,0,0])}function Zb(d){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of d.keys()){t.style.color=e;const s=window.getComputedStyle(t).color;d.set(e,gp(s))}t.remove()}function lt(d){const{a:t,b:e,c:s,d:i,e:r,f:a}=d.getTransform();return[t,e,s,i,r,a]}function Je(d){const{a:t,b:e,c:s,d:i,e:r,f:a}=d.getTransform().invertSelf();return[t,e,s,i,r,a]}function br(d,t,e=!1,s=!0){if(t instanceof Kh){const{pageWidth:i,pageHeight:r}=t.rawDims,{style:a}=d,o=te.isCSSRoundSupported,l=`var(--scale-factor) * ${i}px`,h=`var(--scale-factor) * ${r}px`,c=o?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,f=o?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;!e||t.rotation%180===0?(a.width=c,a.height=f):(a.width=f,a.height=c)}s&&d.setAttribute("data-main-rotation",t.rotation)}class Ju{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}}var ni,Zi,Ne,tn,zo,$o,Vc,ng,Uc,rg,jc,ag,Nr,ac,Wc,og,Go,tf;const Es=class Es{constructor(t){u(this,Uc);u(this,jc);u(this,Nr);u(this,Wc);u(this,Go);u(this,ni,null);u(this,Zi,null);u(this,Ne,void 0);u(this,tn,null);u(this,zo,null);p(this,Ne,t),n(Es,$o)||p(Es,$o,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const t=p(this,ni,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=n(this,Ne)._uiManager._signal;t.addEventListener("contextmenu",Ke,{signal:e}),t.addEventListener("pointerdown",b(Es,Vc,ng),{signal:e});const s=p(this,tn,document.createElement("div"));s.className="buttons",t.append(s);const i=n(this,Ne).toolbarPosition;if(i){const{style:r}=t,a=n(this,Ne)._uiManager.direction==="ltr"?1-i[0]:i[0];r.insetInlineEnd=`${100*a}%`,r.top=`calc(${100*i[1]}% + var(--editor-toolbar-vert-offset))`}return b(this,Wc,og).call(this),t}get div(){return n(this,ni)}hide(){var t;n(this,ni).classList.add("hidden"),(t=n(this,Zi))==null||t.hideDropdown()}show(){var t;n(this,ni).classList.remove("hidden"),(t=n(this,zo))==null||t.shown()}addAltText(t){return I(this,null,function*(){const e=yield t.render();b(this,Nr,ac).call(this,e),n(this,tn).prepend(e,n(this,Go,tf)),p(this,zo,t)})}addColorPicker(t){p(this,Zi,t);const e=t.renderButton();b(this,Nr,ac).call(this,e),n(this,tn).prepend(e,n(this,Go,tf))}remove(){var t;n(this,ni).remove(),(t=n(this,Zi))==null||t.destroy(),p(this,Zi,null)}};ni=new WeakMap,Zi=new WeakMap,Ne=new WeakMap,tn=new WeakMap,zo=new WeakMap,$o=new Wea
2025-04-18 09:53:39 +08:00
`))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const c={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=h!=null?h:o,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",h!=null?h:o),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),yr.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=Jh,this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",g=>{t.setValue(e,{value:g.target.value}),this.setPropertyOnSiblings(s,"value",g.target.value,"value"),c.formattedValue=null}),s.addEventListener("resetform",g=>{var A;const m=(A=this.data.defaultFieldValue)!=null?A:"";s.value=c.userValue=m,c.formattedValue=null});let f=g=>{const{formattedValue:m}=c;m!=null&&(g.target.value=m),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",m=>{var y;if(c.focused)return;const{target:A}=m;c.userValue&&(A.value=c.userValue),c.lastCommittedValue=A.value,c.commitKey=1,(y=this.data.actions)!=null&&y.Focus||(c.focused=!0)}),s.addEventListener("updatefromsandbox",m=>{this.showElementAndHideCanvas(m.target);const A={value(y){var v;c.userValue=(v=y.detail.value)!=null?v:"",t.setValue(e,{value:c.userValue.toString()}),y.target.value=c.userValue},formattedValue(y){const{formattedValue:v}=y.detail;c.formattedValue=v,v!=null&&y.target!==document.activeElement&&(y.target.value=v),t.setValue(e,{formattedValue:v})},selRange(y){y.target.setSelectionRange(...y.detail.selRange)},charLimit:y=>{var E;const{charLimit:v}=y.detail,{target:w}=y;if(v===0){w.removeAttribute("maxLength");return}w.setAttribute("maxLength",v);let _=c.userValue;!_||_.length<=v||(_=_.slice(0,v),w.value=c.userValue=_,t.setValue(e,{value:_}),(E=this.linkService.eventBus)==null||E.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:_,willCommit:!0,commitKey:1,selStart:w.selectionStart,selEnd:w.selectionEnd}}))}};this._dispatchEventFromSandbox(A,m)}),s.addEventListener("keydown",m=>{var v;c.commitKey=1;let A=-1;if(m.key==="Escape"?A=0:m.key==="Enter"&&!this.data.multiLine?A=2:m.key==="Tab"&&(c.commitKey=3),A===-1)return;const{value:y}=m.target;c.lastCommittedValue!==y&&(c.lastCommittedValue=y,c.userValue=y,(v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:y,willCommit:!0,commitKey:A,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}}))});const g=f;f=null,s.addEventListener("blur",m=>{var y,v;if(!c.focused||!m.relatedTarget)return;(y=this.data.actions)!=null&&y.Blur||(c.focused=!1);const{value:A}=m.target;c.userValue=A,c.lastCommittedValue!==A&&((v=this.linkService.eventBus)==null||v.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:A,willCommit:!0,commitKey:c.commitKey,selStart:m.target.selectionStart,selEnd:m.target.selectionEnd}})),g(m)}),(r=this.data.actions)!=null&&r.Keystroke&&s.addEventListener("beforeinput",m=>{var C;c.lastCommittedValue=null;const{data:A,target:y}=m,{value:v,selectionStart:w,selectionEnd:_}=y;let E=w,S=_;switch(m.inputType){case"deleteWordBackward":{const P=v.substring(0,w).match(/\w*[^\w]*$/);P&&(E-=P[0].length);break}case"deleteWordForward":{const P=v.substring(w).match(/^[^\w]*\w*/);P&&(S+=P[0].length);break}case"deleteContentBackward":w===_&&(E-=1);break;case"deleteContentForward":w===_&&(S+=1);break}m.preventDefault(),(C=this.linkService.eventBus)==null||C.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:E,selEnd:S}})}),this._setEventListeners(s,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],m=>m.target.value)}if(f&&s.addEventListener("blur",f),this.data.comb){const m=(this.data.rect[2]-this.data.rect[0])/l
`))e.push({name:"span",value:r,attributes:i});return s},Gd=new WeakSet,um=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&n(this,Gs))&&b(this,Pa,wc).call(this)},Vd=new WeakSet,fm=function(){if(n(this,Vs)!==null)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:s,pageX:i,pageY:r}}}=n(this,Jl);let a=!!n(this,xa),o=a?n(this,xa):n(this,Zl);for(const A of n(this,Ql))if(!o||F.intersect(A.data.rect,o)!==null){o=A.data.rect,a=!0;break}const l=F.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),h=5,c=a?o[2]-o[0]+h:0,f=l[0]+c,g=l[1];p(this,Vs,[100*(f-i)/e,100*(g-r)/s]);const{style:m}=n(this,gt);m.left=`${n(this,Vs)[0]}%`,m.top=`${n(this,Vs)[1]}%`},Pa=new WeakSet,wc=function(){p(this,Gs,!n(this,Gs)),n(this,Gs)?(b(this,Ra,vc).call(this),n(this,gt).addEventListener("click",n(this,Ea)),n(this,gt).addEventListener("keydown",n(this,Sa))):(b(this,sh,Ff).call(this),n(this,gt).removeEventListener("click",n(this,Ea)),n(this,gt).removeEventListener("keydown",n(this,Sa)))},Ra=new WeakSet,vc=function(){n(this,$e)||this.render(),this.isVisible?n(this,Gs)&&n(this,gt).classList.add("focused"):(b(this,Vd,fm).call(this),n(this,gt).hidden=!1,n(this,gt).style.zIndex=parseInt(n(this,gt).style.zIndex)+1e3)},sh=new WeakSet,Ff=function(){n(this,gt).classList.remove("focused"),!(n(this,Gs)||!this.isVisible)&&(n(this,gt).hidden=!0,n(this,gt).style.zIndex=parseInt(n(this,gt).style.zIndex)-1e3)};class pm extends At{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=G.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}var ih;class yy extends At{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});u(this,ih,null)}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:s,height:i}=zi(e.rect),r=this.svgFactory.create(s,i,!0),a=p(this,ih,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),a.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),a.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),a.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),a.setAttribute("stroke-width",e.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,ih)}addHighlightArea(){this.container.classList.add("highlightArea")}}ih=new WeakMap;var nh;class wy extends At{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});u(this,nh,null)}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:s,height:i}=zi(e.rect),r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,nh,this.svgFactory.createElement("svg:rect"));return o.setAttribute("x",a/2),o.setAttribute("y",a/2),o.setAttribute("width",s-a),o.setAttribute("height",i-a),o.setAttribute("stroke-width",a||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return n(this,nh)}addHighlightArea(){this.container.classList.add("highlightArea")}}nh=new WeakMap;var rh;class vy extends At{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});u(this,rh,null)}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:s,height:i}=zi(e.rect),r=this.svgFactory.create(s,i,!0),a=e.borderStyle.width,o=p(this,rh,this.svgFactory.createElement("svg:ellipse"));return o.setAttribute("cx",s/2),o.setAttribute("cy",i/2),o.setAttrib
`);if(!r)return;const a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();const o=a.getRangeAt(0);if(!r.includes(`
`)){o.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),a.collapseToStart();return}const{startContainer:l,startOffset:h}=o,c=[],f=[];if(l.nodeType===Node.TEXT_NODE){const w=l.parentElement;if(f.push(l.nodeValue.slice(h).replaceAll(ic,"")),w!==this.editorDiv){let _=c;for(const E of this.editorDiv.childNodes){if(E===w){_=f;continue}_.push(b(y=et,Ma,Sc).call(y,E))}}c.push(l.nodeValue.slice(0,h).replaceAll(ic,""))}else if(l===this.editorDiv){let w=c,_=0;for(const E of this.editorDiv.childNodes)_++===h&&(w=f),w.push(b(v=et,Ma,Sc).call(v,E))}p(this,pe,`${c.join(`
`)}${r}${f.join(`
`)}`),b(this,La,Ec).call(this);const g=new Range;let m=c.reduce((w,_)=>w+_.length,0);for(const{firstChild:w}of this.editorDiv.childNodes)if(w.nodeType===Node.TEXT_NODE){const _=w.nodeValue.length;if(m<=_){g.setStart(w,m),g.setEnd(w,m);break}m-=_}a.removeAllRanges(),a.addRange(g)}get contentDiv(){return this.editorDiv}static deserialize(e,s,i){return I(this,null,function*(){var o;let r=null;if(e instanceof pm){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:f,id:g,popupRef:m},textContent:A,textPosition:y,parent:{page:{pageNumber:v}}}=e;if(!A||A.length===0)return null;r=e={annotationType:G.FREETEXT,color:Array.from(h),fontSize:l,value:A.join(`
`),position:y,pageIndex:v-1,rect:c.slice(0),rotation:f,id:g,deleted:!1,popupRef:m}}const a=yield ji(et,this,"deserialize").call(this,e,s,i);return p(a,ge,e.fontSize),p(a,Ge,F.makeHexColor(...e.color)),p(a,pe,b(o=et,gh,zf).call(o,e.value)),a.annotationElementId=e.id||null,a._initialData=r,a})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const s=et._internalPadding*this.parentScale,i=this.getRect(s,s),r=ut._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:n(this,Ge)),a={annotationType:G.FREETEXT,color:r,fontSize:n(this,ge),value:b(this,qd,_m).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!b(this,Yd,Sm).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(e){const s=super.renderAnnotationElement(e);if(this.deleted)return s;const{style:i}=s;i.fontSize=`calc(${n(this,ge)}px * var(--scale-factor))`,i.color=n(this,Ge),s.replaceChildren();for(const a of n(this,pe).split(`
`)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),s.append(o)}const r=et._internalPadding*this.parentScale;return e.updateEdited({rect:this.getRect(r,r),popupContent:n(this,pe)}),s}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Ge=new WeakMap,pe=new WeakMap,ph=new WeakMap,Xn=new WeakMap,ge=new WeakMap,jd=new WeakSet,ym=function(e){const s=r=>{this.editorDiv.style.fontSize=`calc(${r}px * var(--scale-factor))`,this.translate(0,-(r-n(this,ge))*this.parentScale),p(this,ge,r),b(this,ka,_c).call(this)},i=n(this,ge);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},Wd=new WeakSet,wm=function(e){const s=r=>{p(this,Ge,this.editorDiv.style.color=r)},i=n(this,Ge);this.addCommands({cmd:s.bind(this,e),undo:s.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:K.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Xd=new WeakSet,vm=function(){var i;const e=[];this.editorDiv.normalize();let s=null;for(const r of this.editorDiv.childNodes)(s==null?void 0:s.nodeType)===Node.TEXT_NODE&&r.nodeName==="BR"||(e.push(b(i=et,Ma,Sc).call(i,r)),s=r);return e.join(`
`)},ka=new WeakSet,_c=function(){const[e,s]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:r,div:a}=this,o=a.style.display,l=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",r.div.append(this.div),i=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",l)}this.rotation%180===this.parentRotation%180?(this.width=i.width/e,this.height=i.height/s):(this.width=i.height/e,this.height=i.width/s),this.fixAndSetPosition()},Ma=new WeakSet,Sc=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(ic,"")},La=new WeakSet,Ec=function(){if(this.editorDiv.replaceChildren(),!!n(this,pe))for(const e of n(this,pe).split(`
2025-04-21 13:08:40 +08:00
`)){const s=document.createElement("div");s.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(s)}},qd=new WeakSet,_m=function(){return n(this,pe).replaceAll(" "," ")},gh=new WeakSet,zf=function(e){return e.replaceAll(" "," ")},Yd=new WeakSet,Sm=function(e){const{value:s,fontSize:i,color:r,pageIndex:a}=this._initialData;return this._hasBeenMoved||e.value!==s||e.fontSize!==i||e.color.some((o,l)=>o!==r[l])||e.pageIndex!==a},u(et,Ma),u(et,gh),O(et,"_freeTextDefaultContent",""),O(et,"_internalPadding",0),O(et,"_defaultColor",null),O(et,"_defaultFontSize",10),O(et,"_type","freetext"),O(et,"_editorType",G.FREETEXT);let Hf=et;class L{toSVGPath(){it("Abstract method `toSVGPath` must be implemented.")}get box(){it("Abstract getter `box` must be implemented.")}serialize(t,e){it("Abstract method `serialize` must be implemented.")}static _rescale(t,e,s,i,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o]*i,a[o+1]=s+t[o+1]*r;return a}static _rescaleAndSwap(t,e,s,i,r,a){a||(a=new Float32Array(t.length));for(let o=0,l=t.length;o<l;o+=2)a[o]=e+t[o+1]*i,a[o+1]=s+t[o]*r;return a}static _translate(t,e,s,i){i||(i=new Float32Array(t.length));for(let r=0,a=t.length;r<a;r+=2)i[r]=e+t[r],i[r+1]=s+t[r+1];return i}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,s,i,r){switch(r){case 90:return[1-e/s,t/i];case 180:return[1-t/s,1-e/i];case 270:return[e/s,1-t/i];default:return[t/s,e/i]}}static _normalizePagePoint(t,e,s){switch(s){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,s,i,r,a){return[(t+5*s)/6,(e+5*i)/6,(5*s+r)/6,(5*i+a)/6,(s+r)/2,(i+a)/2]}}O(L,"PRECISION",1e-4);var me,Ve,Ia,Da,ds,W,qn,Yn,mh,bh,Fa,Na,Ti,Ah,Kd,Qd,Kn,Po,Jd,Em,Zd,Cm,tu,xm,eu,Tm,su,Pm,iu,Rm;const Cs=class Cs{constructor({x:t,y:e},s,i,r,a,o=0){u(this,Kn);u(this,Jd);u(this,Zd);u(this,tu);u(this,eu);u(this,su);u(this,iu);u(this,me,void 0);u(this,Ve,[]);u(this,Ia,void 0);u(this,Da,void 0);u(this,ds,[]);u(this,W,new Float32Array(18));u(this,qn,void 0);u(this,Yn,void 0);u(this,mh,void 0);u(this,bh,void 0);u(this,Fa,void 0);u(this,Na,void 0);u(this,Ti,[]);p(this,me,s),p(this,Na,r*i),p(this,Da,a),n(this,W).set([NaN,NaN,NaN,NaN,t,e],6),p(this,Ia,o),p(this,bh,n(Cs,Ah)*i),p(this,mh,n(Cs,Qd)*i),p(this,Fa,i),n(this,Ti).push(t,e)}isEmpty(){return isNaN(n(this,W)[8])}add({x:t,y:e}){var N;p(this,qn,t),p(this,Yn,e);const[s,i,r,a]=n(this,me);let[o,l,h,c]=n(this,W).subarray(8,12);const f=t-h,g=e-c,m=Math.hypot(f,g);if(m<n(this,mh))return!1;const A=m-n(this,bh),y=A/m,v=y*f,w=y*g;let _=o,E=l;o=h,l=c,h+=v,c+=w,(N=n(this,Ti))==null||N.push(t,e);const S=-w/A,C=v/A,P=S*n(this,Na),T=C*n(this,Na);return n(this,W).set(n(this,W).subarray(2,8),0),n(this,W).set([h+P,c+T],4),n(this,W).set(n(this,W).subarray(14,18),12),n(this,W).set([h-P,c-T],16),isNaN(n(this,W)[6])?(n(this,ds).length===0&&(n(this,W).set([o+P,l+T],2),n(this,ds).push(NaN,NaN,NaN,NaN,(o+P-s)/r,(l+T-i)/a),n(this,W).set([o-P,l-T],14),n(this,Ve).push(NaN,NaN,NaN,NaN,(o-P-s)/r,(l-T-i)/a)),n(this,W).set([_,E,o,l,h,c],6),!this.isEmpty()):(n(this,W).set([_,E,o,l,h,c],6),Math.abs(Math.atan2(E-l,_-o)-Math.atan2(w,v))<Math.PI/2?([o,l,h,c]=n(this,W).subarray(2,6),n(this,ds).push(NaN,NaN,NaN,NaN,((o+h)/2-s)/r,((l+c)/2-i)/a),[o,l,_,E]=n(this,W).subarray(14,18),n(this,Ve).push(NaN,NaN,NaN,NaN,((_+o)/2-s)/r,((E+l)/2-i)/a),!0):([_,E,o,l,h,c]=n(this,W).subarray(0,6),n(this,ds).push(((_+5*o)/6-s)/r,((E+5*l)/6-i)/a,((5*o+h)/6-s)/r,((5*l+c)/6-i)/a,((o+h)/2-s)/r,((l+c)/2-i)/a),[h,c,o,l,_,E]=n(this,W).subarray(12,18),n(this,Ve).push(((_+5*o)/6-s)/r,((E+5*l)/6-i)/a,((5*o+h)/6-s)/r,((5*l+c)/6-i)/a,((o+h)/2-s)/r,((l+c)/2-i)/a),!0))}toSVGPath(){if(this.isEmpty())return"";const t=n(this,ds),e=n(this,Ve);if(isNaN(n(this,W)[6])&&!this.isEmpty())return b(this,Jd,Em).call(this);const s=[];s.push(`M${t[4]} ${t[5]}`);for(let i=6;i<t.length;i+=6)isNaN(t[i])?s.push(`L${t[i+4]} ${t[i+5]}`):s.push(`C${t[i]} ${t[i+1]} ${t[i+2]} ${t[i+3]} ${t[i+4]} ${t[i+5]}`);b(this,tu,xm).call(this,s);for(let i=e.length-6;i>=6;i-=6)is