lucius-barcode-designer 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/barcode-designer.js +6419 -0
- package/dist/barcode-designer.umd.cjs +8 -0
- package/dist/lucius-barcode-designer.css +2 -0
- package/dist/src/BarcodeDesigner.d.ts +11 -0
- package/dist/src/components/BarcodePreviewCanvas.d.ts +5 -0
- package/dist/src/components/BlockPropertiesPanel.d.ts +3 -0
- package/dist/src/components/CustomSelect.d.ts +15 -0
- package/dist/src/components/FontSettingsPanel.d.ts +8 -0
- package/dist/src/components/TemplateManager.d.ts +3 -0
- package/dist/src/components/XmlJsonPreview.d.ts +3 -0
- package/dist/src/context/TemplateServiceContext.d.ts +20 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/models/BarcodeBlockDataEnum.d.ts +40 -0
- package/dist/src/models/BarcodeBlockSetting.d.ts +16 -0
- package/dist/src/models/BarcodeMultiZoneSetting.d.ts +27 -0
- package/dist/src/models/FontSetting.d.ts +16 -0
- package/dist/src/models/TemplateConfig.d.ts +18 -0
- package/dist/src/services/BarcodeDrawService.d.ts +4 -0
- package/dist/src/services/Code128Encoder.d.ts +8 -0
- package/dist/src/services/XmlSerializer.d.ts +9 -0
- package/dist/src/services/api.d.ts +2 -0
- package/dist/src/services/templateService.d.ts +47 -0
- package/dist/src/store/useBarcodeStore.d.ts +58 -0
- package/package.json +44 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("axios"),require("react-dom"),require("react/jsx-runtime")):typeof define==`function`&&define.amd?define([`exports`,`react`,`axios`,`react-dom`,`react/jsx-runtime`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.BarcodeDesignerLib={},e.React,e.axios,e.ReactDOM,e.ReactJsxRuntime))})(this,function(e,t,n,r,i){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var a=Object.create,o=Object.defineProperty,s=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,l=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty,d=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=c(t),a=0,l=i.length,d;a<l;a++)d=i[a],!u.call(e,d)&&d!==n&&o(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(r=s(t,d))||r.enumerable});return e},f=(e,t,n)=>(n=e==null?{}:a(l(e)),d(t||!e||!e.__esModule?o(n,`default`,{value:e,enumerable:!0}):n,e));t=f(t,1),n=f(n,1),r=f(r,1);var p=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},m=(e=>e?p(e):p),h=e=>e;function g(e,n=h){let r=t.default.useSyncExternalStore(e.subscribe,t.default.useCallback(()=>n(e.getState()),[e,n]),t.default.useCallback(()=>n(e.getInitialState()),[e,n]));return t.default.useDebugValue(r),r}var _=e=>{let t=m(e),n=e=>g(t,e);return Object.assign(n,t),n},v=(e=>e?_(e):_);function y(){return{FontFamily:`Tahoma`,FontSize:3,LeftIndent:0,RightIndent:0,IsBold:!1,IsItalic:!1,Align:`Center`,SampleText:`Text mẫu`}}function b(e){switch(e){case`Near`:return`left`;case`Center`:return`center`;case`Far`:return`right`;default:return`center`}}var x=function(e){return e.Seq=`Seq`,e.SID=`SID`,e.PID=`PID`,e.PatientName=`PatientName`,e.OrderID=`OrderID`,e.Invoice=`Invoice`,e.DateOfBirth=`DateOfBirth`,e.NamSinh=`NamSinh`,e.Tuoi=`Tuoi`,e.Sex=`Sex`,e.SexDisplay=`SexDisplay`,e.Address=`Address`,e.ChanDoan=`ChanDoan`,e.LocationID=`LocationID`,e.LocationName=`LocationName`,e.ObjectID=`ObjectID`,e.ObjectName=`ObjectName`,e.DoctorID=`DoctorID`,e.DoctorName=`DoctorName`,e.GroupCategoryID=`GroupCategoryID`,e.DateIn=`DateIn`,e.InTime=`InTime`,e.Urgent=`Urgent`,e.PrintTime=`PrintTime`,e.TypeID=`TypeID`,e.TypeName=`TypeName`,e.TypeSampleSEQ=`TypeSampleSEQ`,e.STT=`STT`,e.Notice=`Notice`,e.UuTien=`UuTien`,e.DepartmentReception=`DepartmentReception`,e.SourceLocationID=`SourceLocationID`,e.SourceLocationName=`SourceLocationName`,e}({}),S={Seq:`Seq`,SID:`SID`,PID:`Mã bệnh nhân`,PatientName:`Tên bệnh nhân`,OrderID:`Số phiếu`,Invoice:`Mã y tế`,DateOfBirth:`Ngày sinh`,NamSinh:`Năm sinh`,Tuoi:`Tuổi`,Sex:`Sex`,SexDisplay:`Giới tính`,Address:`Địa chỉ`,ChanDoan:`Chẩn đoán`,LocationID:`Mã khoa phòng`,LocationName:`Tên khoa phòng`,ObjectID:`Mã đối tượng`,ObjectName:`Tên đối tượng`,DoctorID:`Mã bác sĩ`,DoctorName:`Tên bác sĩ`,GroupCategoryID:`Nhóm chung xét nghiệm`,DateIn:`Ngày nhập`,InTime:`Thời gian nhập`,Urgent:`Cấp Cứu`,PrintTime:`Thời gian in barcode`,TypeID:`Mã loại mẫu`,TypeName:`Tên loại mẫu`,TypeSampleSEQ:`Số thứ tự mẫu`,STT:`STT`,Notice:`Ghi chú test`,UuTien:`Ưu tiên`,DepartmentReception:`Khoa tiếp nhận`,SourceLocationID:`Mã khu vực gửi mẫu`,SourceLocationName:`Tên khu vực gửi mẫu`};function C(){return Object.values(x).map(e=>({id:e,name:S[e]}))}function w(){return{OffsetX:0,OffsetY:0,Width:30,Height:5,Angle:0,Data:null,ShowBorder:!1,FontSetting:y()}}function T(e,t){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=Number(e);if(Number.isFinite(t))return t}return t}function E(e,t){if(typeof e==`boolean`)return e;if(typeof e==`string`){if(e.toLowerCase()===`true`)return!0;if(e.toLowerCase()===`false`)return!1}return t}function D(e,t){for(let n of t){let t=e[n];if(t!==void 0)return t}}function O(e){let t=e??{},n=w(),r=D(t,[`FontSetting`,`fontSetting`]),i=r&&typeof r==`object`?r:{},a=y(),o=D(i,[`Align`,`align`]),s=o===`Near`||o===`Center`||o===`Far`?o:a.Align,c=D(t,[`Data`,`data`]),l=D(i,[`SampleText`,`sampleText`]);return{OffsetX:T(D(t,[`OffsetX`,`offsetX`]),n.OffsetX),OffsetY:T(D(t,[`OffsetY`,`offsetY`]),n.OffsetY),Width:T(D(t,[`Width`,`width`]),n.Width),Height:T(D(t,[`Height`,`height`]),n.Height),Angle:T(D(t,[`Angle`,`angle`]),n.Angle),Data:c??n.Data,ShowBorder:E(D(t,[`ShowBorder`,`showBorder`]),n.ShowBorder),FontSetting:{FontFamily:String(D(i,[`FontFamily`,`fontFamily`])??a.FontFamily),FontSize:T(D(i,[`FontSize`,`fontSize`]),a.FontSize),LeftIndent:T(D(i,[`LeftIndent`,`leftIndent`]),a.LeftIndent),RightIndent:T(D(i,[`RightIndent`,`rightIndent`]),a.RightIndent),IsBold:E(D(i,[`IsBold`,`isBold`]),a.IsBold),IsItalic:E(D(i,[`IsItalic`,`isItalic`]),a.IsItalic),Align:s,SampleText:l==null?a.SampleText:String(l)}}}var k=function(e){return e[e.Normal=0]=`Normal`,e[e.Rotate90=1]=`Rotate90`,e[e.Rotate180=2]=`Rotate180`,e[e.Rotate270=3]=`Rotate270`,e}({});function A(){return{PaperSizeW:110,PaperSizeH:22,DPI:0,StampsPerPage:2,MarginLeft:0,MarginRight:0,MarginTop:0,MarginBottom:0,BarCodeWidth:30,BarCodeHeight:7,BarcodeOffsetLeft:10,BarcodeOffsetTop:10,BarcodePrinterName:``,SamplpeBarcode:`1001`,BarcodeBlockSettings:[],Orientation:0}}function j(e,t){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e==`string`){let t=Number(e);if(Number.isFinite(t))return t}return t}function M(e,t){for(let n of t){let t=e[n];if(t!==void 0)return t}}function N(e){let t=e??{},n=A(),r=M(t,[`BarcodeBlockSettings`,`barcodeBlockSettings`]),i=Array.isArray(r)?r.map(e=>O(e)):n.BarcodeBlockSettings;return{PaperSizeW:j(M(t,[`PaperSizeW`,`paperSizeW`]),n.PaperSizeW),PaperSizeH:j(M(t,[`PaperSizeH`,`paperSizeH`]),n.PaperSizeH),DPI:j(M(t,[`DPI`,`dpi`]),n.DPI),StampsPerPage:Math.max(1,Math.trunc(j(M(t,[`StampsPerPage`,`stampsPerPage`]),n.StampsPerPage))),MarginLeft:j(M(t,[`MarginLeft`,`marginLeft`]),n.MarginLeft),MarginRight:j(M(t,[`MarginRight`,`marginRight`]),n.MarginRight),MarginTop:j(M(t,[`MarginTop`,`marginTop`]),n.MarginTop),MarginBottom:j(M(t,[`MarginBottom`,`marginBottom`]),n.MarginBottom),BarCodeWidth:j(M(t,[`BarCodeWidth`,`barCodeWidth`]),n.BarCodeWidth),BarCodeHeight:j(M(t,[`BarCodeHeight`,`barCodeHeight`]),n.BarCodeHeight),BarcodeOffsetLeft:j(M(t,[`BarcodeOffsetLeft`,`barcodeOffsetLeft`]),n.BarcodeOffsetLeft),BarcodeOffsetTop:j(M(t,[`BarcodeOffsetTop`,`barcodeOffsetTop`]),n.BarcodeOffsetTop),BarcodePrinterName:String(M(t,[`BarcodePrinterName`,`barcodePrinterName`])??n.BarcodePrinterName),SamplpeBarcode:String(M(t,[`SamplpeBarcode`,`samplpeBarcode`])??n.SamplpeBarcode),BarcodeBlockSettings:i,Orientation:j(M(t,[`Orientation`,`orientation`]),n.Orientation)}}var P=`barcode-designer-templates`;function F(){try{let e=localStorage.getItem(P);if(e)return JSON.parse(e)}catch{}return[]}function I(e){localStorage.setItem(P,JSON.stringify(e))}var L=e=>{let t=e;return t&&typeof t==`object`&&`data`in t?t.data:e},R=function(e){return e[e.Tube=0]=`Tube`,e[e.Specimen=1]=`Specimen`,e}({});function ee(e){return{getPrinters:async t=>L((await e.get(`/printerinfo`,{params:{searchText:t}})).data)||[],createPrinter:async t=>L((await e.post(`/printerinfo`,t)).data),updatePrinter:async(t,n)=>L((await e.put(`/printerinfo/${t}`,{...n,id:t})).data),deletePrinter:async t=>L((await e.delete(`/printerinfo/${t}`)).data),getTemplates:async t=>L((await e.get(`/barcodeagenttemplate`,{params:{type:t?.type,printerInfoId:t?.printerInfoId}})).data)||[],createTemplate:async t=>L((await e.post(`/barcodeagenttemplate`,t)).data),updateTemplate:async(t,n)=>L((await e.put(`/barcodeagenttemplate/${t}`,{...n,id:t})).data),deleteTemplate:async t=>L((await e.delete(`/barcodeagenttemplate/${t}`)).data)}}var te=null,z=v((e,t)=>({settings:A(),templates:F(),selectedBlockIndex:-1,showBorder:!0,showXmlPreview:!1,activeContext:null,printApiBaseUrl:null,past:[],future:[],toast:null,selectedTemplateId:null,selectedPrinterId:null,selectedTemplateType:null,canvasOffset:{x:0,y:0},setCanvasOffset:t=>e({canvasOffset:t}),resetCanvasOffset:()=>e({canvasOffset:{x:0,y:0}}),undo:()=>{let n=t();if(n.past.length===0)return;let r=n.past[n.past.length-1];e({settings:r,past:n.past.slice(0,-1),future:[n.settings,...n.future.slice(0,49)]})},redo:()=>{let n=t();if(n.future.length===0)return;let r=n.future[0];e({settings:r,past:[...n.past.slice(-49),n.settings],future:n.future.slice(1)})},showToast:(t,n)=>{te&&clearTimeout(te),e({toast:{type:t,message:n}}),te=setTimeout(()=>e({toast:null}),2500)},setSelectedTemplate:(t,n,r)=>e({selectedTemplateId:t,selectedPrinterId:n,selectedTemplateType:r}),updateSettings:t=>e(e=>({past:[...e.past.slice(-49),e.settings],future:[],settings:N({...e.settings,...t})})),setSettings:t=>e(e=>({past:[...e.past.slice(-49),e.settings],future:[],settings:N(t)})),addBlock:t=>e(e=>{let n=O(t),r={...e.settings,BarcodeBlockSettings:[...e.settings.BarcodeBlockSettings,n]};return{past:[...e.past.slice(-49),e.settings],future:[],settings:r,selectedBlockIndex:r.BarcodeBlockSettings.length-1}}),editBlock:(t,n)=>e(e=>{let r=[...e.settings.BarcodeBlockSettings];return r[t]=O(n),{past:[...e.past.slice(-49),e.settings],future:[],settings:N({...e.settings,BarcodeBlockSettings:r})}}),removeBlock:t=>e(e=>{let n=e.settings.BarcodeBlockSettings.filter((e,n)=>n!==t);return{past:[...e.past.slice(-49),e.settings],future:[],settings:N({...e.settings,BarcodeBlockSettings:n}),selectedBlockIndex:-1}}),selectBlock:t=>e({selectedBlockIndex:t}),loadTemplates:()=>e({templates:F()}),saveTemplate:n=>{let r=t(),i=new Date().toISOString(),a=r.templates.findIndex(e=>e.name===n),o;a>=0?(o=[...r.templates],o[a]={name:n,settings:{...r.settings},createdAt:o[a].createdAt,updatedAt:i}):o=[...r.templates,{name:n,settings:{...r.settings},createdAt:i,updatedAt:i}],I(o),e({templates:o})},loadTemplate:n=>{let r=t().templates.find(e=>e.name===n);r&&e({settings:N({...r.settings})})},deleteTemplate:n=>{let r=t().templates.filter(e=>e.name!==n);I(r),e({templates:r})},renameTemplate:(n,r)=>{let i=t().templates.map(e=>e.name===n?{...e,name:r,updatedAt:new Date().toISOString()}:e);I(i),e({templates:i})},setShowBorder:t=>e({showBorder:t}),setShowXmlPreview:t=>e({showXmlPreview:t}),setActiveContext:t=>e({activeContext:t}),setPrintApiBaseUrl:t=>e({printApiBaseUrl:t})})),B=null,ne=()=>(0,i.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m6 9 6 6 6-6`})}),V=()=>(0,i.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`m18 15-6-6-6 6`})}),re=({value:e,onChange:n,options:a,className:o=``,placeholder:s,onClick:c})=>{let[l,u]=(0,t.useState)(!1),[d,f]=(0,t.useState)({}),p=(0,t.useRef)(null),m=(0,t.useRef)(null),h=(0,t.useRef)(Symbol()),g=a.find(t=>t.value===e),_=g?.label??s??``,v=(0,t.useCallback)(()=>u(!1),[]),y=(0,t.useCallback)(()=>{if(B&&B(),!p.current)return;let e=p.current.getBoundingClientRect();f({position:`fixed`,top:e.bottom+4,left:e.left,width:e.width,zIndex:9999}),u(!0),B=v},[v]);(0,t.useEffect)(()=>{if(!l){B===v&&(B=null);return}h.current;let e=e=>{p.current?.contains(e.target)||m.current?.contains(e.target)||u(!1)};return document.addEventListener(`mousedown`,e,!0),()=>{document.removeEventListener(`mousedown`,e,!0)}},[l,v]),(0,t.useEffect)(()=>()=>{B===v&&(B=null)},[v]);let b=e=>{e.preventDefault(),e.stopPropagation(),l?(u(!1),B===v&&(B=null)):y()},x=l?r.default.createPortal((0,i.jsx)(`div`,{ref:m,className:`bcd-root`,children:(0,i.jsx)(`div`,{className:`bcd-select-menu`,style:d,children:a.map(t=>(0,i.jsxs)(`div`,{className:`bcd-select-item ${t.value===e?`bcd-select-item-active`:``}`,onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),n(t.value),u(!1),B===v&&(B=null)},children:[t.value===e&&(0,i.jsx)(`svg`,{className:`bcd-select-check`,width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,i.jsx)(`path`,{d:`M20 6 9 17l-5-5`})}),t.label]},t.value))})}),document.body):null;return(0,i.jsxs)(`div`,{className:`bcd-select-wrapper ${o}`,onClick:c,children:[(0,i.jsxs)(`button`,{ref:p,type:`button`,className:`bcd-select-trigger ${l?`bcd-select-open`:``} ${!g&&s?`bcd-select-placeholder`:``}`,onMouseDown:b,onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`span`,{className:`bcd-select-label`,children:_}),(0,i.jsx)(`span`,{className:`bcd-select-chevron`,children:l?(0,i.jsx)(V,{}):(0,i.jsx)(ne,{})})]}),x]})},ie=(0,t.createContext)(null);function ae(){let e=(0,t.useContext)(ie);if(!e)throw Error(`TemplateServiceContext not provided — wrap with BarcodeDesigner`);return e}var oe=[{value:R.Tube,label:`Tube`},{value:R.Specimen,label:`Specimen`}],H=e=>{let t=e;return t.response?.data?.message||t.message||`Có lỗi xảy ra khi gọi API.`},se=e=>{if(!e)return`--`;let t=new Date(e);return Number.isNaN(t.getTime())?`--`:new Intl.DateTimeFormat(`vi-VN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).format(t)},ce=()=>{let{settings:e,setSettings:n,setShowXmlPreview:r,setActiveContext:a,setSelectedTemplate:o,showToast:s}=z(),c=ae(),[l,u]=(0,t.useState)([]),[d,f]=(0,t.useState)([]),[p,m]=(0,t.useState)(``),[h,g]=(0,t.useState)(``),[_,v]=(0,t.useState)({}),[y,b]=(0,t.useState)(!1),[x,S]=(0,t.useState)(!1),[C,w]=(0,t.useState)(!1),[T,E]=(0,t.useState)(null),[D,O]=(0,t.useState)({open:!1,mode:`create`,code:``,name:``}),[k,A]=(0,t.useState)({open:!1,mode:`create`,type:R.Tube}),[j,M]=(0,t.useState)({open:!1,kind:`printer`,id:``,label:``}),N=l.find(e=>e.id===p)||null,P=async()=>{b(!0);try{let e=await c.getPrinters();u(e),m(t=>e.length===0?``:t&&e.some(e=>e.id===t)?t:e[0].id)}catch(e){E({type:`error`,message:H(e)})}finally{b(!1)}},F=async(e,t)=>{if(!e){f([]),g(``);return}S(!0);try{let n=await c.getTemplates({printerInfoId:e});f(n),g(e=>{let r=t||e;return r&&n.some(e=>e.id===r)?r:n[0]?.id||``})}catch(e){E({type:`error`,message:H(e)})}finally{S(!1)}};(0,t.useEffect)(()=>{P()},[]),(0,t.useEffect)(()=>{if(!p){f([]),g(``);return}F(p)},[p]),(0,t.useEffect)(()=>{v(e=>{let t={};return d.forEach(n=>{t[n.id]=e[n.id]??n.type}),t})},[d]);let I=()=>{O({open:!0,mode:`create`,code:``,name:``})},L=e=>{O({open:!0,mode:`edit`,id:e.id,code:e.code,name:e.name||``})},ee=()=>{O(e=>({...e,open:!1}))},te=async()=>{let e=D.code.trim(),t=D.name.trim();if(!e||!t){E({type:`error`,message:`Vui lòng nhập đầy đủ mã và tên máy in.`});return}w(!0);try{let n=D.id;D.mode===`edit`&&D.id?(await c.updatePrinter(D.id,{code:e,name:t}),E({type:`success`,message:`Cập nhật máy in thành công.`})):(n=await c.createPrinter({code:e,name:t}),E({type:`success`,message:`Tạo máy in thành công.`})),ee(),await P(),n&&m(n)}catch(e){E({type:`error`,message:H(e)})}finally{w(!1)}},B=async e=>{M({open:!0,kind:`printer`,id:e.id,label:e.name||e.code})},ne=()=>{if(!p){E({type:`error`,message:`Vui lòng chọn máy in trước khi tạo template.`});return}A({open:!0,mode:`create`,type:R.Tube})},V=()=>{A(e=>({...e,open:!1}))},ie=async()=>{if(!p){E({type:`error`,message:`Vui lòng chọn máy in hợp lệ trước khi lưu template.`});return}w(!0);try{if(k.mode===`edit`&&k.id)await c.updateTemplate(k.id,{settings:e,type:k.type,printerInfoId:p}),E({type:`success`,message:`Cập nhật template thành công.`}),V(),await F(p,k.id);else{let t=await c.createTemplate({settings:e,type:k.type,printerInfoId:p});E({type:`success`,message:`Tạo template thành công.`}),V(),await F(p,t)}}catch(e){E({type:`error`,message:H(e)})}finally{w(!1)}},ce=async e=>{M({open:!0,kind:`template`,id:e.id,label:e.id.substring(0,8)})},le=async()=>{M(e=>({...e,open:!1})),w(!0);try{j.kind===`printer`?(await c.deletePrinter(j.id),E({type:`success`,message:`Xóa máy in thành công.`}),await P()):(await c.deleteTemplate(j.id),E({type:`success`,message:`Xóa template thành công.`}),await F(p))}catch(e){E({type:`error`,message:H(e)})}finally{w(!1)}},ue=e=>{if(!e.settings){E({type:`error`,message:`Template không có dữ liệu settings.`});return}g(e.id),n(e.settings),o(e.id,e.printerInfoId||p,e.type),a({printerName:N?.name||N?.code||``,templateId:e.id.substring(0,8)})},de=async t=>{let n=t.printerInfoId||p;if(!n){E({type:`error`,message:`Vui lòng chọn máy in hợp lệ trước khi lưu template.`});return}w(!0);try{let r=_[t.id]??t.type;await c.updateTemplate(t.id,{settings:e,type:r,printerInfoId:n}),E({type:`success`,message:`Cập nhật template thành công.`}),s(`success`,`Đã lưu template.`),await F(n,t.id)}catch(e){E({type:`error`,message:H(e)})}finally{w(!1)}};return(0,i.jsxs)(`div`,{className:`panel template-panel`,children:[(0,i.jsxs)(`div`,{className:`panel-body`,children:[(0,i.jsxs)(`div`,{className:`template-dashboard`,children:[(0,i.jsxs)(`div`,{className:`template-left-header`,children:[(0,i.jsx)(`button`,{className:`btn btn-primary btn-full`,onClick:I,disabled:C,children:`+ Tạo máy in`}),(0,i.jsxs)(`button`,{className:`btn btn-accent btn-full`,onClick:()=>r(!0),children:[`</>`,` Xem XML / JSON`]})]}),(0,i.jsxs)(`section`,{className:`template-list-block`,children:[(0,i.jsxs)(`div`,{className:`template-block-header`,children:[(0,i.jsx)(`h4`,{children:`Danh sách máy in`}),(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6},children:[(0,i.jsx)(`span`,{className:`template-count`,children:l.length}),(0,i.jsx)(`button`,{className:`btn btn-sm btn-secondary btn-icon`,onClick:()=>void P(),disabled:y||C,title:`Làm mới máy in`,children:(0,i.jsx)(`svg`,{className:y?`spin`:``,width:`13`,height:`13`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,i.jsx)(`path`,{d:`M4.55344 3.69418C6.01427 2.43106 7.91855 1.66699 10.0013 1.66699C14.6036 1.66699 18.3346 5.39795 18.3346 10.0003C18.3346 11.7804 17.7765 13.4302 16.8256 14.7842L14.168 10.0003H16.668C16.668 6.31843 13.6832 3.33366 10.0013 3.33366C8.20949 3.33366 6.58278 4.04055 5.38483 5.19068L4.55344 3.69418ZM15.4491 16.3065C13.9883 17.5696 12.0841 18.3337 10.0013 18.3337C5.39893 18.3337 1.66797 14.6027 1.66797 10.0003C1.66797 8.22021 2.22613 6.57046 3.17697 5.21653L5.83464 10.0003H3.33464C3.33464 13.6822 6.3194 16.667 10.0013 16.667C11.7931 16.667 13.4198 15.9601 14.6178 14.81L15.4491 16.3065Z`,fill:`currentColor`})})})]})]}),l.length===0?(0,i.jsx)(`div`,{className:`template-empty-hint`,children:`Chưa có máy in.`}):(0,i.jsx)(`div`,{className:`template-list`,children:l.map(e=>(0,i.jsxs)(`div`,{className:`template-card template-row-card ${p===e.id?`selected`:``}`,onClick:()=>m(e.id),children:[(0,i.jsxs)(`div`,{className:`template-row-main`,children:[(0,i.jsx)(`h4`,{children:e.name||`(Không tên)`}),(0,i.jsx)(`p`,{children:e.code})]}),(0,i.jsxs)(`div`,{className:`template-row-actions hover-hidden`,onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`button`,{className:`btn btn-sm btn-secondary`,onClick:()=>L(e),disabled:C,children:`Sửa`}),(0,i.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>void B(e),disabled:C,children:`Xóa`})]})]},e.id))})]}),(0,i.jsxs)(`section`,{className:`template-list-block`,children:[(0,i.jsxs)(`div`,{className:`template-block-header`,children:[(0,i.jsxs)(`h4`,{children:[`Template`,N?` - ${N.name||N.code}`:``]}),(0,i.jsxs)(`div`,{className:`template-block-actions`,children:[(0,i.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:ne,disabled:!p||C,children:`Tạo template`}),(0,i.jsx)(`button`,{className:`btn btn-sm btn-secondary btn-icon`,onClick:()=>void F(p),disabled:!p||x||C,title:`Làm mới template`,children:(0,i.jsx)(`svg`,{className:x?`spin`:``,width:`16`,height:`16`,viewBox:`0 0 20 20`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:(0,i.jsx)(`path`,{d:`M4.55344 3.69418C6.01427 2.43106 7.91855 1.66699 10.0013 1.66699C14.6036 1.66699 18.3346 5.39795 18.3346 10.0003C18.3346 11.7804 17.7765 13.4302 16.8256 14.7842L14.168 10.0003H16.668C16.668 6.31843 13.6832 3.33366 10.0013 3.33366C8.20949 3.33366 6.58278 4.04055 5.38483 5.19068L4.55344 3.69418ZM15.4491 16.3065C13.9883 17.5696 12.0841 18.3337 10.0013 18.3337C5.39893 18.3337 1.66797 14.6027 1.66797 10.0003C1.66797 8.22021 2.22613 6.57046 3.17697 5.21653L5.83464 10.0003H3.33464C3.33464 13.6822 6.3194 16.667 10.0013 16.667C11.7931 16.667 13.4198 15.9601 14.6178 14.81L15.4491 16.3065Z`,fill:`currentColor`})})})]})]}),p?x?(0,i.jsx)(`div`,{className:`template-empty-hint`,children:`Đang tải template...`}):d.length===0?(0,i.jsx)(`div`,{className:`template-empty-hint`,children:`Máy in này chưa có template.`}):(0,i.jsx)(`div`,{className:`template-list`,children:d.map(e=>(0,i.jsxs)(`div`,{className:`template-card template-row-card ${h===e.id?`selected`:``}`,onClick:()=>ue(e),children:[(0,i.jsxs)(`div`,{className:`template-row-main`,children:[(0,i.jsx)(`h4`,{children:e.id.substring(0,8)}),(0,i.jsx)(`div`,{className:`template-row template-row-inline`,children:(0,i.jsx)(`select`,{className:`template-type-pill`,value:String(_[e.id]??e.type),onClick:e=>e.stopPropagation(),onChange:t=>v(n=>({...n,[e.id]:Number(t.target.value)})),children:oe.map(e=>(0,i.jsx)(`option`,{value:e.value,children:e.label},e.value))})}),(0,i.jsx)(`span`,{className:`template-inline-meta`,children:se(e.updatedAt||e.createdAt)})]}),(0,i.jsxs)(`div`,{className:`template-row-actions hover-hidden`,onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`button`,{className:`btn btn-sm btn-secondary`,onClick:()=>void de(e),disabled:C,children:`Lưu`}),(0,i.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>void ce(e),disabled:C,children:`Xóa`})]})]},e.id))}):(0,i.jsx)(`div`,{className:`template-empty-hint`,children:`Chọn máy in để xem template.`})]})]}),T&&(0,i.jsx)(`div`,{className:`template-notice ${T.type===`error`?`error`:`success`}`,children:T.message})]}),D.open&&(0,i.jsx)(`div`,{className:`modal-overlay`,onClick:ee,children:(0,i.jsxs)(`div`,{className:`modal template-modal`,onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)(`div`,{className:`modal-header`,children:[(0,i.jsx)(`h3`,{children:D.mode===`edit`?`Sửa máy in`:`Tạo máy in`}),(0,i.jsx)(`button`,{className:`btn-close`,onClick:ee,children:`×`})]}),(0,i.jsxs)(`div`,{className:`modal-body template-modal-body`,children:[(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Mã máy in`}),(0,i.jsx)(`input`,{type:`text`,value:D.code,onChange:e=>O(t=>({...t,code:e.target.value})),placeholder:`Nhập mã máy in`})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Tên máy in`}),(0,i.jsx)(`input`,{type:`text`,value:D.name,onChange:e=>O(t=>({...t,name:e.target.value})),placeholder:`Nhập tên máy in`})]})]}),(0,i.jsxs)(`div`,{className:`modal-footer`,children:[(0,i.jsx)(`button`,{className:`btn btn-secondary`,onClick:ee,disabled:C,children:`Hủy`}),(0,i.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>void te(),disabled:C,children:D.mode===`edit`?`Cập nhật`:`Tạo máy in`})]})]})}),k.open&&(0,i.jsx)(`div`,{className:`modal-overlay`,onClick:V,children:(0,i.jsxs)(`div`,{className:`modal template-modal`,onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)(`div`,{className:`modal-header`,children:[(0,i.jsx)(`h3`,{children:k.mode===`edit`?`Sửa template`:`Tạo template mới`}),(0,i.jsx)(`button`,{className:`btn-close`,onClick:V,children:`×`})]}),(0,i.jsxs)(`div`,{className:`modal-body template-modal-body`,children:[(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Type`}),(0,i.jsx)(re,{value:String(k.type),onChange:e=>A(t=>({...t,type:Number(e)})),options:oe.map(e=>({value:String(e.value),label:e.label}))})]}),(0,i.jsx)(`div`,{className:`template-hint`,children:`Lưu sẽ dùng layout hiện tại trong editor.`})]}),(0,i.jsxs)(`div`,{className:`modal-footer`,children:[(0,i.jsx)(`button`,{className:`btn btn-secondary`,onClick:V,disabled:C,children:`Hủy`}),(0,i.jsx)(`button`,{className:`btn btn-primary`,onClick:()=>void ie(),disabled:C,children:k.mode===`edit`?`Cập nhật`:`Tạo template`})]})]})}),j.open&&(0,i.jsx)(`div`,{className:`modal-overlay`,onClick:()=>M(e=>({...e,open:!1})),children:(0,i.jsxs)(`div`,{className:`modal delete-modal`,onClick:e=>e.stopPropagation(),children:[(0,i.jsx)(`button`,{className:`btn-close`,style:{position:`absolute`,top:14,right:16},onClick:()=>M(e=>({...e,open:!1})),children:`×`}),(0,i.jsxs)(`div`,{className:`delete-modal-body`,children:[(0,i.jsxs)(`svg`,{width:`72`,height:`70`,viewBox:`0 0 72 70`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,i.jsx)(`rect`,{width:`72`,height:`70`,rx:`35`,fill:`#FF3535`,fillOpacity:`0.15`}),(0,i.jsx)(`rect`,{x:`16`,y:`15`,width:`40`,height:`40`,rx:`20`,fill:`#FF3535`}),(0,i.jsx)(`path`,{d:`M36 45C30.4771 45 26 40.5228 26 35C26 29.4771 30.4771 25 36 25C41.5228 25 46 29.4771 46 35C46 40.5228 41.5228 45 36 45ZM36 43C40.4183 43 44 39.4183 44 35C44 30.5817 40.4183 27 36 27C31.5817 27 28 30.5817 28 35C28 39.4183 31.5817 43 36 43ZM35 39C35 38.4477 35.4477 38 36 38C36.5523 38 37 38.4477 37 39C37 39.5523 36.5523 40 36 40C35.4477 40 35 39.5523 35 39ZM35 31C35 30.4477 35.4477 30 36 30C36.5523 30 37 30.4477 37 31V35C37 35.5523 36.5523 36 36 36C35.4477 36 35 35.5523 35 35V31Z`,fill:`white`})]}),(0,i.jsxs)(`div`,{className:`delete-modal-text`,children:[(0,i.jsxs)(`p`,{className:`delete-modal-title`,children:[`Bạn có chắc muốn xóa `,j.kind===`printer`?`máy in`:`template`,` này`]}),(0,i.jsxs)(`p`,{className:`delete-modal-subtitle`,children:[(0,i.jsx)(`strong`,{children:`Lưu ý:`}),` Xóa xong không thể khôi phục lại được`]})]})]}),(0,i.jsxs)(`div`,{className:`delete-modal-footer`,children:[(0,i.jsx)(`button`,{className:`btn btn-secondary delete-modal-btn`,onClick:()=>M(e=>({...e,open:!1})),disabled:C,children:`Hủy`}),(0,i.jsx)(`button`,{className:`btn btn-danger delete-modal-btn`,onClick:()=>void le(),disabled:C,children:`Xác nhận`})]})]})})]})},le=[{value:`0`,a:` `,b:` `,c:`00`,encoding:`11011001100`},{value:`1`,a:`!`,b:`!`,c:`01`,encoding:`11001101100`},{value:`2`,a:`"`,b:`"`,c:`02`,encoding:`11001100110`},{value:`3`,a:`#`,b:`#`,c:`03`,encoding:`10010011000`},{value:`4`,a:`$`,b:`$`,c:`04`,encoding:`10010001100`},{value:`5`,a:`%`,b:`%`,c:`05`,encoding:`10001001100`},{value:`6`,a:`&`,b:`&`,c:`06`,encoding:`10011001000`},{value:`7`,a:`'`,b:`'`,c:`07`,encoding:`10011000100`},{value:`8`,a:`(`,b:`(`,c:`08`,encoding:`10001100100`},{value:`9`,a:`)`,b:`)`,c:`09`,encoding:`11001001000`},{value:`10`,a:`*`,b:`*`,c:`10`,encoding:`11001000100`},{value:`11`,a:`+`,b:`+`,c:`11`,encoding:`11000100100`},{value:`12`,a:`,`,b:`,`,c:`12`,encoding:`10110011100`},{value:`13`,a:`-`,b:`-`,c:`13`,encoding:`10011011100`},{value:`14`,a:`.`,b:`.`,c:`14`,encoding:`10011001110`},{value:`15`,a:`/`,b:`/`,c:`15`,encoding:`10111001100`},{value:`16`,a:`0`,b:`0`,c:`16`,encoding:`10011101100`},{value:`17`,a:`1`,b:`1`,c:`17`,encoding:`10011100110`},{value:`18`,a:`2`,b:`2`,c:`18`,encoding:`11001110010`},{value:`19`,a:`3`,b:`3`,c:`19`,encoding:`11001011100`},{value:`20`,a:`4`,b:`4`,c:`20`,encoding:`11001001110`},{value:`21`,a:`5`,b:`5`,c:`21`,encoding:`11011100100`},{value:`22`,a:`6`,b:`6`,c:`22`,encoding:`11001110100`},{value:`23`,a:`7`,b:`7`,c:`23`,encoding:`11101101110`},{value:`24`,a:`8`,b:`8`,c:`24`,encoding:`11101001100`},{value:`25`,a:`9`,b:`9`,c:`25`,encoding:`11100101100`},{value:`26`,a:`:`,b:`:`,c:`26`,encoding:`11100100110`},{value:`27`,a:`;`,b:`;`,c:`27`,encoding:`11101100100`},{value:`28`,a:`<`,b:`<`,c:`28`,encoding:`11100110100`},{value:`29`,a:`=`,b:`=`,c:`29`,encoding:`11100110010`},{value:`30`,a:`>`,b:`>`,c:`30`,encoding:`11011011000`},{value:`31`,a:`?`,b:`?`,c:`31`,encoding:`11011000110`},{value:`32`,a:`@`,b:`@`,c:`32`,encoding:`11000110110`},{value:`33`,a:`A`,b:`A`,c:`33`,encoding:`10100011000`},{value:`34`,a:`B`,b:`B`,c:`34`,encoding:`10001011000`},{value:`35`,a:`C`,b:`C`,c:`35`,encoding:`10001000110`},{value:`36`,a:`D`,b:`D`,c:`36`,encoding:`10110001000`},{value:`37`,a:`E`,b:`E`,c:`37`,encoding:`10001101000`},{value:`38`,a:`F`,b:`F`,c:`38`,encoding:`10001100010`},{value:`39`,a:`G`,b:`G`,c:`39`,encoding:`11010001000`},{value:`40`,a:`H`,b:`H`,c:`40`,encoding:`11000101000`},{value:`41`,a:`I`,b:`I`,c:`41`,encoding:`11000100010`},{value:`42`,a:`J`,b:`J`,c:`42`,encoding:`10110111000`},{value:`43`,a:`K`,b:`K`,c:`43`,encoding:`10110001110`},{value:`44`,a:`L`,b:`L`,c:`44`,encoding:`10001101110`},{value:`45`,a:`M`,b:`M`,c:`45`,encoding:`10111011000`},{value:`46`,a:`N`,b:`N`,c:`46`,encoding:`10111000110`},{value:`47`,a:`O`,b:`O`,c:`47`,encoding:`10001110110`},{value:`48`,a:`P`,b:`P`,c:`48`,encoding:`11101110110`},{value:`49`,a:`Q`,b:`Q`,c:`49`,encoding:`11010001110`},{value:`50`,a:`R`,b:`R`,c:`50`,encoding:`11000101110`},{value:`51`,a:`S`,b:`S`,c:`51`,encoding:`11011101000`},{value:`52`,a:`T`,b:`T`,c:`52`,encoding:`11011100010`},{value:`53`,a:`U`,b:`U`,c:`53`,encoding:`11011101110`},{value:`54`,a:`V`,b:`V`,c:`54`,encoding:`11101011000`},{value:`55`,a:`W`,b:`W`,c:`55`,encoding:`11101000110`},{value:`56`,a:`X`,b:`X`,c:`56`,encoding:`11100010110`},{value:`57`,a:`Y`,b:`Y`,c:`57`,encoding:`11101101000`},{value:`58`,a:`Z`,b:`Z`,c:`58`,encoding:`11101100010`},{value:`59`,a:`[`,b:`[`,c:`59`,encoding:`11100011010`},{value:`60`,a:`\\`,b:`\\`,c:`60`,encoding:`11101111010`},{value:`61`,a:`]`,b:`]`,c:`61`,encoding:`11001000010`},{value:`62`,a:`^`,b:`^`,c:`62`,encoding:`11110001010`},{value:`63`,a:`_`,b:`_`,c:`63`,encoding:`10100110000`},{value:`64`,a:`\0`,b:"`",c:`64`,encoding:`10100001100`},{value:`65`,a:``,b:`a`,c:`65`,encoding:`10010110000`},{value:`66`,a:``,b:`b`,c:`66`,encoding:`10010000110`},{value:`67`,a:``,b:`c`,c:`67`,encoding:`10000101100`},{value:`68`,a:``,b:`d`,c:`68`,encoding:`10000100110`},{value:`69`,a:``,b:`e`,c:`69`,encoding:`10110010000`},{value:`70`,a:``,b:`f`,c:`70`,encoding:`10110000100`},{value:`71`,a:`\x07`,b:`g`,c:`71`,encoding:`10011010000`},{value:`72`,a:`\b`,b:`h`,c:`72`,encoding:`10011000010`},{value:`73`,a:` `,b:`i`,c:`73`,encoding:`10000110100`},{value:`74`,a:`
|
|
2
|
+
`,b:`j`,c:`74`,encoding:`10000110010`},{value:`75`,a:`\v`,b:`k`,c:`75`,encoding:`11000010010`},{value:`76`,a:`\f`,b:`l`,c:`76`,encoding:`11001010000`},{value:`77`,a:`\r`,b:`m`,c:`77`,encoding:`11110111010`},{value:`78`,a:``,b:`n`,c:`78`,encoding:`11000010100`},{value:`79`,a:``,b:`o`,c:`79`,encoding:`10001111010`},{value:`80`,a:``,b:`p`,c:`80`,encoding:`10100111100`},{value:`81`,a:``,b:`q`,c:`81`,encoding:`10010111100`},{value:`82`,a:``,b:`r`,c:`82`,encoding:`10010011110`},{value:`83`,a:``,b:`s`,c:`83`,encoding:`10111100100`},{value:`84`,a:``,b:`t`,c:`84`,encoding:`10011110100`},{value:`85`,a:``,b:`u`,c:`85`,encoding:`10011110010`},{value:`86`,a:``,b:`v`,c:`86`,encoding:`11110100100`},{value:`87`,a:``,b:`w`,c:`87`,encoding:`11110010100`},{value:`88`,a:``,b:`x`,c:`88`,encoding:`11110010010`},{value:`89`,a:``,b:`y`,c:`89`,encoding:`11011011110`},{value:`90`,a:``,b:`z`,c:`90`,encoding:`11011110110`},{value:`91`,a:`\x1B`,b:`{`,c:`91`,encoding:`11110110110`},{value:`92`,a:``,b:`|`,c:`92`,encoding:`10101111000`},{value:`93`,a:``,b:`}`,c:`93`,encoding:`10100011110`},{value:`94`,a:``,b:`~`,c:`94`,encoding:`10001011110`},{value:`95`,a:``,b:``,c:`95`,encoding:`10111101000`},{value:`96`,a:`Ê`,b:`Ê`,c:`96`,encoding:`10111100010`},{value:`97`,a:`É`,b:`É`,c:`97`,encoding:`11110101000`},{value:`98`,a:`SHIFT`,b:`SHIFT`,c:`98`,encoding:`11110100010`},{value:`99`,a:`CODE_C`,b:`CODE_C`,c:`99`,encoding:`10111011110`},{value:`100`,a:`CODE_B`,b:`Ë`,c:`CODE_B`,encoding:`10111101110`},{value:`101`,a:`Ë`,b:`CODE_A`,c:`CODE_A`,encoding:`11101011110`},{value:`102`,a:`È`,b:`È`,c:`È`,encoding:`11110101110`},{value:`103`,a:`START_A`,b:`START_A`,c:`START_A`,encoding:`11010000100`},{value:`104`,a:`START_B`,b:`START_B`,c:`START_B`,encoding:`11010010000`},{value:`105`,a:`START_C`,b:`START_C`,c:`START_C`,encoding:`11010011100`},{value:``,a:`STOP`,b:`STOP`,c:`STOP`,encoding:`11000111010`}];function ue(e){return le.find(t=>t.b===e)}function de(e){return le.find(t=>t.c===e)}function fe(e){return le.find(t=>t.a===e)}function pe(e){return le.find(t=>t.value===e)}function me(e){return e>=`0`&&e<=`9`}function he(e,t=`DYNAMIC`){let n=[],r=!1;if(t===`B`)for(let t of e)n.push(t);else{let r=e;t===`C`&&r.length%2>0&&(r=`0`+r);let i=``;for(let e of r)me(e)?i===``?i+=e:(i+=e,n.push(i),i=``):(i!==``&&(n.push(i),i=``),n.push(e));i!==``&&n.push(i)}if(t!==`DYNAMIC`)t===`B`?n.unshift(`START_B`):t===`C`&&n.unshift(`START_C`);else{let e=``;for(let t=0;t<n.length;t++){let i=n[t],a=[];if(i.length>1&&(me(i[0])||i.charCodeAt(0)===200)&&(me(i[1])||i.charCodeAt(0)===200)?r?a.push(`CODE_C`):(a.push(`START_C`),r=!0):ue(i)&&(r?a.push(`CODE_B`):(a.push(`START_B`),r=!0)),a.length>0){let r=a[0],i=``;try{i=r.split(`_`)[1]}catch{}if(e!==``&&e===i)continue;e=i||e,n.splice(t,0,...a),t+=a.length}}}let i=()=>{let e=0;for(let t=0;t<n.length;t++){let r=n[t],i=ue(r);if(i||=de(r),!i)continue;let a=parseInt(i.value,10);isNaN(a)||(e+=a*(t===0?1:t))}return pe((e%103).toString())?.encoding||``},a=``;for(let e of n){let n;t===`B`?n=ue(e):t===`C`?n=de(e):(n=ue(e),n||=de(e)),n&&(a+=n.encoding)}a+=i();let o=fe(`STOP`);return o&&(a+=o.encoding),a+=`11`,a}function U(e,t){return e*t}function ge(e,t){let n=U(e.FontSize,t);return`${e.IsItalic?`italic `:``}${e.IsBold?`bold `:``}${n}px "${e.FontFamily}", sans-serif`}function _e(e,t){return e/t}function ve(e,t,n){return _e(e,n)*t}function ye(e,t,n,r,i,a){let o;try{o=he(r)}catch(e){console.warn(`Code128 encode error:`,e);return}if(!o)return;let s=t/o.length;if(s<=0)return;e.fillStyle=`#000`;let c=0,l=-1;for(let t=0;t<o.length;t++)o[t]===`1`?(c++,l===-1&&(l=t)):(c>0&&l>=0&&e.fillRect(i+l*s,a,s*c,n),c=0,l=-1);c>0&&l>=0&&e.fillRect(i+l*s,a,s*c,n)}function be(e,t,n,r,i,a,o=-1){let s=U(t.PaperSizeW,n),c=U(t.PaperSizeH,n),l=U(t.MarginLeft,n),u=U(t.MarginTop,n);e.fillStyle=`#FFF`,e.fillRect(0,0,s,c),e.imageSmoothingEnabled=!0;let d=[0,90,180,270][t.Orientation]??0;d!==0&&(e.save(),e.translate(s/2,c/2),e.rotate(d*Math.PI/180),e.translate(-s/2,-c/2));for(let d=0;d<t.StampsPerPage;d++){let f=ve(s,d,t.StampsPerPage),p=_e(s,t.StampsPerPage);a&&(e.strokeStyle=`#8B0000`,e.setLineDash([4,4]),e.lineWidth=1,e.strokeRect(f,0,p,c));let m=(r||``).toString().trim();if(m){let r=U(t.BarcodeOffsetLeft,n),i=U(t.BarcodeOffsetTop,n),s=U(t.BarCodeWidth,n),c=U(t.BarCodeHeight,n);ye(e,s,c,m,f+l+r,u+i),o===-2?(e.strokeStyle=`#4a6cf7`,e.setLineDash([]),e.lineWidth=2,e.strokeRect(f+l+r,u+i,s,c),e.fillStyle=`#4a6cf7`,e.fillRect(f+l+r-3,u+i-3,6,6),e.fillRect(f+l+r+s-3,u+i+c-3,6,6)):a&&(e.strokeStyle=`#8B0000`,e.setLineDash([4,4]),e.lineWidth=1,e.strokeRect(f+l+r,u+i,s,c))}if(i)for(let r=0;r<i.length;r++){let s=i[r];if(r>=t.BarcodeBlockSettings.length||!t.BarcodeBlockSettings[r])continue;let c=t.BarcodeBlockSettings[r],d=U(c.OffsetX,n),p=U(c.OffsetY,n),m=U(c.Width,n),h=U(c.Height,n);e.font=ge(c.FontSetting,n);let g=f+l+d,_=u+p,v=b(c.FontSetting?.Align||`Center`);e.textAlign=v,e.textBaseline=`top`,e.fillStyle=`#000`;let y=c.Angle,x=m>.001,S=r===o;if(Math.abs(y)<.001){let t=g;if(x&&(v===`center`?t=g+m/2:v===`right`&&(t=g+m)),x?e.fillText(s||``,t,_,m):e.fillText(s||``,t,_),m>0||h>0)S?(e.strokeStyle=`#4a6cf7`,e.setLineDash([]),e.lineWidth=2,e.strokeRect(g,_,m,h),e.fillStyle=`#4a6cf7`,e.fillRect(g-3,_-3,6,6),e.fillRect(g+m-3,_+h-3,6,6)):c.ShowBorder?(e.strokeStyle=`#000`,e.setLineDash([]),e.lineWidth=1,e.strokeRect(g,_,m,h)):a&&(e.strokeStyle=`#8B0000`,e.setLineDash([4,4]),e.lineWidth=1,e.strokeRect(g,_,m,h));else if(S){let t=e.measureText(s||` `),r=x?m:t.width,i=U(c.FontSetting.FontSize,n)*1.2,a=g;x||(v===`center`?a=g-r/2:v===`right`&&(a=g-r)),e.strokeStyle=`#4a6cf7`,e.setLineDash([2,2]),e.lineWidth=1,e.strokeRect(a-2,_-2,r+4,i+4)}}else{e.save();let t=g+m/2,n=_+h/2;e.translate(t,n),e.rotate(y*Math.PI/180);let r=-m/2;x&&(v===`center`?r=0:v===`right`&&(r=m/2)),x?e.fillText(s||``,r,-h/2,m):e.fillText(s||``,r,-h/2),(m>0||h>0)&&(S?(e.strokeStyle=`#4a6cf7`,e.setLineDash([]),e.lineWidth=2,e.strokeRect(-m/2,-h/2,m,h)):c.ShowBorder?(e.strokeStyle=`#000`,e.setLineDash([]),e.lineWidth=1,e.strokeRect(-m/2,-h/2,m,h)):a&&(e.strokeStyle=`#8B0000`,e.setLineDash([4,4]),e.lineWidth=1,e.strokeRect(-m/2,-h/2,m,h))),e.restore()}}}e.setLineDash([]),d!==0&&e.restore()}function xe(e,t,n,r,i=-1,a=1){let o=e.getContext(`2d`);if(!o)return;let s=e.width/t.PaperSizeW*a;e.width=Math.round(U(t.PaperSizeW,s)),e.height=Math.round(U(t.PaperSizeH,s)),be(o,t,s,t.SamplpeBarcode,n,r,i)}var Se=({zoom:e=1})=>{let n=(0,t.useRef)(null),r=(0,t.useRef)(null),{settings:a,showBorder:o,selectedBlockIndex:s,selectBlock:c,editBlock:l,addBlock:u,removeBlock:d,updateSettings:f,canvasOffset:p,setCanvasOffset:m}=z(),[h,g]=(0,t.useState)({show:!1,x:0,y:0,canvasX:0,canvasY:0,hitBlockIndex:null}),[_,v]=(0,t.useState)(!1),[y,b]=(0,t.useState)(!1),x=(0,t.useRef)({startX:0,startY:0,startOffsetX:0,startOffsetY:0,stampIndex:0}),S=(0,t.useRef)({mouseX:0,mouseY:0,offsetX:0,offsetY:0}),C=()=>n.current?n.current.width/a.PaperSizeW:1,T=(e,t)=>{let r=C(),i=n.current.width/a.StampsPerPage;for(let n=a.BarcodeBlockSettings.length-1;n>=0;n--){let o=a.BarcodeBlockSettings[n],s=o.Width*r,c=o.Height*r;for(let l=0;l<a.StampsPerPage;l++){let u=i*l+a.MarginLeft*r+o.OffsetX*r,d=a.MarginTop*r+o.OffsetY*r,f=s>0?s:40,p=c>0?c:o.FontSetting.FontSize*r*1.2,m=u,h=d;if(o.Width===0&&(o.FontSetting.Align===`Center`?m-=f/2:o.FontSetting.Align===`Far`&&(m-=f)),e>=m-4&&e<=m+f+4&&t>=h-4&&t<=h+p+4)return{blockIndex:n,stampIndex:l}}}let o=a.BarCodeWidth*r,s=a.BarCodeHeight*r;for(let i=0;i<a.StampsPerPage;i++){let c=n.current.width/a.StampsPerPage*i+a.MarginLeft*r+a.BarcodeOffsetLeft*r,l=a.MarginTop*r+a.BarcodeOffsetTop*r;if(e>=c-4&&e<=c+o+4&&t>=l-4&&t<=l+s+4)return{blockIndex:-2,stampIndex:i}}return null},E=e=>{if(!n.current)return;let t=n.current.getBoundingClientRect(),r=e.clientX-t.left,i=e.clientY-t.top,o=T(r,i);if(e.button===2){e.preventDefault(),o&&o.blockIndex>=0?c(o.blockIndex):o&&o.blockIndex===-2?c(-2):c(-1),g({show:!0,x:e.clientX,y:e.clientY,canvasX:r,canvasY:i,hitBlockIndex:o?o.blockIndex:null});return}if(h.show&&g({...h,show:!1}),o){c(o.blockIndex),v(!0);let e=0,t=0;o.blockIndex>=0?(e=a.BarcodeBlockSettings[o.blockIndex].OffsetX,t=a.BarcodeBlockSettings[o.blockIndex].OffsetY):o.blockIndex===-2&&(e=a.BarcodeOffsetLeft,t=a.BarcodeOffsetTop),x.current={startX:r,startY:i,startOffsetX:e,startOffsetY:t,stampIndex:o.stampIndex}}else c(-1),b(!0),S.current={mouseX:e.clientX,mouseY:e.clientY,offsetX:p.x,offsetY:p.y}},D=e=>{if(y){let t=e.clientX-S.current.mouseX,n=e.clientY-S.current.mouseY;m({x:S.current.offsetX+t,y:S.current.offsetY+n});return}if(!_||s===-1||!n.current)return;let t=n.current.getBoundingClientRect(),r=e.clientX-t.left,i=e.clientY-t.top,o=C(),c=r-x.current.startX,u=i-x.current.startY,d=c/o,p=u/o,h=Math.max(0,Math.round((x.current.startOffsetX+d)*10)/10),g=Math.max(0,Math.round((x.current.startOffsetY+p)*10)/10);if(s>=0){let e=a.BarcodeBlockSettings[s];l(s,{...e,OffsetX:h,OffsetY:g})}else s===-2&&f({BarcodeOffsetLeft:h,BarcodeOffsetTop:g})},O=()=>{v(!1),b(!1)},k=e=>{e.preventDefault()},A=()=>{if(!n.current)return;let e=C(),t=n.current.width/a.StampsPerPage,r=t*Math.floor(h.canvasX/t),i=(h.canvasX-r)/e-a.MarginLeft,o=h.canvasY/e-a.MarginTop,s=w();s.OffsetX=Math.max(0,Math.round(i*10)/10),s.OffsetY=Math.max(0,Math.round(o*10)/10),u(s),g({...h,show:!1})};(0,t.useEffect)(()=>{let t=n.current;if(!t||!r.current)return;let i=()=>{let n=a.BarcodeBlockSettings.map(e=>e.FontSetting?.SampleText||``);t.width=r.current.clientWidth-2;try{xe(t,a,n,o,s,e)}catch(e){console.error(`Preview render error:`,e)}};i();let c=new ResizeObserver(()=>{requestAnimationFrame(i)});return c.observe(r.current),()=>c.disconnect()},[a,o,s,e]),(0,t.useEffect)(()=>{let e=()=>{h.show&&g(e=>({...e,show:!1}))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[h.show]);let j=y?`grabbing`:`crosshair`;return(0,i.jsx)(`div`,{className:`panel preview-panel`,style:{borderBottom:`none`},children:(0,i.jsxs)(`div`,{className:`canvas-container`,ref:r,onMouseMove:D,onMouseUp:O,onMouseLeave:O,style:{cursor:y?`grabbing`:`default`},children:[(0,i.jsx)(`div`,{style:{position:`absolute`,left:`50%`,top:16,transform:`translate(calc(-50% + ${p.x}px), ${p.y}px)`,transformOrigin:`top left`,transition:y?`none`:`transform 0.05s`,userSelect:`none`},children:(0,i.jsx)(`canvas`,{ref:n,id:`barcode-preview-canvas`,onMouseDown:E,onContextMenu:k,style:{cursor:j,display:`block`}})}),h.show&&(0,i.jsxs)(`div`,{className:`context-menu`,style:{left:h.x,top:h.y,position:`fixed`},onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)(`div`,{className:`context-menu-item`,onClick:A,children:[(0,i.jsx)(`span`,{children:`+`}),` Thêm Text Block tại đây`]}),h.hitBlockIndex!==null&&h.hitBlockIndex>=0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{style:{height:`1px`,background:`var(--border-color)`,margin:`4px 0`}}),(0,i.jsxs)(`div`,{className:`context-menu-item`,style:{color:`var(--danger)`},onClick:()=>{h.hitBlockIndex!==null&&(d(h.hitBlockIndex),g({...h,show:!1}))},children:[(0,i.jsx)(`span`,{children:`🗑`}),` Xóa khối này`]})]})]})]})})},Ce=[`Verdana`,`Arial`,`Tahoma`,`Times New Roman`,`Courier New`,`Georgia`,`Trebuchet MS`,`Segoe UI`,`Roboto`,`Inter`],we=[{value:`Near`,label:`Trái`},{value:`Center`,label:`Giữa`},{value:`Far`,label:`Phải`}],Te=Ce.map(e=>({value:e,label:e})),Ee=we.map(e=>({value:e.value,label:e.label})),De=({value:e,onChange:t})=>{let n=n=>t({...e,...n});return(0,i.jsxs)(`div`,{className:`font-settings-panel`,children:[(0,i.jsxs)(`div`,{className:`font-row`,children:[(0,i.jsx)(`label`,{children:`Font`}),(0,i.jsx)(re,{value:e.FontFamily,onChange:e=>n({FontFamily:e}),options:Te,className:`font-select`}),(0,i.jsx)(`label`,{children:`Cỡ chữ`}),(0,i.jsx)(`input`,{type:`number`,step:`0.5`,min:`1`,max:`100`,value:e.FontSize,onChange:e=>n({FontSize:parseFloat(e.target.value)||10})}),(0,i.jsxs)(`label`,{className:`checkbox-label`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:e.IsBold,onChange:e=>n({IsBold:e.target.checked})}),(0,i.jsx)(`span`,{className:`bold-text`,children:`Đậm`})]}),(0,i.jsxs)(`label`,{className:`checkbox-label`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:e.IsItalic,onChange:e=>n({IsItalic:e.target.checked})}),(0,i.jsx)(`span`,{className:`italic-text`,children:`Nghiêng`})]})]}),(0,i.jsxs)(`div`,{className:`font-row`,children:[(0,i.jsx)(`label`,{children:`Lề trái (mm)`}),(0,i.jsx)(`input`,{type:`number`,step:`0.1`,min:`0`,value:e.LeftIndent,onChange:e=>n({LeftIndent:parseFloat(e.target.value)||0})}),(0,i.jsx)(`label`,{children:`Lề phải (mm)`}),(0,i.jsx)(`input`,{type:`number`,step:`0.1`,min:`0`,value:e.RightIndent,onChange:e=>n({RightIndent:parseFloat(e.target.value)||0})}),(0,i.jsx)(`label`,{children:`Canh lề`}),(0,i.jsx)(re,{value:e.Align,onChange:e=>n({Align:e}),options:Ee,className:`align-select`})]})]})},Oe=C(),ke=[{value:k.Normal,label:`Normal (0°)`},{value:k.Rotate90,label:`Xoay 90°`},{value:k.Rotate180,label:`Xoay 180°`},{value:k.Rotate270,label:`Xoay 270°`}],Ae=()=>{let{settings:e,selectedBlockIndex:t,editBlock:n,removeBlock:r,updateSettings:a}=z(),o=(e,t,n=!0)=>{let r=n?parseFloat(t):parseInt(t,10);a({[e]:Number.isNaN(r)?0:r})};if(t===-2)return(0,i.jsxs)(`div`,{className:`properties-panel`,children:[(0,i.jsx)(`div`,{className:`properties-header`,children:(0,i.jsxs)(`div`,{className:`header-title`,children:[(0,i.jsx)(`span`,{className:`panel-icon`,children:`🏷️`}),(0,i.jsx)(`h3`,{children:`Cấu hình barcode đã chọn`})]})}),(0,i.jsx)(`div`,{className:`properties-body`,children:(0,i.jsxs)(`div`,{className:`props-row`,children:[(0,i.jsxs)(`div`,{className:`props-section`,children:[(0,i.jsx)(`h4`,{children:`Trang In`}),(0,i.jsxs)(`div`,{className:`props-grid`,children:[(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Cỡ giấy W (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.PaperSizeW,onChange:e=>o(`PaperSizeW`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Cỡ giấy H (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.PaperSizeH,onChange:e=>o(`PaperSizeH`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Tem/Trang`}),(0,i.jsx)(`input`,{type:`number`,min:1,step:1,value:e.StampsPerPage,onChange:e=>o(`StampsPerPage`,e.target.value,!1)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Lề trái (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.MarginLeft,onChange:e=>o(`MarginLeft`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Lề phải (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.MarginRight,onChange:e=>o(`MarginRight`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Lề trên (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.MarginTop,onChange:e=>o(`MarginTop`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Lề dưới (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.MarginBottom,onChange:e=>o(`MarginBottom`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`DPI`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:1,value:e.DPI,onChange:e=>o(`DPI`,e.target.value,!1)})]})]}),(0,i.jsxs)(`div`,{className:`field-group`,style:{marginTop:10},children:[(0,i.jsx)(`label`,{children:`Chiều in`}),(0,i.jsx)(`div`,{className:`orientation-options`,children:ke.map(t=>(0,i.jsxs)(`label`,{className:`radio-option`,children:[(0,i.jsx)(`input`,{type:`radio`,name:`page-orientation`,value:t.value,checked:e.Orientation===t.value,onChange:()=>a({Orientation:t.value})}),t.label]},t.value))})]})]}),(0,i.jsxs)(`div`,{className:`props-section`,children:[(0,i.jsx)(`h4`,{children:`Mã Vạch`}),(0,i.jsxs)(`div`,{className:`props-grid`,children:[(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Ngang mã (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.BarCodeWidth,onChange:e=>o(`BarCodeWidth`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Cao mã (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.BarCodeHeight,onChange:e=>o(`BarCodeHeight`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Canh trái mã (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.BarcodeOffsetLeft,onChange:e=>o(`BarcodeOffsetLeft`,e.target.value)})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Canh trên mã (mm)`}),(0,i.jsx)(`input`,{type:`number`,min:0,step:.1,value:e.BarcodeOffsetTop,onChange:e=>o(`BarcodeOffsetTop`,e.target.value)})]})]}),(0,i.jsxs)(`div`,{className:`field-group`,style:{marginTop:`10px`},children:[(0,i.jsx)(`label`,{children:`Barcode mẫu`}),(0,i.jsx)(`input`,{type:`text`,value:e.SamplpeBarcode,onChange:e=>a({SamplpeBarcode:e.target.value}),placeholder:`Nhập mã barcode...`,className:`full-width`})]}),(0,i.jsxs)(`div`,{className:`field-group`,style:{marginTop:`8px`},children:[(0,i.jsx)(`label`,{children:`Tên máy in`}),(0,i.jsx)(`input`,{type:`text`,value:e.BarcodePrinterName,onChange:e=>a({BarcodePrinterName:e.target.value}),placeholder:`Tên máy in hiển thị trên template`,className:`full-width`})]})]})]})})]});if(t<0||t>=e.BarcodeBlockSettings.length)return(0,i.jsxs)(`div`,{className:`properties-panel empty`,children:[(0,i.jsx)(`span`,{className:`panel-icon`,children:`⚙️`}),(0,i.jsx)(`p`,{children:`Chưa chọn đối tượng.`})]});let s=e.BarcodeBlockSettings[t],c=e=>{n(t,{...s,...e})};return(0,i.jsxs)(`div`,{className:`properties-panel`,children:[(0,i.jsxs)(`div`,{className:`properties-header`,children:[(0,i.jsxs)(`div`,{className:`header-title`,children:[(0,i.jsx)(`span`,{className:`panel-icon`,children:`✏️`}),(0,i.jsxs)(`h3`,{children:[`Cấu hình khối đã chọn (#`,t+1,`)`]})]}),(0,i.jsx)(`button`,{className:`btn btn-sm btn-danger`,onClick:()=>{r(t)},children:`🗑 Xóa khối này`})]}),(0,i.jsx)(`div`,{className:`properties-body`,children:(0,i.jsxs)(`div`,{className:`props-row`,children:[(0,i.jsxs)(`div`,{className:`props-section props-position`,children:[(0,i.jsx)(`h4`,{children:`Vị trí & Kích thước`}),(0,i.jsxs)(`div`,{className:`props-grid`,children:[(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`X (mm)`}),(0,i.jsx)(`input`,{type:`number`,step:`0.1`,value:s.OffsetX,onChange:e=>c({OffsetX:parseFloat(e.target.value)||0})})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Y (mm)`}),(0,i.jsx)(`input`,{type:`number`,step:`0.1`,value:s.OffsetY,onChange:e=>c({OffsetY:parseFloat(e.target.value)||0})})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Rộng`}),(0,i.jsx)(`input`,{type:`number`,step:`0.1`,value:s.Width,onChange:e=>c({Width:parseFloat(e.target.value)||0})})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Cao`}),(0,i.jsx)(`input`,{type:`number`,step:`0.1`,value:s.Height,onChange:e=>c({Height:parseFloat(e.target.value)||0})})]}),(0,i.jsxs)(`div`,{className:`field-group`,children:[(0,i.jsx)(`label`,{children:`Góc (°)`}),(0,i.jsx)(`input`,{type:`number`,step:`1`,value:s.Angle,onChange:e=>c({Angle:parseFloat(e.target.value)||0})})]}),(0,i.jsx)(`div`,{className:`field-group`,style:{justifyContent:`flex-end`,paddingBottom:`4px`},children:(0,i.jsxs)(`label`,{className:`checkbox-label`,children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:s.ShowBorder,onChange:e=>c({ShowBorder:e.target.checked})}),`Viền`]})})]})]}),(0,i.jsxs)(`div`,{className:`props-section props-data`,children:[(0,i.jsx)(`h4`,{children:`Trường dữ liệu & Text mẫu`}),(0,i.jsx)(`div`,{className:`field-group`,style:{marginBottom:`8px`},children:(0,i.jsx)(re,{value:s.Data||``,onChange:e=>c({Data:e||null}),options:[{value:``,label:`(Không chọn - dùng Text mẫu)`},...Oe.map(e=>({value:e.id,label:e.name}))]})}),(0,i.jsx)(`div`,{className:`field-group`,children:(0,i.jsx)(`input`,{type:`text`,value:s.FontSetting.SampleText,onChange:e=>c({FontSetting:{...s.FontSetting,SampleText:e.target.value}}),placeholder:`Nhập text mẫu để hiển thị...`,className:`full-width`})})]}),(0,i.jsxs)(`div`,{className:`props-section props-font`,children:[(0,i.jsx)(`h4`,{children:`Cài đặt chữ`}),(0,i.jsx)(De,{value:s.FontSetting,onChange:e=>c({FontSetting:e})})]})]})})]})},je=RegExp(`^[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`);function Me(e,t){let n=[],r=t.exec(e);for(;r;){let i=[];i.startIndex=t.lastIndex-r[0].length;let a=r.length;for(let e=0;e<a;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n}var Ne=function(e){return je.exec(e)!=null};function Pe(e){return e!==void 0}var Fe=[`hasOwnProperty`,`toString`,`valueOf`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`,`__lookupSetter__`],Ie=[`__proto__`,`constructor`,`prototype`],Le={amp:`&`,AMP:`&`,lt:`<`,LT:`<`,gt:`>`,GT:`>`,quot:`"`,QUOT:`"`,apos:`'`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,lsquor:`‚`,rsquor:`’`,ldquor:`„`,bdquo:`„`,comma:`,`,period:`.`,colon:`:`,semi:`;`,excl:`!`,quest:`?`,num:`#`,dollar:`$`,percent:`%`,ast:`*`,commat:`@`,lowbar:`_`,verbar:`|`,vert:`|`,sol:`/`,bsol:`\\`,lbrace:`{`,rbrace:`}`,lbrack:`[`,rbrack:`]`,lpar:`(`,rpar:`)`,nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,COPY:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,REG:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,half:`½`,frac34:`¾`,iquest:`¿`,times:`×`,div:`÷`,divide:`÷`},Re={Agrave:`À`,agrave:`à`,Aacute:`Á`,aacute:`á`,Acirc:`Â`,acirc:`â`,Atilde:`Ã`,atilde:`ã`,Auml:`Ä`,auml:`ä`,Aring:`Å`,aring:`å`,AElig:`Æ`,aelig:`æ`,Ccedil:`Ç`,ccedil:`ç`,Egrave:`È`,egrave:`è`,Eacute:`É`,eacute:`é`,Ecirc:`Ê`,ecirc:`ê`,Euml:`Ë`,euml:`ë`,Igrave:`Ì`,igrave:`ì`,Iacute:`Í`,iacute:`í`,Icirc:`Î`,icirc:`î`,Iuml:`Ï`,iuml:`ï`,ETH:`Ð`,eth:`ð`,Ntilde:`Ñ`,ntilde:`ñ`,Ograve:`Ò`,ograve:`ò`,Oacute:`Ó`,oacute:`ó`,Ocirc:`Ô`,ocirc:`ô`,Otilde:`Õ`,otilde:`õ`,Ouml:`Ö`,ouml:`ö`,Oslash:`Ø`,oslash:`ø`,Ugrave:`Ù`,ugrave:`ù`,Uacute:`Ú`,uacute:`ú`,Ucirc:`Û`,ucirc:`û`,Uuml:`Ü`,uuml:`ü`,Yacute:`Ý`,yacute:`ý`,THORN:`Þ`,thorn:`þ`,szlig:`ß`,yuml:`ÿ`,Yuml:`Ÿ`},ze={Amacr:`Ā`,amacr:`ā`,Abreve:`Ă`,abreve:`ă`,Aogon:`Ą`,aogon:`ą`,Cacute:`Ć`,cacute:`ć`,Ccirc:`Ĉ`,ccirc:`ĉ`,Cdot:`Ċ`,cdot:`ċ`,Ccaron:`Č`,ccaron:`č`,Dcaron:`Ď`,dcaron:`ď`,Dstrok:`Đ`,dstrok:`đ`,Emacr:`Ē`,emacr:`ē`,Ecaron:`Ě`,ecaron:`ě`,Edot:`Ė`,edot:`ė`,Eogon:`Ę`,eogon:`ę`,Gcirc:`Ĝ`,gcirc:`ĝ`,Gbreve:`Ğ`,gbreve:`ğ`,Gdot:`Ġ`,gdot:`ġ`,Gcedil:`Ģ`,Hcirc:`Ĥ`,hcirc:`ĥ`,Hstrok:`Ħ`,hstrok:`ħ`,Itilde:`Ĩ`,itilde:`ĩ`,Imacr:`Ī`,imacr:`ī`,Iogon:`Į`,iogon:`į`,Idot:`İ`,IJlig:`IJ`,ijlig:`ij`,Jcirc:`Ĵ`,jcirc:`ĵ`,Kcedil:`Ķ`,kcedil:`ķ`,kgreen:`ĸ`,Lacute:`Ĺ`,lacute:`ĺ`,Lcedil:`Ļ`,lcedil:`ļ`,Lcaron:`Ľ`,lcaron:`ľ`,Lmidot:`Ŀ`,lmidot:`ŀ`,Lstrok:`Ł`,lstrok:`ł`,Nacute:`Ń`,nacute:`ń`,Ncaron:`Ň`,ncaron:`ň`,Ncedil:`Ņ`,ncedil:`ņ`,ENG:`Ŋ`,eng:`ŋ`,Omacr:`Ō`,omacr:`ō`,Odblac:`Ő`,odblac:`ő`,OElig:`Œ`,oelig:`œ`,Racute:`Ŕ`,racute:`ŕ`,Rcaron:`Ř`,rcaron:`ř`,Rcedil:`Ŗ`,rcedil:`ŗ`,Sacute:`Ś`,sacute:`ś`,Scirc:`Ŝ`,scirc:`ŝ`,Scedil:`Ş`,scedil:`ş`,Scaron:`Š`,scaron:`š`,Tcedil:`Ţ`,tcedil:`ţ`,Tcaron:`Ť`,tcaron:`ť`,Tstrok:`Ŧ`,tstrok:`ŧ`,Utilde:`Ũ`,utilde:`ũ`,Umacr:`Ū`,umacr:`ū`,Ubreve:`Ŭ`,ubreve:`ŭ`,Uring:`Ů`,uring:`ů`,Udblac:`Ű`,udblac:`ű`,Uogon:`Ų`,uogon:`ų`,Wcirc:`Ŵ`,wcirc:`ŵ`,Ycirc:`Ŷ`,ycirc:`ŷ`,Zacute:`Ź`,zacute:`ź`,Zdot:`Ż`,zdot:`ż`,Zcaron:`Ž`,zcaron:`ž`},Be={Alpha:`Α`,alpha:`α`,Beta:`Β`,beta:`β`,Gamma:`Γ`,gamma:`γ`,Delta:`Δ`,delta:`δ`,Epsilon:`Ε`,epsilon:`ε`,epsiv:`ϵ`,varepsilon:`ϵ`,Zeta:`Ζ`,zeta:`ζ`,Eta:`Η`,eta:`η`,Theta:`Θ`,theta:`θ`,thetasym:`ϑ`,vartheta:`ϑ`,Iota:`Ι`,iota:`ι`,Kappa:`Κ`,kappa:`κ`,kappav:`ϰ`,varkappa:`ϰ`,Lambda:`Λ`,lambda:`λ`,Mu:`Μ`,mu:`μ`,Nu:`Ν`,nu:`ν`,Xi:`Ξ`,xi:`ξ`,Omicron:`Ο`,omicron:`ο`,Pi:`Π`,pi:`π`,piv:`ϖ`,varpi:`ϖ`,Rho:`Ρ`,rho:`ρ`,rhov:`ϱ`,varrho:`ϱ`,Sigma:`Σ`,sigma:`σ`,sigmaf:`ς`,sigmav:`ς`,varsigma:`ς`,Tau:`Τ`,tau:`τ`,Upsilon:`Υ`,upsilon:`υ`,upsi:`υ`,Upsi:`ϒ`,upsih:`ϒ`,Phi:`Φ`,phi:`φ`,phiv:`ϕ`,varphi:`ϕ`,Chi:`Χ`,chi:`χ`,Psi:`Ψ`,psi:`ψ`,Omega:`Ω`,omega:`ω`,ohm:`Ω`,Gammad:`Ϝ`,gammad:`ϝ`,digamma:`ϝ`},Ve={Afr:`𝔄`,afr:`𝔞`,Acy:`А`,acy:`а`,Bcy:`Б`,bcy:`б`,Vcy:`В`,vcy:`в`,Gcy:`Г`,gcy:`г`,Dcy:`Д`,dcy:`д`,IEcy:`Е`,iecy:`е`,IOcy:`Ё`,iocy:`ё`,ZHcy:`Ж`,zhcy:`ж`,Zcy:`З`,zcy:`з`,Icy:`И`,icy:`и`,Jcy:`Й`,jcy:`й`,Kcy:`К`,kcy:`к`,Lcy:`Л`,lcy:`л`,Mcy:`М`,mcy:`м`,Ncy:`Н`,ncy:`н`,Ocy:`О`,ocy:`о`,Pcy:`П`,pcy:`п`,Rcy:`Р`,rcy:`р`,Scy:`С`,scy:`с`,Tcy:`Т`,tcy:`т`,Ucy:`У`,ucy:`у`,Fcy:`Ф`,fcy:`ф`,KHcy:`Х`,khcy:`х`,TScy:`Ц`,tscy:`ц`,CHcy:`Ч`,chcy:`ч`,SHcy:`Ш`,shcy:`ш`,SHCHcy:`Щ`,shchcy:`щ`,HARDcy:`Ъ`,hardcy:`ъ`,Ycy:`Ы`,ycy:`ы`,SOFTcy:`Ь`,softcy:`ь`,Ecy:`Э`,ecy:`э`,YUcy:`Ю`,yucy:`ю`,YAcy:`Я`,yacy:`я`,DJcy:`Ђ`,djcy:`ђ`,GJcy:`Ѓ`,gjcy:`ѓ`,Jukcy:`Є`,jukcy:`є`,DScy:`Ѕ`,dscy:`ѕ`,Iukcy:`І`,iukcy:`і`,YIcy:`Ї`,yicy:`ї`,Jsercy:`Ј`,jsercy:`ј`,LJcy:`Љ`,ljcy:`љ`,NJcy:`Њ`,njcy:`њ`,TSHcy:`Ћ`,tshcy:`ћ`,KJcy:`Ќ`,kjcy:`ќ`,Ubrcy:`Ў`,ubrcy:`ў`,DZcy:`Џ`,dzcy:`џ`},He={plus:`+`,pm:`±`,times:`×`,div:`÷`,divide:`÷`,sdot:`⋅`,star:`☆`,starf:`★`,bigstar:`★`,lowast:`∗`,ast:`*`,midast:`*`,compfn:`∘`,smallcircle:`∘`,bullet:`•`,bull:`•`,nbsp:`\xA0`,hellip:`…`,mldr:`…`,prime:`′`,Prime:`″`,tprime:`‴`,bprime:`‵`,backprime:`‵`,minus:`−`,minusd:`∸`,dotminus:`∸`,plusdo:`∔`,dotplus:`∔`,plusmn:`±`,minusplus:`∓`,mnplus:`∓`,mp:`∓`,setminus:`∖`,smallsetminus:`∖`,Backslash:`∖`,setmn:`∖`,ssetmn:`∖`,lowbar:`_`,verbar:`|`,vert:`|`,VerticalLine:`|`,colon:`:`,Colon:`∷`,Proportion:`∷`,ratio:`∶`,equals:`=`,ne:`≠`,nequiv:`≢`,equiv:`≡`,Congruent:`≡`,sim:`∼`,thicksim:`∼`,thksim:`∼`,sime:`≃`,simeq:`≃`,TildeEqual:`≃`,asymp:`≈`,approx:`≈`,thickapprox:`≈`,thkap:`≈`,TildeTilde:`≈`,ncong:`≇`,cong:`≅`,TildeFullEqual:`≅`,asympeq:`≍`,CupCap:`≍`,bump:`≎`,Bumpeq:`≎`,HumpDownHump:`≎`,bumpe:`≏`,bumpeq:`≏`,HumpEqual:`≏`,le:`≤`,LessEqual:`≤`,ge:`≥`,GreaterEqual:`≥`,lesseqgtr:`⋚`,lesseqqgtr:`⪋`,greater:`>`,less:`<`},Ue={alefsym:`ℵ`,aleph:`ℵ`,beth:`ℶ`,gimel:`ℷ`,daleth:`ℸ`,forall:`∀`,ForAll:`∀`,part:`∂`,PartialD:`∂`,exist:`∃`,Exists:`∃`,nexist:`∄`,nexists:`∄`,empty:`∅`,emptyset:`∅`,emptyv:`∅`,varnothing:`∅`,nabla:`∇`,Del:`∇`,isin:`∈`,isinv:`∈`,in:`∈`,Element:`∈`,notin:`∉`,notinva:`∉`,ni:`∋`,niv:`∋`,SuchThat:`∋`,ReverseElement:`∋`,notni:`∌`,notniva:`∌`,prod:`∏`,Product:`∏`,coprod:`∐`,Coproduct:`∐`,sum:`∑`,Sum:`∑`,minus:`−`,mp:`∓`,plusdo:`∔`,dotplus:`∔`,setminus:`∖`,lowast:`∗`,radic:`√`,Sqrt:`√`,prop:`∝`,propto:`∝`,Proportional:`∝`,varpropto:`∝`,infin:`∞`,infintie:`⧝`,ang:`∠`,angle:`∠`,angmsd:`∡`,measuredangle:`∡`,angsph:`∢`,mid:`∣`,VerticalBar:`∣`,nmid:`∤`,nsmid:`∤`,npar:`∦`,parallel:`∥`,spar:`∥`,nparallel:`∦`,nspar:`∦`,and:`∧`,wedge:`∧`,or:`∨`,vee:`∨`,cap:`∩`,cup:`∪`,int:`∫`,Integral:`∫`,conint:`∮`,ContourIntegral:`∮`,Conint:`∯`,DoubleContourIntegral:`∯`,Cconint:`∰`,there4:`∴`,therefore:`∴`,Therefore:`∴`,becaus:`∵`,because:`∵`,Because:`∵`,ratio:`∶`,Proportion:`∷`,minusd:`∸`,dotminus:`∸`,mDDot:`∺`,homtht:`∻`,sim:`∼`,bsimg:`∽`,backsim:`∽`,ac:`∾`,mstpos:`∾`,acd:`∿`,VerticalTilde:`≀`,wr:`≀`,wreath:`≀`,nsime:`≄`,nsimeq:`≄`,ncong:`≇`,simne:`≆`,ncongdot:`⩭̸`,ngsim:`≵`,nsim:`≁`,napprox:`≉`,nap:`≉`,ngeq:`≱`,nge:`≱`,nleq:`≰`,nle:`≰`,ngtr:`≯`,ngt:`≯`,nless:`≮`,nlt:`≮`,nprec:`⊀`,npr:`⊀`,nsucc:`⊁`,nsc:`⊁`},We={larr:`←`,leftarrow:`←`,LeftArrow:`←`,uarr:`↑`,uparrow:`↑`,UpArrow:`↑`,rarr:`→`,rightarrow:`→`,RightArrow:`→`,darr:`↓`,downarrow:`↓`,DownArrow:`↓`,harr:`↔`,leftrightarrow:`↔`,LeftRightArrow:`↔`,varr:`↕`,updownarrow:`↕`,UpDownArrow:`↕`,nwarr:`↖`,nwarrow:`↖`,UpperLeftArrow:`↖`,nearr:`↗`,nearrow:`↗`,UpperRightArrow:`↗`,searr:`↘`,searrow:`↘`,LowerRightArrow:`↘`,swarr:`↙`,swarrow:`↙`,LowerLeftArrow:`↙`,lArr:`⇐`,Leftarrow:`⇐`,uArr:`⇑`,Uparrow:`⇑`,rArr:`⇒`,Rightarrow:`⇒`,dArr:`⇓`,Downarrow:`⇓`,hArr:`⇔`,Leftrightarrow:`⇔`,iff:`⇔`,vArr:`⇕`,Updownarrow:`⇕`,lAarr:`⇚`,Lleftarrow:`⇚`,rAarr:`⇛`,Rrightarrow:`⇛`,lrarr:`⇆`,leftrightarrows:`⇆`,rlarr:`⇄`,rightleftarrows:`⇄`,lrhar:`⇋`,leftrightharpoons:`⇋`,ReverseEquilibrium:`⇋`,rlhar:`⇌`,rightleftharpoons:`⇌`,Equilibrium:`⇌`,udarr:`⇅`,UpArrowDownArrow:`⇅`,duarr:`⇵`,DownArrowUpArrow:`⇵`,llarr:`⇇`,leftleftarrows:`⇇`,rrarr:`⇉`,rightrightarrows:`⇉`,ddarr:`⇊`,downdownarrows:`⇊`,har:`↽`,lhard:`↽`,leftharpoondown:`↽`,lharu:`↼`,leftharpoonup:`↼`,rhard:`⇁`,rightharpoondown:`⇁`,rharu:`⇀`,rightharpoonup:`⇀`,lsh:`↰`,Lsh:`↰`,rsh:`↱`,Rsh:`↱`,ldsh:`↲`,rdsh:`↳`,hookleftarrow:`↩`,hookrightarrow:`↪`,mapstoleft:`↤`,mapstoup:`↥`,map:`↦`,mapsto:`↦`,mapstodown:`↧`,crarr:`↵`,nleftarrow:`↚`,nleftrightarrow:`↮`,nrightarrow:`↛`,nrarr:`↛`,larrtl:`↢`,rarrtl:`↣`,leftarrowtail:`↢`,rightarrowtail:`↣`,twoheadleftarrow:`↞`,twoheadrightarrow:`↠`,Larr:`↞`,Rarr:`↠`,larrhk:`↩`,rarrhk:`↪`,larrlp:`↫`,looparrowleft:`↫`,rarrlp:`↬`,looparrowright:`↬`,harrw:`↭`,leftrightsquigarrow:`↭`,nrarrw:`↝̸`,rarrw:`↝`,rightsquigarrow:`↝`,larrbfs:`⤟`,rarrbfs:`⤠`,nvHarr:`⤄`,nvlArr:`⤂`,nvrArr:`⤃`,larrfs:`⤝`,rarrfs:`⤞`,Map:`⤅`,larrsim:`⥳`,rarrsim:`⥴`,harrcir:`⥈`,Uarrocir:`⥉`,lurdshar:`⥊`,ldrdhar:`⥧`,ldrushar:`⥋`,rdldhar:`⥩`,lrhard:`⥭`,uharr:`↾`,uharl:`↿`,dharr:`⇂`,dharl:`⇃`,Uarr:`↟`,Darr:`↡`,zigrarr:`⇝`,nwArr:`⇖`,neArr:`⇗`,seArr:`⇘`,swArr:`⇙`,nharr:`↮`,nhArr:`⇎`,nlarr:`↚`,nlArr:`⇍`,nrArr:`⇏`,larrb:`⇤`,LeftArrowBar:`⇤`,rarrb:`⇥`,RightArrowBar:`⇥`},Ge={square:`□`,Square:`□`,squ:`□`,squf:`▪`,squarf:`▪`,blacksquar:`▪`,blacksquare:`▪`,FilledVerySmallSquare:`▪`,blk34:`▓`,blk12:`▒`,blk14:`░`,block:`█`,srect:`▭`,rect:`▭`,sdot:`⋅`,sdotb:`⊡`,dotsquare:`⊡`,triangle:`▵`,tri:`▵`,trine:`▵`,utri:`▵`,triangledown:`▿`,dtri:`▿`,tridown:`▿`,triangleleft:`◃`,ltri:`◃`,triangleright:`▹`,rtri:`▹`,blacktriangle:`▴`,utrif:`▴`,blacktriangledown:`▾`,dtrif:`▾`,blacktriangleleft:`◂`,ltrif:`◂`,blacktriangleright:`▸`,rtrif:`▸`,loz:`◊`,lozenge:`◊`,blacklozenge:`⧫`,lozf:`⧫`,bigcirc:`◯`,xcirc:`◯`,circ:`ˆ`,Circle:`○`,cir:`○`,o:`○`,bullet:`•`,bull:`•`,hellip:`…`,mldr:`…`,nldr:`‥`,boxh:`─`,HorizontalLine:`─`,boxv:`│`,boxdr:`┌`,boxdl:`┐`,boxur:`└`,boxul:`┘`,boxvr:`├`,boxvl:`┤`,boxhd:`┬`,boxhu:`┴`,boxvh:`┼`,boxH:`═`,boxV:`║`,boxdR:`╒`,boxDr:`╓`,boxDR:`╔`,boxDl:`╕`,boxdL:`╖`,boxDL:`╗`,boxuR:`╘`,boxUr:`╙`,boxUR:`╚`,boxUl:`╜`,boxuL:`╛`,boxUL:`╝`,boxvR:`╞`,boxVr:`╟`,boxVR:`╠`,boxVl:`╢`,boxvL:`╡`,boxVL:`╣`,boxHd:`╤`,boxhD:`╥`,boxHD:`╦`,boxHu:`╧`,boxhU:`╨`,boxHU:`╩`,boxvH:`╪`,boxVh:`╫`,boxVH:`╬`},Ke={excl:`!`,iexcl:`¡`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,nbsp:`\xA0`,comma:`,`,period:`.`,colon:`:`,semi:`;`,vert:`|`,Verbar:`‖`,verbar:`|`,dblac:`˝`,circ:`ˆ`,caron:`ˇ`,breve:`˘`,dot:`˙`,ring:`˚`,ogon:`˛`,tilde:`˜`,DiacriticalGrave:"`",DiacriticalAcute:`´`,DiacriticalTilde:`˜`,DiacriticalDot:`˙`,DiacriticalDoubleAcute:`˝`,grave:"`"},qe={cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,euro:`€`,dollar:`$`,fnof:`ƒ`,inr:`₹`,af:`؋`,birr:`ብር`,peso:`₱`,rub:`₽`,won:`₩`,yuan:`¥`,cedil:`¸`},Je={frac12:`½`,half:`½`,frac13:`⅓`,frac14:`¼`,frac15:`⅕`,frac16:`⅙`,frac18:`⅛`,frac23:`⅔`,frac25:`⅖`,frac34:`¾`,frac35:`⅗`,frac38:`⅜`,frac45:`⅘`,frac56:`⅚`,frac58:`⅝`,frac78:`⅞`,frasl:`⁄`},Ye={trade:`™`,TRADE:`™`,telrec:`⌕`,target:`⌖`,ulcorn:`⌜`,ulcorner:`⌜`,urcorn:`⌝`,urcorner:`⌝`,dlcorn:`⌞`,llcorner:`⌞`,drcorn:`⌟`,lrcorner:`⌟`,intercal:`⊺`,intcal:`⊺`,oplus:`⊕`,CirclePlus:`⊕`,ominus:`⊖`,CircleMinus:`⊖`,otimes:`⊗`,CircleTimes:`⊗`,osol:`⊘`,odot:`⊙`,CircleDot:`⊙`,oast:`⊛`,circledast:`⊛`,odash:`⊝`,circleddash:`⊝`,ocirc:`⊚`,circledcirc:`⊚`,boxplus:`⊞`,plusb:`⊞`,boxminus:`⊟`,minusb:`⊟`,boxtimes:`⊠`,timesb:`⊠`,boxdot:`⊡`,sdotb:`⊡`,veebar:`⊻`,vee:`∨`,barvee:`⊽`,and:`∧`,wedge:`∧`,Cap:`⋒`,Cup:`⋓`,Fork:`⋔`,pitchfork:`⋔`,epar:`⋕`,ltlarr:`⥶`,nvap:`≍⃒`,nvsim:`∼⃒`,nvge:`≥⃒`,nvle:`≤⃒`,nvlt:`<⃒`,nvgt:`>⃒`,nvltrie:`⊴⃒`,nvrtrie:`⊵⃒`,Vdash:`⊩`,dashv:`⊣`,vDash:`⊨`,Vvdash:`⊪`,nvdash:`⊬`,nvDash:`⊭`,nVdash:`⊮`,nVDash:`⊯`};({...Le,...Re,...ze,...Be,...Ve,...He,...Ue,...We,...Ge,...Ke,...qe,...Je,...Ye});var Xe={amp:`&`,apos:`'`,gt:`>`,lt:`<`,quot:`"`},Ze={nbsp:`\xA0`,copy:`©`,reg:`®`,trade:`™`,mdash:`—`,ndash:`–`,hellip:`…`,laquo:`«`,raquo:`»`,lsquo:`‘`,rsquo:`’`,ldquo:`“`,rdquo:`”`,bull:`•`,para:`¶`,sect:`§`,deg:`°`,frac12:`½`,frac14:`¼`,frac34:`¾`},Qe=Object.freeze({ALLOW:`allow`,BLOCK:`block`,THROW:`throw`}),$e=new Set(`!?\\\\/[]$%{}^&*()<>|+`);function et(e){if(e[0]===`#`)throw Error(`[EntityReplacer] Invalid character '#' in entity name: "${e}"`);for(let t of e)if($e.has(t))throw Error(`[EntityReplacer] Invalid character '${t}' in entity name: "${e}"`);return e}function tt(...e){let t=Object.create(null);for(let n of e)if(n)for(let e of Object.keys(n)){let r=n[e];if(typeof r==`string`)t[e]=r;else if(r&&typeof r==`object`&&r.val!==void 0){let n=r.val;typeof n==`string`&&(t[e]=n)}}return t}var W=`external`,nt=`base`,rt=`all`;function it(e){return!e||e===W?new Set([W]):e===rt?new Set([rt]):e===nt?new Set([nt]):Array.isArray(e)?new Set(e):new Set([W])}var G=Object.freeze({allow:0,leave:1,remove:2,throw:3}),at=new Set([9,10,13]);function ot(e){if(!e)return{xmlVersion:1,onLevel:G.allow,nullLevel:G.remove};let t=e.xmlVersion===1.1?1.1:1,n=G[e.onNCR]??G.allow,r=G[e.nullNCR]??G.remove;return{xmlVersion:t,onLevel:n,nullLevel:Math.max(r,G.remove)}}var st=class{constructor(e={}){this._limit=e.limit||{},this._maxTotalExpansions=this._limit.maxTotalExpansions||0,this._maxExpandedLength=this._limit.maxExpandedLength||0,this._postCheck=typeof e.postCheck==`function`?e.postCheck:e=>e,this._limitTiers=it(this._limit.applyLimitsTo??W),this._numericAllowed=e.numericAllowed??!0,this._baseMap=tt(Xe,e.namedEntities||null),this._externalMap=Object.create(null),this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this._removeSet=new Set(e.remove&&Array.isArray(e.remove)?e.remove:[]),this._leaveSet=new Set(e.leave&&Array.isArray(e.leave)?e.leave:[]);let t=ot(e.ncr);this._ncrXmlVersion=t.xmlVersion,this._ncrOnLevel=t.onLevel,this._ncrNullLevel=t.nullLevel,this._onExternalEntity=typeof e.onExternalEntity==`function`?e.onExternalEntity:null,this._onInputEntity=typeof e.onInputEntity==`function`?e.onInputEntity:null}_applyRegistrationHook(e,t,n,r){if(!e)return!0;let i=e(t,n);if(i===Qe.BLOCK)return!1;if(i===Qe.THROW)throw Error(`[EntityDecoder] Registration of ${r} entity "&${t};" was rejected by hook`);return!0}setExternalEntities(e){if(e)for(let t of Object.keys(e))et(t);if(!this._onExternalEntity){this._externalMap=tt(e);return}let t=tt(e),n=Object.create(null);for(let[e,r]of Object.entries(t))this._applyRegistrationHook(this._onExternalEntity,e,r,`external`)&&(n[e]=r);this._externalMap=n}addExternalEntity(e,t){et(e),typeof t==`string`&&t.indexOf(`&`)===-1&&this._applyRegistrationHook(this._onExternalEntity,e,t,`external`)&&(this._externalMap[e]=t)}addInputEntities(e){if(this._totalExpansions=0,this._expandedLength=0,!this._onInputEntity){this._inputMap=tt(e);return}let t=tt(e),n=Object.create(null);for(let[e,r]of Object.entries(t))this._applyRegistrationHook(this._onInputEntity,e,r,`input`)&&(n[e]=r);this._inputMap=n}reset(){return this._inputMap=Object.create(null),this._totalExpansions=0,this._expandedLength=0,this}setXmlVersion(e){this._ncrXmlVersion=e===1.1?1.1:1}decode(e){if(typeof e!=`string`||e.length===0||e.indexOf(`&`)===-1)return e;let t=e,n=[],r=e.length,i=0,a=0,o=this._maxTotalExpansions>0,s=this._maxExpandedLength>0,c=o||s;for(;a<r;){if(e.charCodeAt(a)!==38){a++;continue}let t=a+1;for(;t<r&&e.charCodeAt(t)!==59&&t-a<=32;)t++;if(t>=r||e.charCodeAt(t)!==59){a++;continue}let l=e.slice(a+1,t);if(l.length===0){a++;continue}let u,d;if(this._removeSet.has(l))u=``,d===void 0&&(d=W);else if(this._leaveSet.has(l)){a++;continue}else if(l.charCodeAt(0)===35){let e=this._resolveNCR(l);if(e===void 0){a++;continue}u=e,d=nt}else{let e=this._resolveName(l);u=e?.value,d=e?.tier}if(u===void 0){a++;continue}if(a>i&&n.push(e.slice(i,a)),n.push(u),i=t+1,a=i,c&&this._tierCounts(d)){if(o&&(this._totalExpansions++,this._totalExpansions>this._maxTotalExpansions))throw Error(`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`);if(s){let e=u.length-(l.length+2);if(e>0&&(this._expandedLength+=e,this._expandedLength>this._maxExpandedLength))throw Error(`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`)}}}i<r&&n.push(e.slice(i));let l=n.length===0?e:n.join(``);return this._postCheck(l,t)}_tierCounts(e){return this._limitTiers.has(rt)?!0:this._limitTiers.has(e)}_resolveName(e){if(e in this._inputMap)return{value:this._inputMap[e],tier:W};if(e in this._externalMap)return{value:this._externalMap[e],tier:W};if(e in this._baseMap)return{value:this._baseMap[e],tier:nt}}_classifyNCR(e){return e===0?this._ncrNullLevel:e>=55296&&e<=57343||this._ncrXmlVersion===1&&e>=1&&e<=31&&!at.has(e)?G.remove:-1}_applyNCRAction(e,t,n){switch(e){case G.allow:return String.fromCodePoint(n);case G.remove:return``;case G.leave:return;case G.throw:throw Error(`[EntityDecoder] Prohibited numeric character reference &${t}; (U+${n.toString(16).toUpperCase().padStart(4,`0`)})`);default:return String.fromCodePoint(n)}}_resolveNCR(e){let t=e.charCodeAt(1),n;if(n=t===120||t===88?parseInt(e.slice(2),16):parseInt(e.slice(1),10),Number.isNaN(n)||n<0||n>1114111)return;let r=this._classifyNCR(n);if(!this._numericAllowed&&r<G.remove)return;let i=r===-1?this._ncrOnLevel:Math.max(this._ncrOnLevel,r);return this._applyNCRAction(i,e,n)}},ct=e=>Fe.includes(e)?`__`+e:e,lt={preserveOrder:!1,attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,entityDecoder:null,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e},captureMetaData:!1,maxNestedTags:100,strictReservedNames:!0,jPath:!0,onDangerousProperty:ct};function ut(e,t){if(typeof e!=`string`)return;let n=e.toLowerCase();if(Fe.some(e=>n===e.toLowerCase())||Ie.some(e=>n===e.toLowerCase()))throw Error(`[SECURITY] Invalid ${t}: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`)}function dt(e,t){return typeof e==`boolean`?{enabled:e,maxEntitySize:1e4,maxExpansionDepth:1e4,maxTotalExpansions:1/0,maxExpandedLength:1e5,maxEntityCount:1e3,allowedTags:null,tagFilter:null,appliesTo:`all`}:typeof e==`object`&&e?{enabled:e.enabled!==!1,maxEntitySize:Math.max(1,e.maxEntitySize??1e4),maxExpansionDepth:Math.max(1,e.maxExpansionDepth??1e4),maxTotalExpansions:Math.max(1,e.maxTotalExpansions??1/0),maxExpandedLength:Math.max(1,e.maxExpandedLength??1e5),maxEntityCount:Math.max(1,e.maxEntityCount??1e3),allowedTags:e.allowedTags??null,tagFilter:e.tagFilter??null,appliesTo:e.appliesTo??`all`}:dt(!0)}var ft=function(e){let t=Object.assign({},lt,e),n=[{value:t.attributeNamePrefix,name:`attributeNamePrefix`},{value:t.attributesGroupName,name:`attributesGroupName`},{value:t.textNodeName,name:`textNodeName`},{value:t.cdataPropName,name:`cdataPropName`},{value:t.commentPropName,name:`commentPropName`}];for(let{value:e,name:t}of n)e&&ut(e,t);return t.onDangerousProperty===null&&(t.onDangerousProperty=ct),t.processEntities=dt(t.processEntities,t.htmlEntities),t.unpairedTagsSet=new Set(t.unpairedTags),t.stopNodes&&Array.isArray(t.stopNodes)&&(t.stopNodes=t.stopNodes.map(e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e)),t},pt=typeof Symbol==`function`?Symbol(`XML Node Metadata`):`@@xmlMetadata`,K=class{constructor(e){this.tagname=e,this.child=[],this[`:@`]=Object.create(null)}add(e,t){e===`__proto__`&&(e=`#__proto__`),this.child.push({[e]:t})}addChild(e,t){e.tagname===`__proto__`&&(e.tagname=`#__proto__`),e[`:@`]&&Object.keys(e[`:@`]).length>0?this.child.push({[e.tagname]:e.child,":@":e[`:@`]}):this.child.push({[e.tagname]:e.child}),t!==void 0&&(this.child[this.child.length-1][pt]={startIndex:t})}static getMetaDataSymbol(){return pt}},mt=`:A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�`,ht=`:A-Za-z_À-ÖØ-öø-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�\\-\\.\\d·̀-ͯ‿-⁀`,gt=`:A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,_t=`:A-Za-z_À-˿Ͱ-ͽͿ-҆҈--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-\\-\\.\\d·̀-ͯ҇‿-⁀`,vt=(e,t,n=``)=>{let r=`[${e.replace(`:`,``)}][${t.replace(`:`,``)}]*`;return{name:RegExp(`^[${e}][${t}]*$`,n),ncName:RegExp(`^${r}$`,n),qName:RegExp(`^${r}(?::${r})?$`,n),nmToken:RegExp(`^[${t}]+$`,n),nmTokens:RegExp(`^[${t}]+(?:\\s+[${t}]+)*$`,n)}},yt=vt(mt,ht),bt=vt(gt,_t,`u`),xt=(e=`1.0`)=>e===`1.1`?bt:yt,St=(e,{xmlVersion:t=`1.0`}={})=>xt(t).qName.test(e),Ct=class{constructor(e,t){this.suppressValidationErr=!e,this.options=e,this.xmlVersion=t||1}setXmlVersion(e=1){this.xmlVersion=e}readDocType(e,t){let n=Object.create(null),r=0;if(e[t+3]===`O`&&e[t+4]===`C`&&e[t+5]===`T`&&e[t+6]===`Y`&&e[t+7]===`P`&&e[t+8]===`E`){t+=9;let i=1,a=!1,o=!1,s=``;for(;t<e.length;t++)if(e[t]===`<`&&!o){if(a&&J(e,`!ENTITY`,t)){t+=7;let i,a;if([i,a,t]=this.readEntityExp(e,t+1,this.suppressValidationErr),a.indexOf(`&`)===-1){if(this.options.enabled!==!1&&this.options.maxEntityCount!=null&&r>=this.options.maxEntityCount)throw Error(`Entity count (${r+1}) exceeds maximum allowed (${this.options.maxEntityCount})`);n[i]=a,r++}}else if(a&&J(e,`!ELEMENT`,t)){t+=8;let{index:n}=this.readElementExp(e,t+1);t=n}else if(a&&J(e,`!ATTLIST`,t))t+=8;else if(a&&J(e,`!NOTATION`,t)){t+=9;let{index:n}=this.readNotationExp(e,t+1,this.suppressValidationErr);t=n}else if(J(e,`!--`,t))o=!0;else throw Error(`Invalid DOCTYPE`);i++,s=``}else if(e[t]===`>`){if(o?e[t-1]===`-`&&e[t-2]===`-`&&(o=!1,i--):i--,i===0)break}else e[t]===`[`?a=!0:s+=e[t];if(i!==0)throw Error(`Unclosed DOCTYPE`)}else throw Error(`Invalid Tag instead of DOCTYPE`);return{entities:n,i:t}}readEntityExp(e,t){t=q(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t])&&e[t]!==`"`&&e[t]!==`'`;)t++;let r=e.substring(n,t);if(wt(r,{xmlVersion:this.xmlVersion}),t=q(e,t),!this.suppressValidationErr){if(e.substring(t,t+6).toUpperCase()===`SYSTEM`)throw Error(`External entities are not supported`);if(e[t]===`%`)throw Error(`Parameter entities are not supported`)}let i=``;if([t,i]=this.readIdentifierVal(e,t,`entity`),this.options.enabled!==!1&&this.options.maxEntitySize!=null&&i.length>this.options.maxEntitySize)throw Error(`Entity "${r}" size (${i.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);return t--,[r,i,t]}readNotationExp(e,t){t=q(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);!this.suppressValidationErr&&wt(r,{xmlVersion:this.xmlVersion}),t=q(e,t);let i=e.substring(t,t+6).toUpperCase();if(!this.suppressValidationErr&&i!==`SYSTEM`&&i!==`PUBLIC`)throw Error(`Expected SYSTEM or PUBLIC, found "${i}"`);t+=i.length,t=q(e,t);let a=null,o=null;if(i===`PUBLIC`)[t,a]=this.readIdentifierVal(e,t,`publicIdentifier`),t=q(e,t),(e[t]===`"`||e[t]===`'`)&&([t,o]=this.readIdentifierVal(e,t,`systemIdentifier`));else if(i===`SYSTEM`&&([t,o]=this.readIdentifierVal(e,t,`systemIdentifier`),!this.suppressValidationErr&&!o))throw Error(`Missing mandatory system identifier for SYSTEM notation`);return{notationName:r,publicIdentifier:a,systemIdentifier:o,index:--t}}readIdentifierVal(e,t,n){let r=``,i=e[t];if(i!==`"`&&i!==`'`)throw Error(`Expected quoted string, found "${i}"`);t++;let a=t;for(;t<e.length&&e[t]!==i;)t++;if(r=e.substring(a,t),e[t]!==i)throw Error(`Unterminated ${n} value`);return t++,[t,r]}readElementExp(e,t){t=q(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);if(!this.suppressValidationErr&&!St(r,{xmlVersion:this.xmlVersion}))throw Error(`Invalid element name: "${r}"`);t=q(e,t);let i=``;if(e[t]===`E`&&J(e,`MPTY`,t))t+=4;else if(e[t]===`A`&&J(e,`NY`,t))t+=2;else if(e[t]===`(`){t++;let n=t;for(;t<e.length&&e[t]!==`)`;)t++;if(i=e.substring(n,t),e[t]!==`)`)throw Error(`Unterminated content model`)}else if(!this.suppressValidationErr)throw Error(`Invalid Element Expression, found "${e[t]}"`);return{elementName:r,contentModel:i.trim(),index:t}}readAttlistExp(e,t){t=q(e,t);let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;let r=e.substring(n,t);for(wt(r,{xmlVersion:this.xmlVersion}),t=q(e,t),n=t;t<e.length&&!/\s/.test(e[t]);)t++;let i=e.substring(n,t);if(!wt(i,{xmlVersion:this.xmlVersion}))throw Error(`Invalid attribute name: "${i}"`);t=q(e,t);let a=``;if(e.substring(t,t+8).toUpperCase()===`NOTATION`){if(a=`NOTATION`,t+=8,t=q(e,t),e[t]!==`(`)throw Error(`Expected '(', found "${e[t]}"`);t++;let n=[];for(;t<e.length&&e[t]!==`)`;){let r=t;for(;t<e.length&&e[t]!==`|`&&e[t]!==`)`;)t++;let i=e.substring(r,t);if(i=i.trim(),!wt(i,{xmlVersion:this.xmlVersion}))throw Error(`Invalid notation name: "${i}"`);n.push(i),e[t]===`|`&&(t++,t=q(e,t))}if(e[t]!==`)`)throw Error(`Unterminated list of notations`);t++,a+=` (`+n.join(`|`)+`)`}else{let n=t;for(;t<e.length&&!/\s/.test(e[t]);)t++;if(a+=e.substring(n,t),!this.suppressValidationErr&&![`CDATA`,`ID`,`IDREF`,`IDREFS`,`ENTITY`,`ENTITIES`,`NMTOKEN`,`NMTOKENS`].includes(a.toUpperCase()))throw Error(`Invalid attribute type: "${a}"`)}t=q(e,t);let o=``;return e.substring(t,t+8).toUpperCase()===`#REQUIRED`?(o=`#REQUIRED`,t+=8):e.substring(t,t+7).toUpperCase()===`#IMPLIED`?(o=`#IMPLIED`,t+=7):[t,o]=this.readIdentifierVal(e,t,`ATTLIST`),{elementName:r,attributeName:i,attributeType:a,defaultValue:o,index:t}}},q=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function J(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function wt(e,t){if(St(e,{xmlVersion:t}))return e;throw Error(`Invalid entity name ${e}`)}var Tt=[48,1632,1776,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,65296,120782,120792,120802,120812,120822,66720,68912,69734,69872,69942,70096,70384,70736,70864,71248,71360,71472,71904,72016,72688,72784,73040,73120,73552,92768,92864,93008,123200,123632,124144,125264,130032],Et=new Map,Dt=65535,Ot=1632,kt=new Uint8Array(63904).fill(255);for(let e of Tt)for(let t=0;t<10;t++){let n=e+t;n<=Dt?kt[n-Ot]=t:Et.set(n,t)}var At=48,jt=57,Mt=45,Nt=new Set([8722,65293,65123]);function Pt(e){if(typeof e!=`string`)return e;let t=e.length;if(t===0)return e;let n=-1;for(let r=0;r<t;r++){let i=e.charCodeAt(r);if(!(i>=At&&i<=jt||i===Mt)){if(i<1632){if(Nt.has(i)){n=r;break}continue}if(i>=55296&&i<=56319){if(r+1<t){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343){let e=65536+(i-55296<<10)+(t-56320);if(Et.has(e)){n=r;break}}}continue}if(kt[i-1632]!==255||Nt.has(i)){n=r;break}}}if(n===-1)return e;let r=[];n>0&&r.push(e.slice(0,n));for(let i=n;i<t;i++){let n=e.charCodeAt(i);if(n>=At&&n<=jt||n===Mt){r.push(e[i]);continue}if(n<1632){r.push(Nt.has(n)?`-`:e[i]);continue}if(n>=55296&&n<=56319){if(i+1<t){let t=e.charCodeAt(i+1);if(t>=56320&&t<=57343){let e=65536+(n-55296<<10)+(t-56320),a=Et.get(e);if(a!==void 0){r.push(String.fromCharCode(a+48)),i++;continue}}}r.push(e[i]);continue}if(Nt.has(n)){r.push(`-`);continue}let a=kt[n-Ot];r.push(a===255?e[i]:String.fromCharCode(a+48))}return r.join(``)}var Ft=/^[-+]?0x[a-fA-F0-9]+$/,It=/^0b[01]+$/,Lt=/^0o[0-7]+$/,Rt=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,zt={hex:!0,binary:!1,octal:!1,leadingZeros:!0,decimalPoint:`.`,eNotation:!0,infinity:`original`,unicode:!1};function Bt(e,t={}){if(t=Object.assign({},zt,t),!e||typeof e!=`string`)return e;let n=e.trim();if(n.length===0||t.skipLike!==void 0&&t.skipLike.test(n))return e;if(n===`0`||t.unicode&&(n=Pt(n),n===`0`))return 0;if(t.hex&&Ft.test(n))return Wt(n,16);if(t.binary&&It.test(n))return Wt(n,2);if(t.octal&&Lt.test(n))return Wt(n,8);if(!isFinite(n))return Gt(e,Number(n),t);if(n.includes(`e`)||n.includes(`E`))return Ht(e,n,t);{let r=Rt.exec(n);if(r){let i=r[1]||``,a=r[2],o=Ut(r[3]),s=i?e[a.length+1]===`.`:e[a.length]===`.`;if(!t.leadingZeros&&(a.length>1||a.length===1&&!s))return e;{let r=Number(n),s=String(r);if(r===0)return r;if(s.search(/[eE]/)!==-1)return t.eNotation?r:e;if(n.indexOf(`.`)!==-1)return s===`0`||s===o||s===`${i}${o}`?r:e;let c=a?o:n;return a?c===s||i+c===s?r:e:c===s||c===i+s?r:e}}else return e}}var Vt=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function Ht(e,t,n){if(!n.eNotation)return e;let r=t.match(Vt);if(r){let i=r[1]||``,a=r[3].indexOf(`e`)===-1?`E`:`e`,o=r[2],s=i?e[o.length+1]===a:e[o.length]===a;return o.length>1&&s?e:o.length===1&&(r[3].startsWith(`.${a}`)||r[3][0]===a)?Number(t):o.length>0?n.leadingZeros&&!s?(t=(r[1]||``)+r[3],Number(t)):e:Number(t)}else return e}function Ut(e){return e&&e.indexOf(`.`)!==-1?(e=e.replace(/0+$/,``),e===`.`?e=`0`:e[0]===`.`?e=`0`+e:e[e.length-1]===`.`&&(e=e.substring(0,e.length-1)),e):e}function Wt(e,t){let n=e.trim();if((t===2||t===8)&&(e=n.substring(2)),parseInt)return parseInt(e,t);if(Number.parseInt)return Number.parseInt(e,t);if(window&&window.parseInt)return window.parseInt(e,t);throw Error(`parseInt, Number.parseInt, window.parseInt are not supported`)}function Gt(e,t,n){let r=t===1/0;switch(n.infinity.toLowerCase()){case`null`:return null;case`infinity`:return t;case`string`:return r?`Infinity`:`-Infinity`;default:return e}}function Kt(e){return typeof e==`function`?e:Array.isArray(e)?t=>{for(let n of e)if(typeof n==`string`&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}var Y=class{constructor(e,t={},n){this.pattern=e,this.separator=t.separator||`.`,this.segments=this._parse(e),this.data=n,this._hasDeepWildcard=this.segments.some(e=>e.type===`deep-wildcard`),this._hasAttributeCondition=this.segments.some(e=>e.attrName!==void 0),this._hasPositionSelector=this.segments.some(e=>e.position!==void 0)}_parse(e){let t=[],n=0,r=``;for(;n<e.length;)e[n]===this.separator?n+1<e.length&&e[n+1]===this.separator?(r.trim()&&(t.push(this._parseSegment(r.trim())),r=``),t.push({type:`deep-wildcard`}),n+=2):(r.trim()&&t.push(this._parseSegment(r.trim())),r=``,n++):(r+=e[n],n++);return r.trim()&&t.push(this._parseSegment(r.trim())),t}_parseSegment(e){let t={type:`tag`},n=null,r=e,i=e.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);if(i&&(r=i[1]+i[3],i[2])){let e=i[2].slice(1,-1);e&&(n=e)}let a,o=r;if(r.includes(`::`)){let t=r.indexOf(`::`);if(a=r.substring(0,t).trim(),o=r.substring(t+2).trim(),!a)throw Error(`Invalid namespace in pattern: ${e}`)}let s,c=null;if(o.includes(`:`)){let e=o.lastIndexOf(`:`),t=o.substring(0,e).trim(),n=o.substring(e+1).trim();[`first`,`last`,`odd`,`even`].includes(n)||/^nth\(\d+\)$/.test(n)?(s=t,c=n):s=o}else s=o;if(!s)throw Error(`Invalid segment pattern: ${e}`);if(t.tag=s,a&&(t.namespace=a),n)if(n.includes(`=`)){let e=n.indexOf(`=`);t.attrName=n.substring(0,e).trim(),t.attrValue=n.substring(e+1).trim()}else t.attrName=n.trim();if(c){let e=c.match(/^nth\((\d+)\)$/);e?(t.position=`nth`,t.positionValue=parseInt(e[1],10)):t.position=c}return t}get length(){return this.segments.length}hasDeepWildcard(){return this._hasDeepWildcard}hasAttributeCondition(){return this._hasAttributeCondition}hasPositionSelector(){return this._hasPositionSelector}toString(){return this.pattern}},qt=class{constructor(){this._byDepthAndTag=new Map,this._wildcardByDepth=new Map,this._deepWildcards=[],this._deepByTerminalTag=new Map,this._patterns=new Set,this._sealed=!1}add(e){if(this._sealed)throw TypeError(`ExpressionSet is sealed. Create a new ExpressionSet to add more expressions.`);if(this._patterns.has(e.pattern))return this;if(this._patterns.add(e.pattern),e.hasDeepWildcard()){let t=e.segments[e.segments.length-1];if(t&&t.type!==`deep-wildcard`&&t.tag!==`*`){let n=t.tag;this._deepByTerminalTag.has(n)||this._deepByTerminalTag.set(n,[]),this._deepByTerminalTag.get(n).push(e)}else this._deepWildcards.push(e);return this}let t=e.length,n=e.segments[e.segments.length-1]?.tag;if(!n||n===`*`)this._wildcardByDepth.has(t)||this._wildcardByDepth.set(t,[]),this._wildcardByDepth.get(t).push(e);else{let r=`${t}:${n}`;this._byDepthAndTag.has(r)||this._byDepthAndTag.set(r,[]),this._byDepthAndTag.get(r).push(e)}return this}addAll(e){for(let t of e)this.add(t);return this}has(e){return this._patterns.has(e.pattern)}get size(){return this._patterns.size}seal(){return this._sealed=!0,this}get isSealed(){return this._sealed}matchesAny(e){return this.findMatch(e)!==null}findMatch(e){let t=e.getDepth(),n=e.getCurrentTag(),r=`${t}:${n}`,i=this._byDepthAndTag.get(r);if(i){for(let t=0;t<i.length;t++)if(e.matches(i[t]))return i[t]}let a=this._wildcardByDepth.get(t);if(a){for(let t=0;t<a.length;t++)if(e.matches(a[t]))return a[t]}let o=this._deepByTerminalTag.get(n);if(o){for(let t=0;t<o.length;t++)if(e.matches(o[t]))return o[t]}for(let t=0;t<this._deepWildcards.length;t++)if(e.matches(this._deepWildcards[t]))return this._deepWildcards[t];return null}},Jt=class{constructor(e){this._matcher=e}get separator(){return this._matcher.separator}getCurrentTag(){let e=this._matcher.path;return e.length>0?e[e.length-1].tag:void 0}getCurrentNamespace(){let e=this._matcher.path;return e.length>0?e[e.length-1].namespace:void 0}getAttrValue(e){let t=this._matcher.path;if(t.length!==0)return t[t.length-1].values?.[e]}hasAttr(e){let t=this._matcher.path;if(t.length===0)return!1;let n=t[t.length-1];return n.values!==void 0&&e in n.values}getAnyParentAttr(e){return this._matcher.getAnyParentAttr(e)}hasAnyParentAttr(e){return this._matcher.hasAnyParentAttr(e)}getPosition(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].position??0}getCounter(){let e=this._matcher.path;return e.length===0?-1:e[e.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this._matcher.path.length}toString(e,t=!0){return this._matcher.toString(e,t)}toArray(){return this._matcher.path.map(e=>e.tag)}matches(e){return this._matcher.matches(e)}matchesAny(e){return e.matchesAny(this._matcher)}},Yt=class{constructor(e={}){this.separator=e.separator||`.`,this.path=[],this.siblingStacks=[],this._pathStringCache=null,this._view=new Jt(this),this._keptAttrs=[]}push(e,t=null,n=null,r=null){this._pathStringCache=null,this.path.length>0&&(this.path[this.path.length-1].values=void 0);let i=this.path.length;this.siblingStacks[i]||(this.siblingStacks[i]=new Map);let a=this.siblingStacks[i],o=n?`${n}:${e}`:e,s=a.get(o)||0,c=0;for(let e of a.values())c+=e;a.set(o,s+1);let l={tag:e,position:c,counter:s};n!=null&&(l.namespace=n),t!=null&&(l.values=t),this.path.push(l);let u=this.path.length,d=r===null?null:r.keep;if(d!=null&&d.length>0&&t)for(let e=0;e<d.length;e++){let n=d[e];t[n]!==void 0&&this._keptAttrs.push({depth:u,name:n,value:t[n]})}}pop(){if(this.path.length===0)return;this._pathStringCache=null;let e=this.path.pop();this.siblingStacks.length>this.path.length+1&&(this.siblingStacks.length=this.path.length+1);let t=this.path.length+1;for(;this._keptAttrs.length>0&&this._keptAttrs[this._keptAttrs.length-1].depth>=t;)this._keptAttrs.pop();return e}updateCurrent(e){if(this.path.length>0){let t=this.path[this.path.length-1];e!=null&&(t.values=e)}}getCurrentTag(){return this.path.length>0?this.path[this.path.length-1].tag:void 0}getCurrentNamespace(){return this.path.length>0?this.path[this.path.length-1].namespace:void 0}getAttrValue(e){if(this.path.length!==0)return this.path[this.path.length-1].values?.[e]}hasAttr(e){if(this.path.length===0)return!1;let t=this.path[this.path.length-1];return t.values!==void 0&&e in t.values}getAnyParentAttr(e){let t=this._keptAttrs;for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return t[n].value}hasAnyParentAttr(e){let t=this._keptAttrs;for(let n=t.length-1;n>=0;n--)if(t[n].name===e)return!0;return!1}getPosition(){return this.path.length===0?-1:this.path[this.path.length-1].position??0}getCounter(){return this.path.length===0?-1:this.path[this.path.length-1].counter??0}getIndex(){return this.getPosition()}getDepth(){return this.path.length}toString(e,t=!0){let n=e||this.separator;if(n===this.separator&&t===!0){if(this._pathStringCache!==null)return this._pathStringCache;let e=this.path.map(e=>e.namespace?`${e.namespace}:${e.tag}`:e.tag).join(n);return this._pathStringCache=e,e}return this.path.map(e=>t&&e.namespace?`${e.namespace}:${e.tag}`:e.tag).join(n)}toArray(){return this.path.map(e=>e.tag)}reset(){this._pathStringCache=null,this.path=[],this.siblingStacks=[],this._keptAttrs=[]}matches(e){let t=e.segments;return t.length===0?!1:e.hasDeepWildcard()?this._matchWithDeepWildcard(t):this._matchSimple(t)}_matchSimple(e){if(this.path.length!==e.length)return!1;for(let t=0;t<e.length;t++)if(!this._matchSegment(e[t],this.path[t],t===this.path.length-1))return!1;return!0}_matchWithDeepWildcard(e){let t=this.path.length-1,n=e.length-1;for(;n>=0&&t>=0;){let r=e[n];if(r.type===`deep-wildcard`){if(n--,n<0)return!0;let r=e[n],i=!1;for(let e=t;e>=0;e--)if(this._matchSegment(r,this.path[e],e===this.path.length-1)){t=e-1,n--,i=!0;break}if(!i)return!1}else{if(!this._matchSegment(r,this.path[t],t===this.path.length-1))return!1;t--,n--}}return n<0}_matchSegment(e,t,n){if(e.tag!==`*`&&e.tag!==t.tag||e.namespace!==void 0&&e.namespace!==`*`&&e.namespace!==t.namespace||e.attrName!==void 0&&(!n||!t.values||!(e.attrName in t.values)||e.attrValue!==void 0&&String(t.values[e.attrName])!==String(e.attrValue)))return!1;if(e.position!==void 0){if(!n)return!1;let r=t.counter??0;if(e.position===`first`&&r!==0||e.position===`odd`&&r%2!=1||e.position===`even`&&r%2!=0||e.position===`nth`&&r!==e.positionValue)return!1}return!0}matchesAny(e){return e.matchesAny(this)}snapshot(){return{path:this.path.map(e=>({...e})),siblingStacks:this.siblingStacks.map(e=>new Map(e)),keptAttrs:this._keptAttrs.map(e=>({...e}))}}restore(e){this._pathStringCache=null,this.path=e.path.map(e=>({...e})),this.siblingStacks=e.siblingStacks.map(e=>new Map(e)),this._keptAttrs=(e.keptAttrs||[]).map(e=>({...e}))}readOnly(){return this._view}};function Xt(e,t){if(!e)return{};let n=t.attributesGroupName?e[t.attributesGroupName]:e;if(!n)return{};let r={};for(let e in n)if(e.startsWith(t.attributeNamePrefix)){let i=e.substring(t.attributeNamePrefix.length);r[i]=n[e]}else r[e]=n[e];return r}function Zt(e){if(!e||typeof e!=`string`)return;let t=e.indexOf(`:`);if(t!==-1&&t>0){let n=e.substring(0,t);if(n!==`xmlns`)return n}}var Qt=class{constructor(e,t){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.parseXml=rn,this.parseTextData=$t,this.resolveNameSpace=en,this.buildAttributesMap=nn,this.isItStopNode=cn,this.replaceEntitiesValue=on,this.readStopNodeData=fn,this.saveTextToParentTag=sn,this.addChild=an,this.ignoreAttributesFn=Kt(this.options.ignoreAttributes),this.entityExpansionCount=0,this.currentExpandedLength=0;let n={...Xe};this.options.entityDecoder?this.entityDecoder=this.options.entityDecoder:(typeof this.options.htmlEntities==`object`?n=this.options.htmlEntities:this.options.htmlEntities===!0&&(n={...Ze,...qe}),this.entityDecoder=new st({namedEntities:{...n,...t},numericAllowed:this.options.htmlEntities,limit:{maxTotalExpansions:this.options.processEntities.maxTotalExpansions,maxExpandedLength:this.options.processEntities.maxExpandedLength,applyLimitsTo:this.options.processEntities.appliesTo}})),this.matcher=new Yt,this.readonlyMatcher=this.matcher.readOnly(),this.isCurrentNodeStopNode=!1,this.stopNodeExpressionsSet=new qt;let r=this.options.stopNodes;if(r&&r.length>0){for(let e=0;e<r.length;e++){let t=r[e];typeof t==`string`?this.stopNodeExpressionsSet.add(new Y(t)):t instanceof Y&&this.stopNodeExpressionsSet.add(t)}this.stopNodeExpressionsSet.seal()}}};function $t(e,t,n,r,i,a,o){let s=this.options;if(e!==void 0&&(s.trimValues&&!r&&(e=e.trim()),e.length>0)){o||(e=this.replaceEntitiesValue(e,t,n));let r=s.jPath?n.toString():n,c=s.tagValueProcessor(t,e,r,i,a);return c==null?e:typeof c!=typeof e||c!==e?c:s.trimValues||e.trim()===e?pn(e,s.parseTagValue,s.numberParseOptions):e}}function en(e){if(this.options.removeNSPrefix){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}var tn=RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,`gm`);function nn(e,t,n,r=!1){let i=this.options;if(r===!0||i.ignoreAttributes!==!0&&typeof e==`string`){let r=Me(e,tn),a=r.length,o={},s=Array(a),c=!1,l={};for(let e=0;e<a;e++){let t=this.resolveNameSpace(r[e][1]),a=r[e][4];if(t.length&&a!==void 0){let r=a;i.trimValues&&(r=r.trim()),r=this.replaceEntitiesValue(r,n,this.readonlyMatcher),s[e]=r,l[t]=r,c=!0}}c&&typeof t==`object`&&t.updateCurrent&&t.updateCurrent(l);let u=i.jPath?t.toString():this.readonlyMatcher,d=!1;for(let e=0;e<a;e++){let t=this.resolveNameSpace(r[e][1]);if(this.ignoreAttributesFn(t,u))continue;let n=i.attributeNamePrefix+t;if(t.length)if(i.transformAttributeName&&(n=i.transformAttributeName(n)),n=hn(n,i),r[e][4]!==void 0){let r=s[e],a=i.attributeValueProcessor(t,r,u);a==null?o[n]=r:typeof a!=typeof r||a!==r?o[n]=a:o[n]=pn(r,i.parseAttributeValue,i.numberParseOptions),d=!0}else i.allowBooleanAttributes&&(o[n]=!0,d=!0)}if(!d)return;if(i.attributesGroupName&&!i.preserveOrder){let e={};return e[i.attributesGroupName]=o,e}return o}}var rn=function(e){e=e.replace(/\r\n?/g,`
|
|
3
|
+
`);let t=new K(`!xml`),n=t,r=``;this.matcher.reset(),this.entityDecoder.reset(),this.entityExpansionCount=0,this.currentExpandedLength=0;let i=this.options,a=new Ct(i.processEntities),o=e.length;for(let s=0;s<o;s++)if(e[s]===`<`){let c=e.charCodeAt(s+1);if(c===47){let t=X(e,`>`,s,`Closing Tag is not closed.`),a=e.substring(s+2,t).trim();if(i.removeNSPrefix){let e=a.indexOf(`:`);e!==-1&&(a=a.substr(e+1))}a=mn(i.transformTagName,a,``,i).tagName,n&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher));let o=this.matcher.getCurrentTag();if(a&&i.unpairedTagsSet.has(a))throw Error(`Unpaired tag can not be used as closing tag: </${a}>`);o&&i.unpairedTagsSet.has(o)&&(this.matcher.pop(),this.tagsNodeStack.pop()),this.matcher.pop(),this.isCurrentNodeStopNode=!1,n=this.tagsNodeStack.pop(),r=``,s=t}else if(c===63){let t=dn(e,s,!1,`?>`);if(!t)throw Error(`Pi Tag is not closed.`);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.buildAttributesMap(t.tagExp,this.matcher,t.tagName,!0);if(o){let e=o[this.options.attributeNamePrefix+`version`];this.entityDecoder.setXmlVersion(Number(e)||1),a.setXmlVersion(Number(e)||1)}if(!(i.ignoreDeclaration&&t.tagName===`?xml`||i.ignorePiTags)){let e=new K(t.tagName);e.add(i.textNodeName,``),t.tagName!==t.tagExp&&t.attrExpPresent&&i.ignoreAttributes!==!0&&(e[`:@`]=o),this.addChild(n,e,this.readonlyMatcher,s)}s=t.closeIndex+1}else if(c===33&&e.charCodeAt(s+2)===45&&e.charCodeAt(s+3)===45){let t=X(e,`-->`,s+4,`Comment is not closed.`);if(i.commentPropName){let a=e.substring(s+4,t-2);r=this.saveTextToParentTag(r,n,this.readonlyMatcher),n.add(i.commentPropName,[{[i.textNodeName]:a}])}s=t}else if(c===33&&e.charCodeAt(s+2)===68){let t=a.readDocType(e,s);this.entityDecoder.addInputEntities(t.entities),s=t.i}else if(c===33&&e.charCodeAt(s+2)===91){let t=X(e,`]]>`,s,`CDATA is not closed.`)-2,a=e.substring(s+9,t);r=this.saveTextToParentTag(r,n,this.readonlyMatcher);let o=this.parseTextData(a,n.tagname,this.readonlyMatcher,!0,!1,!0,!0);o??=``,i.cdataPropName?n.add(i.cdataPropName,[{[i.textNodeName]:a}]):n.add(i.textNodeName,o),s=t+2}else{let a=dn(e,s,i.removeNSPrefix);if(!a){let t=e.substring(Math.max(0,s-50),Math.min(o,s+50));throw Error(`readTagExp returned undefined at position ${s}. Context: "${t}"`)}let c=a.tagName,l=a.rawTagName,u=a.tagExp,d=a.attrExpPresent,f=a.closeIndex;if({tagName:c,tagExp:u}=mn(i.transformTagName,c,u,i),i.strictReservedNames&&(c===i.commentPropName||c===i.cdataPropName||c===i.textNodeName||c===i.attributesGroupName))throw Error(`Invalid tag name: ${c}`);n&&r&&n.tagname!==`!xml`&&(r=this.saveTextToParentTag(r,n,this.readonlyMatcher,!1));let p=n;p&&i.unpairedTagsSet.has(p.tagname)&&(n=this.tagsNodeStack.pop(),this.matcher.pop());let m=!1;u.length>0&&u.lastIndexOf(`/`)===u.length-1&&(m=!0,c[c.length-1]===`/`?(c=c.substr(0,c.length-1),u=c):u=u.substr(0,u.length-1),d=c!==u);let h=null,g;g=Zt(l),c!==t.tagname&&this.matcher.push(c,{},g),c!==u&&d&&(h=this.buildAttributesMap(u,this.matcher,c),h&&Xt(h,i)),c!==t.tagname&&(this.isCurrentNodeStopNode=this.isItStopNode());let _=s;if(this.isCurrentNodeStopNode){let t=``;if(m)s=a.closeIndex;else if(i.unpairedTagsSet.has(c))s=a.closeIndex;else{let n=this.readStopNodeData(e,l,f+1);if(!n)throw Error(`Unexpected end of ${l}`);s=n.i,t=n.tagContent}let r=new K(c);h&&(r[`:@`]=h),r.add(i.textNodeName,t),this.matcher.pop(),this.isCurrentNodeStopNode=!1,this.addChild(n,r,this.readonlyMatcher,_)}else{if(m){({tagName:c,tagExp:u}=mn(i.transformTagName,c,u,i));let e=new K(c);h&&(e[`:@`]=h),this.addChild(n,e,this.readonlyMatcher,_),this.matcher.pop(),this.isCurrentNodeStopNode=!1}else if(i.unpairedTagsSet.has(c)){let e=new K(c);h&&(e[`:@`]=h),this.addChild(n,e,this.readonlyMatcher,_),this.matcher.pop(),this.isCurrentNodeStopNode=!1,s=a.closeIndex;continue}else{let e=new K(c);if(this.tagsNodeStack.length>i.maxNestedTags)throw Error(`Maximum nested tags exceeded`);this.tagsNodeStack.push(n),h&&(e[`:@`]=h),this.addChild(n,e,this.readonlyMatcher,_),n=e}r=``,s=f}}}else r+=e[s];return t.child};function an(e,t,n,r){this.options.captureMetaData||(r=void 0);let i=this.options.jPath?n.toString():n,a=this.options.updateTag(t.tagname,i,t[`:@`]);a===!1||(typeof a==`string`&&(t.tagname=a),e.addChild(t,r))}function on(e,t,n){let r=this.options.processEntities;if(!r||!r.enabled)return e;if(r.allowedTags){let i=this.options.jPath?n.toString():n;if(!(Array.isArray(r.allowedTags)?r.allowedTags.includes(t):r.allowedTags(t,i)))return e}if(r.tagFilter){let i=this.options.jPath?n.toString():n;if(!r.tagFilter(t,i))return e}return this.entityDecoder.decode(e)}function sn(e,t,n,r){return e&&=(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[`:@`]?Object.keys(t[`:@`]).length!==0:!1,r),e!==void 0&&e!==``&&t.add(this.options.textNodeName,e),``),e}function cn(){return this.stopNodeExpressionsSet.size===0?!1:this.matcher.matchesAny(this.stopNodeExpressionsSet)}function ln(e,t,n=`>`){let r=0,i=e.length,a=n.charCodeAt(0),o=n.length>1?n.charCodeAt(1):-1,s=``,c=t;for(let n=t;n<i;n++){let t=e.charCodeAt(n);if(r)t===r&&(r=0);else if(t===34||t===39)r=t;else if(t===a)if(o!==-1){if(e.charCodeAt(n+1)===o)return s+=e.substring(c,n),{data:s,index:n}}else return s+=e.substring(c,n),{data:s,index:n};else t===9&&!r&&(s+=e.substring(c,n)+` `,c=n+1)}}function X(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i+t.length-1}function un(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i}function dn(e,t,n,r=`>`){let i=ln(e,t+1,r);if(!i)return;let a=i.data,o=i.index,s=a.search(/\s/),c=a,l=!0;s!==-1&&(c=a.substring(0,s),a=a.substring(s+1).trimStart());let u=c;if(n){let e=c.indexOf(`:`);e!==-1&&(c=c.substr(e+1),l=c!==i.data.substr(e+1))}return{tagName:c,tagExp:a,closeIndex:o,attrExpPresent:l,rawTagName:u}}function fn(e,t,n){let r=n,i=1,a=e.length;for(;n<a;n++)if(e[n]===`<`){let a=e.charCodeAt(n+1);if(a===47){let a=un(e,`>`,n,`${t} is not closed`);if(e.substring(n+2,a).trim()===t&&(i--,i===0))return{tagContent:e.substring(r,n),i:a};n=a}else if(a===63)n=X(e,`?>`,n+1,`StopNode is not closed.`);else if(a===33&&e.charCodeAt(n+2)===45&&e.charCodeAt(n+3)===45)n=X(e,`-->`,n+3,`StopNode is not closed.`);else if(a===33&&e.charCodeAt(n+2)===91)n=X(e,`]]>`,n,`StopNode is not closed.`)-2;else{let r=dn(e,n,!1);r&&((r&&r.tagName)===t&&r.tagExp[r.tagExp.length-1]!==`/`&&i++,n=r.closeIndex)}}}function pn(e,t,n){if(t&&typeof e==`string`){let t=e.trim();return t===`true`?!0:t===`false`?!1:Bt(e,n)}else if(Pe(e))return e;else return``}function mn(e,t,n,r){if(e){let r=e(t);n===t&&(n=r),t=r}return t=hn(t,r),{tagName:t,tagExp:n}}function hn(e,t){if(Ie.includes(e))throw Error(`[SECURITY] Invalid name: "${e}" is a reserved JavaScript keyword that could cause prototype pollution`);return Fe.includes(e)?t.onDangerousProperty(e):e}var gn=K.getMetaDataSymbol();function _n(e,t){if(!e||typeof e!=`object`)return{};if(!t)return e;let n={};for(let r in e)if(r.startsWith(t)){let i=r.substring(t.length);n[i]=e[r]}else n[r]=e[r];return n}function vn(e,t,n,r){return yn(e,t,n,r)}function yn(e,t,n,r){let i,a={};for(let o=0;o<e.length;o++){let s=e[o],c=bn(s);if(c!==void 0&&c!==t.textNodeName){let e=_n(s[`:@`]||{},t.attributeNamePrefix);n.push(c,e)}if(c===t.textNodeName)i===void 0?i=s[c]:i+=``+s[c];else if(c===void 0)continue;else if(s[c]){let e=yn(s[c],t,n,r),i=Sn(e,t);if(Object.keys(e).length===0&&t.alwaysCreateTextNode&&(e[t.textNodeName]=``),s[`:@`]?xn(e,s[`:@`],r,t):Object.keys(e).length===1&&e[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?e=e[t.textNodeName]:Object.keys(e).length===0&&(t.alwaysCreateTextNode?e[t.textNodeName]=``:e=``),s[gn]!==void 0&&typeof e==`object`&&e&&(e[gn]=s[gn]),a[c]!==void 0&&Object.prototype.hasOwnProperty.call(a,c))Array.isArray(a[c])||(a[c]=[a[c]]),a[c].push(e);else{let n=t.jPath?r.toString():r;t.isArray(c,n,i)?a[c]=[e]:a[c]=e}c!==void 0&&c!==t.textNodeName&&n.pop()}}return typeof i==`string`?i.length>0&&(a[t.textNodeName]=i):i!==void 0&&(a[t.textNodeName]=i),a}function bn(e){let t=Object.keys(e);for(let e=0;e<t.length;e++){let n=t[e];if(n!==`:@`)return n}}function xn(e,t,n,r){if(t){let i=Object.keys(t),a=i.length;for(let o=0;o<a;o++){let a=i[o],s=a.startsWith(r.attributeNamePrefix)?a.substring(r.attributeNamePrefix.length):a,c=r.jPath?n.toString()+`.`+s:n;r.isArray(a,c,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function Sn(e,t){let{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]==`boolean`||e[n]===0))}var Cn={allowBooleanAttributes:!1,unpairedTags:[]};function wn(e,t){t=Object.assign({},Cn,t);let n=[],r=!1,i=!1;e[0]===``&&(e=e.substr(1));for(let a=0;a<e.length;a++)if(e[a]===`<`&&e[a+1]===`?`){if(a+=2,a=En(e,a),a.err)return a}else if(e[a]===`<`){let o=a;if(a++,e[a]===`!`){a=Dn(e,a);continue}else{let s=!1;e[a]===`/`&&(s=!0,a++);let c=``;for(;a<e.length&&e[a]!==`>`&&e[a]!==` `&&e[a]!==` `&&e[a]!==`
|
|
4
|
+
`&&e[a]!==`\r`;a++)c+=e[a];if(c=c.trim(),c[c.length-1]===`/`&&(c=c.substring(0,c.length-1),a--),!In(c)){let t;return t=c.trim().length===0?`Invalid space after '<'.`:`Tag '`+c+`' is an invalid name.`,Z(`InvalidTag`,t,Q(e,a))}let l=An(e,a);if(l===!1)return Z(`InvalidAttr`,`Attributes for '`+c+`' have open quote.`,Q(e,a));let u=l.value;if(a=l.index,u[u.length-1]===`/`){let n=a-u.length;u=u.substring(0,u.length-1);let i=Mn(u,t);if(i===!0)r=!0;else return Z(i.err.code,i.err.msg,Q(e,n+i.err.line))}else if(s){if(!l.tagClosed)return Z(`InvalidTag`,`Closing tag '`+c+`' doesn't have proper closing.`,Q(e,a));if(u.trim().length>0)return Z(`InvalidTag`,`Closing tag '`+c+`' can't have attributes or invalid starting.`,Q(e,o));if(n.length===0)return Z(`InvalidTag`,`Closing tag '`+c+`' has not been opened.`,Q(e,o));{let t=n.pop();if(c!==t.tagName){let n=Q(e,t.tagStartPos);return Z(`InvalidTag`,`Expected closing tag '`+t.tagName+`' (opened in line `+n.line+`, col `+n.col+`) instead of closing tag '`+c+`'.`,Q(e,o))}n.length==0&&(i=!0)}}else{let s=Mn(u,t);if(s!==!0)return Z(s.err.code,s.err.msg,Q(e,a-u.length+s.err.line));if(i===!0)return Z(`InvalidXml`,`Multiple possible root nodes found.`,Q(e,a));t.unpairedTags.indexOf(c)!==-1||n.push({tagName:c,tagStartPos:o}),r=!0}for(a++;a<e.length;a++)if(e[a]===`<`)if(e[a+1]===`!`){a++,a=Dn(e,a);continue}else if(e[a+1]===`?`){if(a=En(e,++a),a.err)return a}else break;else if(e[a]===`&`){let t=Pn(e,a);if(t==-1)return Z(`InvalidChar`,`char '&' is not expected.`,Q(e,a));a=t}else if(i===!0&&!Tn(e[a]))return Z(`InvalidXml`,`Extra text at the end`,Q(e,a));e[a]===`<`&&a--}}else{if(Tn(e[a]))continue;return Z(`InvalidChar`,`char '`+e[a]+`' is not expected.`,Q(e,a))}return r?n.length==1?Z(`InvalidTag`,`Unclosed tag '`+n[0].tagName+`'.`,Q(e,n[0].tagStartPos)):n.length>0?Z(`InvalidXml`,`Invalid '`+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,``)+`' found.`,{line:1,col:1}):!0:Z(`InvalidXml`,`Start tag expected.`,1)}function Tn(e){return e===` `||e===` `||e===`
|
|
5
|
+
`||e===`\r`}function En(e,t){let n=t;for(;t<e.length;t++)if(e[t]==`?`||e[t]==` `){let r=e.substr(n,t-n);if(t>5&&r===`xml`)return Z(`InvalidXml`,`XML declaration allowed only at the start of the document.`,Q(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}else continue}return t}function Dn(e,t){if(e.length>t+5&&e[t+1]===`-`&&e[t+2]===`-`){for(t+=3;t<e.length;t++)if(e[t]===`-`&&e[t+1]===`-`&&e[t+2]===`>`){t+=2;break}}else if(e.length>t+8&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t<e.length;t++)if(e[t]===`<`)n++;else if(e[t]===`>`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t<e.length;t++)if(e[t]===`]`&&e[t+1]===`]`&&e[t+2]===`>`){t+=2;break}}return t}var On=`"`,kn=`'`;function An(e,t){let n=``,r=``,i=!1;for(;t<e.length;t++){if(e[t]===On||e[t]===kn)r===``?r=e[t]:r!==e[t]||(r=``);else if(e[t]===`>`&&r===``){i=!0;break}n+=e[t]}return r===``?{value:n,index:t,tagClosed:i}:!1}var jn=RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,`g`);function Mn(e,t){let n=Me(e,jn),r={};for(let e=0;e<n.length;e++){if(n[e][1].length===0)return Z(`InvalidAttr`,`Attribute '`+n[e][2]+`' has no space in starting.`,Ln(n[e]));if(n[e][3]!==void 0&&n[e][4]===void 0)return Z(`InvalidAttr`,`Attribute '`+n[e][2]+`' is without value.`,Ln(n[e]));if(n[e][3]===void 0&&!t.allowBooleanAttributes)return Z(`InvalidAttr`,`boolean attribute '`+n[e][2]+`' is not allowed.`,Ln(n[e]));let i=n[e][2];if(!Fn(i))return Z(`InvalidAttr`,`Attribute '`+i+`' is an invalid name.`,Ln(n[e]));if(!Object.prototype.hasOwnProperty.call(r,i))r[i]=1;else return Z(`InvalidAttr`,`Attribute '`+i+`' is repeated.`,Ln(n[e]))}return!0}function Nn(e,t){let n=/\d/;for(e[t]===`x`&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(e[t]===`;`)return t;if(!e[t].match(n))break}return-1}function Pn(e,t){if(t++,e[t]===`;`)return-1;if(e[t]===`#`)return t++,Nn(e,t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(e[t]===`;`)break;return-1}return t}function Z(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Fn(e){return Ne(e)}function In(e){return Ne(e)}function Q(e,t){let n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Ln(e){return e.startIndex+e[1].length}var Rn=class{constructor(e){this.externalEntities={},this.options=ft(e)}parse(e,t){if(typeof e!=`string`&&e.toString)e=e.toString();else if(typeof e!=`string`)throw Error(`XML data is accepted in String or Bytes[] form.`);if(t){t===!0&&(t={});let n=wn(e,t);if(n!==!0)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}let n=new Qt(this.options,this.externalEntities),r=n.parseXml(e);return this.options.preserveOrder||r===void 0?r:vn(r,this.options,n.matcher,n.readonlyMatcher)}addEntity(e,t){if(t.indexOf(`&`)!==-1)throw Error(`Entity value can't have '&'`);if(e.indexOf(`&`)!==-1||e.indexOf(`;`)!==-1)throw Error(`An entity must be set without '&' and ';'. Eg. use '#xD' for '
'`);if(t===`&`)throw Error(`An entity with value '&' is not permitted`);this.externalEntities[e]=t}static getMetaDataSymbol(){return K.getMetaDataSymbol()}};function zn(e){return String(e).replace(/--/g,`- -`).replace(/--/g,`- -`).replace(/-$/,`- `)}function Bn(e){return String(e).replace(/\]\]>/g,`]]]]><![CDATA[>`)}function Vn(e){return String(e).replace(/"/g,`"`).replace(/'/g,`'`)}var Hn=`
|
|
6
|
+
`;function Un(e,t){if(!Array.isArray(e)||e.length===0)return`1.0`;let n=e[0];if(Xn(n)===`?xml`){let e=n[`:@`];if(e){let n=t.attributeNamePrefix+`version`;if(e[n])return e[n]}}return`1.0`}function Wn(e,t,n,r,i){return!n.sanitizeName||St(e,{xmlVersion:i})?e:n.sanitizeName(e,{isAttribute:t,matcher:r.readOnly()})}function Gn(e,t){let n=``;t.format&&(n=Hn);let r=[];if(t.stopNodes&&Array.isArray(t.stopNodes))for(let e=0;e<t.stopNodes.length;e++){let n=t.stopNodes[e];typeof n==`string`?r.push(new Y(n)):n instanceof Y&&r.push(n)}let i=Un(e,t),a=new Yt;return Kn(e,t,n,a,r,i)}function Kn(e,t,n,r,i,a){let o=``,s=!1;if(t.maxNestedTags&&r.getDepth()>t.maxNestedTags)throw Error(`Maximum nested tags exceeded`);if(!Array.isArray(e)){if(e!=null){let n=e.toString();return n=$n(n,t),n}return``}for(let c=0;c<e.length;c++){let l=e[c],u=Xn(l);if(u===void 0)continue;let d=u===t.textNodeName||u===t.cdataPropName||u===t.commentPropName||u[0]===`?`?u:Wn(u,!1,t,r,a),f=qn(l[`:@`],t);r.push(d,f);let p=Qn(r,i);if(d===t.textNodeName){let e=l[u];p||(e=t.tagValueProcessor(d,e),e=$n(e,t)),s&&(o+=n),o+=e,s=!1,r.pop();continue}else if(d===t.cdataPropName){s&&(o+=n);let e=l[u][0][t.textNodeName],i=Bn(e);o+=`<![CDATA[${i}]]>`,s=!1,r.pop();continue}else if(d===t.commentPropName){let e=l[u][0][t.textNodeName],i=zn(e);o+=n+`<!--${i}-->`,s=!0,r.pop();continue}else if(d[0]===`?`){let e=Zn(l[`:@`],t,p,r,a);o+=(d===`?xml`?``:n)+`<${d}${e}?>`,s=!0,r.pop();continue}let m=n;m!==``&&(m+=t.indentBy);let h=n+`<${d}${Zn(l[`:@`],t,p,r,a)}`,g;g=p?Jn(l[u],t):Kn(l[u],t,m,r,i,a),t.unpairedTags.indexOf(d)===-1?(!g||g.length===0)&&t.suppressEmptyNode?o+=h+`/>`:g&&g.endsWith(`>`)?o+=h+`>${g}${n}</${d}>`:(o+=h+`>`,g&&n!==``&&(g.includes(`/>`)||g.includes(`</`))?o+=n+t.indentBy+g+n:o+=g,o+=`</${d}>`):t.suppressUnpairedNode?o+=h+`>`:o+=h+`/>`,s=!0,r.pop()}return o}function qn(e,t){if(!e||t.ignoreAttributes)return null;let n={},r=!1;for(let i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;let a=i.startsWith(t.attributeNamePrefix)?i.substr(t.attributeNamePrefix.length):i;n[a]=Vn(e[i]),r=!0}return r?n:null}function Jn(e,t){if(!Array.isArray(e))return e==null?``:e.toString();let n=``;for(let r=0;r<e.length;r++){let i=e[r],a=Xn(i);if(a===t.textNodeName)n+=i[a];else if(a===t.cdataPropName)n+=i[a][0][t.textNodeName];else if(a===t.commentPropName)n+=i[a][0][t.textNodeName];else if(a&&a[0]===`?`)continue;else if(a){let e=Yn(i[`:@`],t),r=Jn(i[a],t);!r||r.length===0?n+=`<${a}${e}/>`:n+=`<${a}${e}>${r}</${a}>`}}return n}function Yn(e,t){let n=``;if(e&&!t.ignoreAttributes)for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=e[r];i===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${Vn(i)}"`}return n}function Xn(e){let t=Object.keys(e);for(let n=0;n<t.length;n++){let r=t[n];if(Object.prototype.hasOwnProperty.call(e,r)&&r!==`:@`)return r}}function Zn(e,t,n,r,i){let a=``;if(e&&!t.ignoreAttributes)for(let o in e){if(!Object.prototype.hasOwnProperty.call(e,o))continue;let s=o.substr(t.attributeNamePrefix.length),c=n?s:Wn(s,!0,t,r,i),l;n?l=e[o]:(l=t.attributeValueProcessor(o,e[o]),l=$n(l,t)),l===!0&&t.suppressBooleanAttributes?a+=` ${c}`:a+=` ${c}="${Vn(l)}"`}return a}function Qn(e,t){if(!t||t.length===0)return!1;for(let n=0;n<t.length;n++)if(e.matches(t[n]))return!0;return!1}function $n(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){let r=t.entities[n];e=e.replace(r.regex,r.val)}return e}function er(e){return typeof e==`function`?e:Array.isArray(e)?t=>{for(let n of e)if(typeof n==`string`&&t===n||n instanceof RegExp&&n.test(t))return!0}:()=>!1}var tr={attributeNamePrefix:`@_`,attributesGroupName:!1,textNodeName:`#text`,ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:` `,suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:RegExp(`&`,`g`),val:`&`},{regex:RegExp(`>`,`g`),val:`>`},{regex:RegExp(`<`,`g`),val:`<`},{regex:RegExp(`'`,`g`),val:`'`},{regex:RegExp(`"`,`g`),val:`"`}],processEntities:!0,stopNodes:[],oneListGroup:!1,maxNestedTags:100,jPath:!0,sanitizeName:!1};function $(e){if(this.options=Object.assign({},tr,e),this.options.stopNodes&&Array.isArray(this.options.stopNodes)&&(this.options.stopNodes=this.options.stopNodes.map(e=>typeof e==`string`&&e.startsWith(`*.`)?`..`+e.substring(2):e)),this.stopNodeExpressions=[],this.options.stopNodes&&Array.isArray(this.options.stopNodes))for(let e=0;e<this.options.stopNodes.length;e++){let t=this.options.stopNodes[e];typeof t==`string`?this.stopNodeExpressions.push(new Y(t)):t instanceof Y&&this.stopNodeExpressions.push(t)}this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=er(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=or),this.processTextOrObjNode=ir,this.options.format?(this.indentate=ar,this.tagEndChar=`>
|
|
7
|
+
`,this.newLine=`
|
|
8
|
+
`):(this.indentate=function(){return``},this.tagEndChar=`>`,this.newLine=``)}function nr(e,t){let n=e[`?xml`];if(n&&typeof n==`object`){if(t.attributesGroupName&&n[t.attributesGroupName]){let e=n[t.attributesGroupName][t.attributeNamePrefix+`version`];if(e)return e}let e=n[t.attributeNamePrefix+`version`];if(e)return e}return`1.0`}function rr(e,t,n,r,i){return!n.sanitizeName||St(e,{xmlVersion:i})?e:n.sanitizeName(e,{isAttribute:t,matcher:r.readOnly()})}$.prototype.build=function(e){if(this.options.preserveOrder)return Gn(e,this.options);{Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e});let t=new Yt,n=nr(e,this.options);return this.j2x(e,0,t,n).val}},$.prototype.j2x=function(e,t,n,r){let i=``,a=``;if(this.options.maxNestedTags&&n.getDepth()>=this.options.maxNestedTags)throw Error(`Maximum nested tags exceeded`);let o=this.options.jPath?n.toString():n,s=this.checkStopNode(n);for(let c in e){if(!Object.prototype.hasOwnProperty.call(e,c))continue;let l=c===this.options.textNodeName||c===this.options.cdataPropName||c===this.options.commentPropName||this.options.attributesGroupName&&c===this.options.attributesGroupName||this.isAttribute(c)||c[0]===`?`?c:rr(c,!1,this.options,n,r);if(e[c]===void 0)this.isAttribute(c)&&(a+=``);else if(e[c]===null)this.isAttribute(c)||l===this.options.cdataPropName||l===this.options.commentPropName?a+=``:l[0]===`?`?a+=this.indentate(t)+`<`+l+`?`+this.tagEndChar:a+=this.indentate(t)+`<`+l+`/`+this.tagEndChar;else if(e[c]instanceof Date)a+=this.buildTextValNode(e[c],l,``,t,n);else if(typeof e[c]!=`object`){let u=this.isAttribute(c);if(u&&!this.ignoreAttributesFn(u,o)){let t=rr(u,!0,this.options,n,r);i+=this.buildAttrPairStr(t,``+e[c],s)}else if(!u)if(c===this.options.textNodeName){let t=this.options.tagValueProcessor(c,``+e[c]);a+=this.replaceEntitiesValue(t)}else{n.push(l);let r=this.checkStopNode(n);if(n.pop(),r){let n=``+e[c];n===``?a+=this.indentate(t)+`<`+l+this.closeTag(l)+this.tagEndChar:a+=this.indentate(t)+`<`+l+`>`+n+`</`+l+this.tagEndChar}else a+=this.buildTextValNode(e[c],l,``,t,n)}}else if(Array.isArray(e[c])){let i=e[c].length,o=``,s=``;for(let u=0;u<i;u++){let i=e[c][u];if(i!==void 0)if(i===null)l[0]===`?`?a+=this.indentate(t)+`<`+l+`?`+this.tagEndChar:a+=this.indentate(t)+`<`+l+`/`+this.tagEndChar;else if(typeof i==`object`)if(this.options.oneListGroup){n.push(l);let e=this.j2x(i,t+1,n,r);n.pop(),o+=e.val,this.options.attributesGroupName&&i.hasOwnProperty(this.options.attributesGroupName)&&(s+=e.attrStr)}else o+=this.processTextOrObjNode(i,l,t,n,r);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(l,i);e=this.replaceEntitiesValue(e),o+=e}else{n.push(l);let e=this.checkStopNode(n);if(n.pop(),e){let e=``+i;e===``?o+=this.indentate(t)+`<`+l+this.closeTag(l)+this.tagEndChar:o+=this.indentate(t)+`<`+l+`>`+e+`</`+l+this.tagEndChar}else o+=this.buildTextValNode(i,l,``,t,n)}}this.options.oneListGroup&&(o=this.buildObjectNode(o,l,s,t)),a+=o}else if(this.options.attributesGroupName&&c===this.options.attributesGroupName){let t=Object.keys(e[c]),a=t.length;for(let o=0;o<a;o++){let a=rr(t[o],!0,this.options,n,r);i+=this.buildAttrPairStr(a,``+e[c][t[o]],s)}}else a+=this.processTextOrObjNode(e[c],l,t,n,r)}return{attrStr:i,val:a}},$.prototype.buildAttrPairStr=function(e,t,n){return n||(t=this.options.attributeValueProcessor(e,``+t),t=this.replaceEntitiesValue(t)),this.options.suppressBooleanAttributes&&t===`true`?` `+e:` `+e+`="`+Vn(t)+`"`};function ir(e,t,n,r,i){let a=this.extractAttributes(e);if(r.push(t,a),this.checkStopNode(r)){let i=this.buildRawContent(e),a=this.buildAttributesForStopNode(e);return r.pop(),this.buildObjectNode(i,t,a,n)}let o=this.j2x(e,n+1,r,i);return r.pop(),t[0]===`?`?this.buildTextValNode(``,t,o.attrStr,n,r):e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n,r):this.buildObjectNode(o.val,t,o.attrStr,n)}$.prototype.extractAttributes=function(e){if(!e||typeof e!=`object`)return null;let t={},n=!1;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){let r=e[this.options.attributesGroupName];for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let i=e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e;t[i]=Vn(r[e]),n=!0}}else for(let r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;let i=this.isAttribute(r);i&&(t[i]=Vn(e[r]),n=!0)}return n?t:null},$.prototype.buildRawContent=function(e){if(typeof e==`string`)return e;if(typeof e!=`object`||!e)return String(e);if(e[this.options.textNodeName]!==void 0)return e[this.options.textNodeName];let t=``;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n)||this.isAttribute(n)||this.options.attributesGroupName&&n===this.options.attributesGroupName)continue;let r=e[n];if(n===this.options.textNodeName)t+=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`||typeof e==`number`)t+=`<${n}>${e}</${n}>`;else if(typeof e==`object`&&e){let r=this.buildRawContent(e),i=this.buildAttributesForStopNode(e);r===``?t+=`<${n}${i}/>`:t+=`<${n}${i}>${r}</${n}>`}}else if(typeof r==`object`&&r){let e=this.buildRawContent(r),i=this.buildAttributesForStopNode(r);e===``?t+=`<${n}${i}/>`:t+=`<${n}${i}>${e}</${n}>`}else t+=`<${n}>${r}</${n}>`}return t},$.prototype.buildAttributesForStopNode=function(e){if(!e||typeof e!=`object`)return``;let t=``;if(this.options.attributesGroupName&&e[this.options.attributesGroupName]){let n=e[this.options.attributesGroupName];for(let e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let r=e.startsWith(this.options.attributeNamePrefix)?e.substring(this.options.attributeNamePrefix.length):e,i=n[e];i===!0&&this.options.suppressBooleanAttributes?t+=` `+r:t+=` `+r+`="`+i+`"`}}else for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;let r=this.isAttribute(n);if(r){let i=e[n];i===!0&&this.options.suppressBooleanAttributes?t+=` `+r:t+=` `+r+`="`+i+`"`}}return t},$.prototype.buildObjectNode=function(e,t,n,r){if(e===``)return t[0]===`?`?this.indentate(r)+`<`+t+n+`?`+this.tagEndChar:this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar;if(t[0]===`?`)return this.indentate(r)+`<`+t+n+`?`+this.tagEndChar;{let i=`</`+t+this.tagEndChar,a=``;return t[0]===`?`&&(a=`?`,i=``),(n||n===``)&&e.indexOf(`<`)===-1?this.indentate(r)+`<`+t+n+a+`>`+e+i:this.options.commentPropName!==!1&&t===this.options.commentPropName&&a.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+`<`+t+n+a+this.tagEndChar+e+this.indentate(r)+i}},$.prototype.closeTag=function(e){let t=``;return this.options.unpairedTags.indexOf(e)===-1?t=this.options.suppressEmptyNode?`/`:`></${e}`:this.options.suppressUnpairedNode||(t=`/`),t},$.prototype.checkStopNode=function(e){if(!this.stopNodeExpressions||this.stopNodeExpressions.length===0)return!1;for(let t=0;t<this.stopNodeExpressions.length;t++)if(e.matches(this.stopNodeExpressions[t]))return!0;return!1},$.prototype.buildTextValNode=function(e,t,n,r,i){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName){let t=Bn(e);return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine}else if(this.options.commentPropName!==!1&&t===this.options.commentPropName){let t=zn(e);return this.indentate(r)+`<!--${t}-->`+this.newLine}else if(t[0]===`?`)return this.indentate(r)+`<`+t+n+`?`+this.tagEndChar;else{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===``?this.indentate(r)+`<`+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+`<`+t+n+`>`+i+`</`+t+this.tagEndChar}},$.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){let n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};function ar(e){return this.options.indentBy.repeat(e)}function or(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}var sr=$,cr={ignoreAttributes:!1,attributeNamePrefix:`@_`,format:!0,indentBy:` `,suppressEmptyNode:!1,suppressBooleanAttributes:!1},lr={ignoreAttributes:!1,attributeNamePrefix:`@_`,parseTagValue:!0,trimValues:!0,isArray:e=>e===`BarcodeBlockSetting`};function ur(e){let t={BarcodeMultiZoneSetting:{"@_xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`,"@_xmlns:xsd":`http://www.w3.org/2001/XMLSchema`,PaperSizeW:e.PaperSizeW,PaperSizeH:e.PaperSizeH,DPI:e.DPI,StampsPerPage:e.StampsPerPage,MarginLeft:e.MarginLeft,MarginRight:e.MarginRight,MarginTop:e.MarginTop,MarginBottom:e.MarginBottom,BarCodeWidth:e.BarCodeWidth,BarCodeHeight:e.BarCodeHeight,BarcodeOffsetLeft:e.BarcodeOffsetLeft,BarcodeOffsetTop:e.BarcodeOffsetTop,BarcodePrinterName:e.BarcodePrinterName||null,SamplpeBarcode:e.SamplpeBarcode||null,BarcodeBlockSettings:{BarcodeBlockSetting:e.BarcodeBlockSettings.map(dr)}}};return e.BarcodeBlockSettings.length===0&&(t.BarcodeMultiZoneSetting={...t.BarcodeMultiZoneSetting,BarcodeBlockSettings:``}),new sr(cr).build(t)}function dr(e){let t={OffsetX:e.OffsetX,OffsetY:e.OffsetY,Width:e.Width,Height:e.Height,Angle:e.Angle,ShowBorder:e.ShowBorder,FontSetting:fr(e.FontSetting)};return e.Data!==null&&e.Data!==void 0?t.Data=e.Data:t.Data={"@_xsi:nil":`true`},t}function fr(e){return{FontFamily:e.FontFamily,FontSize:e.FontSize,LeftIndent:e.LeftIndent,RightIndent:e.RightIndent,IsBold:e.IsBold,IsItalic:e.IsItalic,Align:e.Align,SampleText:e.SampleText||null}}function pr(e){let t=new Rn(lr).parse(e).BarcodeMultiZoneSetting;if(!t)throw Error(`Invalid XML: missing BarcodeMultiZoneSetting root element`);let n=[],r=t.BarcodeBlockSettings;if(r&&r.BarcodeBlockSetting){let e=Array.isArray(r.BarcodeBlockSetting)?r.BarcodeBlockSetting:[r.BarcodeBlockSetting];for(let t of e)n.push(mr(t))}return{PaperSizeW:Number(t.PaperSizeW)||0,PaperSizeH:Number(t.PaperSizeH)||0,DPI:Number(t.DPI)||0,StampsPerPage:Number(t.StampsPerPage)||1,MarginLeft:Number(t.MarginLeft)||0,MarginRight:Number(t.MarginRight)||0,MarginTop:Number(t.MarginTop)||0,MarginBottom:Number(t.MarginBottom)||0,BarCodeWidth:Number(t.BarCodeWidth)||0,BarCodeHeight:Number(t.BarCodeHeight)||0,BarcodeOffsetLeft:Number(t.BarcodeOffsetLeft)||0,BarcodeOffsetTop:Number(t.BarcodeOffsetTop)||0,BarcodePrinterName:t.BarcodePrinterName==null?``:String(t.BarcodePrinterName),SamplpeBarcode:t.SamplpeBarcode==null?``:String(t.SamplpeBarcode),Orientation:Number(t.Orientation)||0,BarcodeBlockSettings:n}}function mr(e){let t=e.FontSetting,n=null;return e.Data&&typeof e.Data==`string`&&(n=e.Data),{OffsetX:Number(e.OffsetX)||0,OffsetY:Number(e.OffsetY)||0,Width:Number(e.Width)||0,Height:Number(e.Height)||0,Angle:Number(e.Angle)||0,Data:n,ShowBorder:e.ShowBorder===!0||e.ShowBorder===`true`,FontSetting:t?hr(t):{FontFamily:`Verdana`,FontSize:10,LeftIndent:0,RightIndent:0,IsBold:!1,IsItalic:!1,Align:`Center`,SampleText:``}}}function hr(e){return{FontFamily:String(e.FontFamily||`Verdana`),FontSize:Number(e.FontSize)||10,LeftIndent:Number(e.LeftIndent)||0,RightIndent:Number(e.RightIndent)||0,IsBold:e.IsBold===!0||e.IsBold===`true`,IsItalic:e.IsItalic===!0||e.IsItalic===`true`,Align:e.Align||`Center`,SampleText:String(e.SampleText||``)}}var gr=()=>{let{settings:e,showXmlPreview:n,setShowXmlPreview:r,setSettings:a}=z(),[o,s]=(0,t.useState)(!1),[c,l]=(0,t.useState)(!1),[u,d]=(0,t.useState)(``),[f,p]=(0,t.useState)(``);if(!n)return null;let m=ur(e),h=JSON.stringify(e,null,2),g=c?u:o?h:m;return(0,i.jsx)(`div`,{className:`modal-overlay`,onClick:()=>r(!1),children:(0,i.jsxs)(`div`,{className:`modal xml-preview-modal`,onClick:e=>e.stopPropagation(),children:[(0,i.jsxs)(`div`,{className:`modal-header`,children:[(0,i.jsx)(`h3`,{children:o?`{ } JSON Preview`:`</> XML Preview`}),(0,i.jsxs)(`div`,{className:`modal-header-actions`,children:[(0,i.jsx)(`button`,{className:`btn btn-sm ${o?`btn-accent`:`btn-secondary`}`,onClick:()=>{s(!o),l(!1)},children:o?`</> XML`:`{ } JSON`}),!c&&(0,i.jsx)(`button`,{className:`btn btn-sm btn-secondary`,onClick:()=>{d(o?h:m),l(!0)},children:`✏️ Edit`}),c&&(0,i.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>{try{a(o?JSON.parse(u):pr(u)),l(!1)}catch(e){alert(`Lỗi parse: `+e.message)}},children:`✓ Apply`}),(0,i.jsx)(`button`,{className:`btn btn-sm btn-secondary`,onClick:async()=>{try{await navigator.clipboard.writeText(g),p(`✓ Copied!`),setTimeout(()=>p(``),1500)}catch{p(`Error`)}},children:f||`📋 Copy`}),(0,i.jsx)(`button`,{className:`btn-close`,onClick:()=>r(!1),children:`✕`})]})]}),(0,i.jsx)(`div`,{className:`modal-body xml-body`,children:c?(0,i.jsx)(`textarea`,{className:`code-editor`,value:u,onChange:e=>d(e.target.value),spellCheck:!1}):(0,i.jsx)(`pre`,{className:`code-preview`,children:(0,i.jsx)(`code`,{children:g})})})]})})};function _r(e){return n.default.create({baseURL:e,headers:{"Content-Type":`application/json`}})}var vr=()=>(0,i.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,i.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,i.jsx)(`path`,{d:`m21 21-4.35-4.35`}),(0,i.jsx)(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`})]}),yr=()=>(0,i.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,i.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,i.jsx)(`path`,{d:`m21 21-4.35-4.35`}),(0,i.jsx)(`line`,{x1:`11`,y1:`8`,x2:`11`,y2:`14`}),(0,i.jsx)(`line`,{x1:`8`,y1:`11`,x2:`14`,y2:`11`})]}),br=()=>(0,i.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,i.jsx)(`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`}),(0,i.jsx)(`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`}),(0,i.jsx)(`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`}),(0,i.jsx)(`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`})]}),xr=()=>(0,i.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,i.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,i.jsx)(`line`,{x1:`12`,y1:`2`,x2:`12`,y2:`6`}),(0,i.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`22`}),(0,i.jsx)(`line`,{x1:`2`,y1:`12`,x2:`6`,y2:`12`}),(0,i.jsx)(`line`,{x1:`18`,y1:`12`,x2:`22`,y2:`12`})]}),Sr=()=>(0,i.jsxs)(`svg`,{width:`13`,height:`13`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,i.jsx)(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`}),(0,i.jsx)(`line`,{x1:`3`,y1:`15`,x2:`21`,y2:`15`})]}),Cr=()=>(0,i.jsxs)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,i.jsx)(`polyline`,{points:`6 9 6 2 18 2 18 9`}),(0,i.jsx)(`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`}),(0,i.jsx)(`rect`,{x:`6`,y:`14`,width:`12`,height:`8`})]});e.BarcodeBlockDataEnum=x,e.BarcodeDesigner=({apiBaseUrl:e,printApiBaseUrl:r,axiosInstance:a,className:o=``,style:s})=>{let c=(0,t.useMemo)(()=>a||_r(e??`/api`),[e,a]),l=(0,t.useMemo)(()=>ee(c),[c]),{showBorder:u,setShowBorder:d,activeContext:f,setPrintApiBaseUrl:p,toast:m,resetCanvasOffset:h}=z(),[g,_]=(0,t.useState)(450),[v,y]=(0,t.useState)(500),[b,x]=(0,t.useState)(1),[S,C]=(0,t.useState)(!1),[w,T]=(0,t.useState)(!0),[E,D]=(0,t.useState)(!1),[O,k]=(0,t.useState)(1);(0,t.useEffect)(()=>{p(r??null)},[r,p]);let A=.1,j=.3,M=(0,t.useRef)(!1),N=(0,t.useRef)(!1),P=(0,t.useRef)(0),F=(0,t.useRef)(0),I=(0,t.useRef)(null),L=(0,t.useRef)(null),R=(0,t.useRef)(null);(0,t.useEffect)(()=>{let e=e=>{if(I.current){if(M.current){let t=I.current.getBoundingClientRect(),n=e.clientX-t.left,r=Math.min(800,t.width*.7);n>=350&&n<=r&&_(n)}if(N.current&&R.current){let t=R.current.getBoundingClientRect().height,n=e.clientY-P.current,r=F.current+n,i=t-150;r>=200&&r<=i&&y(r)}}},t=()=>{(M.current||N.current)&&(M.current=!1,N.current=!1,document.body.style.cursor=`default`,document.body.style.userSelect=`auto`)};return document.addEventListener(`mousemove`,e),document.addEventListener(`mouseup`,t),()=>{document.removeEventListener(`mousemove`,e),document.removeEventListener(`mouseup`,t)}},[]),(0,t.useEffect)(()=>{let e=L.current;if(!e)return;let t=e=>{e.preventDefault(),x(t=>{let n=e.deltaY>0?-.1:A;return Math.min(3,Math.max(j,Math.round((t+n)*10)/10))})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let te=async()=>{let e=z.getState();if(e.printApiBaseUrl){D(!0);try{await n.default.post(`${e.printApiBaseUrl}/api/print/block`,[{settings:e.settings,showBorder:e.showBorder,copies:O}])}catch(e){console.error(`Print test failed:`,e)}finally{D(!1)}}},B=async()=>{let e=z.getState();if(!e.selectedTemplateId||!e.selectedPrinterId){e.showToast(`error`,`Chưa chọn template để lưu.`);return}try{await l.updateTemplate(e.selectedTemplateId,{settings:e.settings,printerInfoId:e.selectedPrinterId,type:e.selectedTemplateType??0}),e.showToast(`success`,`Đã lưu template.`)}catch{e.showToast(`error`,`Lưu template thất bại.`)}};return(0,t.useEffect)(()=>{let e=e=>{let t=e.target.tagName;if([`INPUT`,`TEXTAREA`,`SELECT`].includes(t)||e.target.isContentEditable)return;let n=e.ctrlKey||e.metaKey;n&&e.key===`z`&&!e.shiftKey?(e.preventDefault(),z.getState().undo()):n&&(e.key===`y`||e.key===`z`&&e.shiftKey)?(e.preventDefault(),z.getState().redo()):n&&e.key===`s`&&(e.preventDefault(),B())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[l]),(0,i.jsx)(ie.Provider,{value:l,children:(0,i.jsxs)(`div`,{className:`bcd-root ${o}`,style:s,children:[(0,i.jsxs)(`div`,{className:`app`,children:[(0,i.jsxs)(`main`,{className:`app-main`,ref:I,children:[!S&&(0,i.jsx)(`div`,{className:`left-column`,style:{width:g,minWidth:g,maxWidth:g},children:(0,i.jsx)(ce,{})}),!S&&(0,i.jsx)(`div`,{className:`resizer`,onMouseDown:e=>{e.preventDefault(),M.current=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},children:(0,i.jsx)(`div`,{className:`resizer-line`})}),(0,i.jsxs)(`div`,{className:`right-column`,ref:R,style:{padding:0},children:[(0,i.jsxs)(`div`,{className:`canvas-toolbar`,children:[(0,i.jsx)(`span`,{className:`canvas-breadcrumb`,children:f?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`strong`,{children:f.printerName}),(0,i.jsx)(`span`,{style:{color:`var(--border-color)`},children:`/`}),(0,i.jsx)(`span`,{children:f.templateId})]}):(0,i.jsx)(`span`,{children:`Chọn template để thiết kế`})}),(0,i.jsxs)(`div`,{className:`canvas-toolbar-right`,children:[(0,i.jsxs)(`label`,{className:`checkbox-label`,style:{fontSize:`12px`,color:`var(--text-secondary)`},children:[(0,i.jsx)(`input`,{type:`checkbox`,checked:u,onChange:e=>d(e.target.checked)}),`Đường viền`]}),(0,i.jsxs)(`div`,{className:`zoom-controls`,children:[(0,i.jsx)(`button`,{onClick:()=>x(e=>Math.max(j,Math.round((e-A)*10)/10)),title:`Thu nhỏ`,children:(0,i.jsx)(vr,{})}),(0,i.jsxs)(`span`,{className:`zoom-pct`,children:[Math.round(b*100),`%`]}),(0,i.jsx)(`button`,{onClick:()=>x(e=>Math.min(3,Math.round((e+A)*10)/10)),title:`Phóng to`,children:(0,i.jsx)(yr,{})}),(0,i.jsx)(`button`,{onClick:()=>C(e=>!e),title:S?`Thu gọn`:`Mở rộng canvas`,style:{marginLeft:2},children:(0,i.jsx)(br,{})}),(0,i.jsx)(`button`,{onClick:()=>{x(1),h()},title:`Đưa canvas về giữa`,style:{marginLeft:2},children:(0,i.jsx)(xr,{})}),(0,i.jsx)(`button`,{onClick:()=>T(e=>!e),title:w?`Ẩn properties`:`Hiện properties`,style:{marginLeft:2,color:w?`var(--accent)`:void 0},children:(0,i.jsx)(Sr,{})})]}),r&&(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:4},children:[(0,i.jsx)(`input`,{type:`number`,min:1,max:99,value:O,onChange:e=>k(Math.max(1,Math.min(99,Number(e.target.value)||1))),onClick:e=>e.stopPropagation(),disabled:E,title:`Số lượng in`,style:{width:44,height:28,borderRadius:6,border:`1px solid var(--border-color)`,textAlign:`center`,fontSize:12,fontWeight:500,color:`var(--text-primary)`,background:`#fff`,outline:`none`,padding:`0 4px`}}),(0,i.jsxs)(`button`,{className:`btn btn-sm btn-primary`,style:{display:`flex`,alignItems:`center`,gap:5},onClick:()=>void te(),disabled:E,title:`In test`,children:[(0,i.jsx)(Cr,{}),E?`Đang in...`:`In test`]})]})]})]}),(0,i.jsx)(`div`,{ref:L,className:`right-top-section`,style:w?{height:v,overflow:`hidden`,display:`flex`,flexDirection:`column`,padding:`16px`}:{flex:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,padding:`16px`},children:(0,i.jsx)(Se,{zoom:b})}),w&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(`div`,{className:`h-resizer`,onMouseDown:e=>{e.preventDefault(),N.current=!0,P.current=e.clientY,F.current=v,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`},children:(0,i.jsx)(`div`,{className:`h-resizer-line`})}),(0,i.jsx)(`div`,{className:`right-bottom-section`,style:{flex:S?1:void 0,overflowY:`auto`},children:(0,i.jsx)(Ae,{})})]})]})]}),(0,i.jsx)(gr,{})]}),m&&(0,i.jsx)(`div`,{className:`bcd-toast bcd-toast--${m.type}`,children:m.message})]})})},e.PrintTemplateType=R});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
@import "https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap";.bcd-root{--bg-primary:#f7f8f9;--bg-secondary:#fff;--bg-panel:#fff;--bg-panel-hover:#f7f8f9;--bg-input:#fff;--bg-modal:#fff;--border-color:#dddfe7;--border-active:#43b97f;--text-primary:#282b35;--text-secondary:#61667a;--text-muted:#8e91a0;--accent:#43b97f;--accent-hover:#359264;--accent-glow:#43b97f1f;--danger:#fe4848;--danger-hover:#d12b2b;--success:#1bb172;--warning:#ff6a00;--gradient-1:linear-gradient(135deg, #43b97f, #1bb172);--gradient-2:linear-gradient(135deg, #f7f8f9, #fff);--shadow-sm:0 1px 4px #282b3514;--shadow-md:0 4px 16px #282b351a;--shadow-lg:0 8px 32px #282b3524;--shadow-glow:0 0 20px #43b97f14;--radius:10px;--radius-sm:8px;--transition:all .2s cubic-bezier(.4, 0, .2, 1);font-size:14px}.bcd-root *,.bcd-root :before,.bcd-root :after{box-sizing:border-box;margin:0;padding:0}.bcd-root .app{background:var(--bg-primary);height:100%;color:var(--text-primary);-webkit-font-smoothing:antialiased;flex-direction:column;font-family:Inter,-apple-system,BlinkMacSystemFont,sans-serif;line-height:1.5;display:flex;overflow:hidden}.bcd-root .app-header{border-bottom:1px solid var(--border-color);z-index:10;background:#fff;justify-content:space-between;align-items:center;padding:12px 24px;display:flex}.bcd-root .header-left{align-items:center;gap:16px;display:flex}.bcd-root .logo{align-items:center;gap:10px;display:flex}.bcd-root .logo-icon{letter-spacing:-2px;background:var(--gradient-1);-webkit-text-fill-color:transparent;-webkit-background-clip:text;font-size:20px}.bcd-root .logo h1{background:var(--gradient-1);-webkit-text-fill-color:transparent;-webkit-background-clip:text;font-size:18px;font-weight:700}.bcd-root .header-subtitle{color:var(--text-muted);font-size:12px}.bcd-root .header-right{align-items:center;gap:12px;display:flex}.bcd-root .header-checkbox{color:var(--text-secondary);font-size:13px}.bcd-root .app-main{flex:1;gap:0;display:flex;overflow:hidden}.bcd-root .left-column{border-right:1px solid var(--border-color);background:#fff;flex-direction:column;gap:0;width:520px;min-width:420px;max-width:600px;display:flex;overflow-y:auto}.bcd-root .right-column{background:var(--bg-primary);flex-direction:column;flex:1;padding:16px;display:flex;overflow:hidden}.bcd-root .resizer{background:var(--bg-primary);border-left:1px solid var(--border-color);border-right:1px solid var(--border-color);cursor:col-resize;z-index:5;justify-content:center;align-items:center;width:6px;transition:background .2s;display:flex}.bcd-root .resizer:hover,.bcd-root .resizer:active{background:#43b97f14}.bcd-root .resizer-line{background:var(--border-color);border-radius:2px;width:2px;height:24px}.bcd-root .resizer:hover .resizer-line,.bcd-root .resizer:active .resizer-line{background:var(--accent)}.bcd-root .h-resizer{background:var(--bg-primary);border-top:1px solid var(--border-color);border-bottom:1px solid var(--border-color);cursor:row-resize;z-index:5;justify-content:center;align-items:center;height:6px;transition:background .2s;display:flex}.bcd-root .h-resizer:hover,.bcd-root .h-resizer:active{background:#43b97f14}.bcd-root .h-resizer-line{background:var(--border-color);border-radius:2px;width:24px;height:2px}.bcd-root .h-resizer:hover .h-resizer-line,.bcd-root .h-resizer:active .h-resizer-line{background:var(--accent)}.bcd-root ::-webkit-scrollbar{width:6px}.bcd-root ::-webkit-scrollbar-track{background:0 0}.bcd-root ::-webkit-scrollbar-thumb{background:#dddfe7;border-radius:3px}.bcd-root ::-webkit-scrollbar-thumb:hover{background:#b6b9c8}.bcd-root .panel{border-bottom:1px solid var(--border-color);transition:var(--transition)}.bcd-root .panel-header{border-bottom:1px solid var(--border-color);cursor:default;background:#f7f8f9;align-items:center;gap:8px;padding:10px 16px;display:flex}.bcd-root .panel-icon{font-size:16px}.bcd-root .panel-header h3{text-transform:uppercase;letter-spacing:.5px;color:var(--text-secondary);font-size:13px;font-weight:600}.bcd-root .panel-body{padding:12px 16px}.bcd-root .settings-grid{grid-template-columns:1fr 1fr;gap:8px;display:grid}.bcd-root .field-group{flex-direction:column;gap:3px;display:flex}.bcd-root .field-group label{color:var(--text-muted);text-transform:uppercase;letter-spacing:.3px;font-size:11px;font-weight:500}.bcd-root input[type=number],.bcd-root input[type=text]{background:var(--bg-input);border:1px solid var(--border-color);border-radius:var(--radius-sm);color:var(--text-primary);transition:var(--transition);outline:none;width:100%;padding:6px 10px;font-family:Inter,sans-serif;font-size:13px}.bcd-root select{appearance:none;background:var(--bg-input);border:1px solid var(--border-color);border-radius:var(--radius-sm);color:var(--text-primary);transition:var(--transition);cursor:pointer;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e91a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-position:right 8px center;background-repeat:no-repeat;background-size:16px 16px;outline:none;width:100%;padding:6px 30px 6px 10px;font-family:Inter,sans-serif;font-size:13px}.bcd-root input:focus,.bcd-root select:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow)}.bcd-root input[type=number]{text-align:right;font-variant-numeric:tabular-nums}.bcd-root .barcode-input-row{align-items:center;gap:8px;margin-top:10px;display:flex}.bcd-root .barcode-input-row label{color:var(--text-secondary);white-space:nowrap;font-size:12px}.bcd-root .barcode-input-row input{flex:1}.bcd-root .checkbox-label{cursor:pointer;align-items:center;gap:6px;font-size:13px;display:flex}.bcd-root input[type=checkbox]{appearance:none;border:1.5px solid var(--border-color);background:var(--bg-input);cursor:pointer;width:16px;height:16px;transition:var(--transition);border-radius:4px;position:relative}.bcd-root input[type=checkbox]:checked{background:var(--accent);border-color:var(--accent)}.bcd-root input[type=checkbox]:checked:after{content:"✓";color:#fff;font-size:11px;font-weight:700;position:absolute;top:-1px;left:2px}.bcd-root .bold-text{font-weight:700}.bcd-root .italic-text{font-style:italic}.bcd-root .btn{border-radius:var(--radius-sm);cursor:pointer;transition:var(--transition);white-space:nowrap;border:none;align-items:center;gap:4px;padding:7px 14px;font-family:Inter,sans-serif;font-size:12px;font-weight:500;display:inline-flex}.bcd-root .btn:disabled{opacity:.4;cursor:not-allowed}.bcd-root .btn-primary{background:var(--accent);color:#fff;box-shadow:0 2px 8px #43b97f40}.bcd-root .btn-primary:hover:not(:disabled){background:var(--accent-hover);transform:translateY(-1px)}.bcd-root .btn-secondary{color:var(--text-secondary);border:1px solid var(--border-color);background:#fff}.bcd-root .btn-secondary:hover:not(:disabled){color:var(--text-primary);background:#f7f8f9;border-color:#b6b9c8}.bcd-root .btn-danger{color:var(--danger);background:#fe484814;border:1px solid #fe484833}.bcd-root .btn-danger:hover:not(:disabled){background:#fe484824}.bcd-root .btn-accent{color:var(--accent);background:#43b97f14;border:1px solid #43b97f40}.bcd-root .btn-accent:hover:not(:disabled){background:#43b97f24}.bcd-root .btn-sm{padding:5px 10px;font-size:11px}.bcd-root .btn-icon{justify-content:center;width:32px;height:32px;padding:0}.bcd-root .spin{animation:.8s linear infinite bcd-spin}.bcd-root .btn-close{color:var(--text-muted);cursor:pointer;transition:var(--transition);background:0 0;border:none;padding:4px 8px;font-size:18px}.bcd-root .btn-close:hover{color:var(--text-primary)}.bcd-root .block-toolbar{border-bottom:1px solid var(--border-color);gap:8px;padding:10px 16px;display:flex}.bcd-root .block-grid-container{max-height:260px;overflow:auto}.bcd-root .block-grid{border-collapse:collapse;width:100%;font-size:12px}.bcd-root .block-grid th{text-align:left;color:var(--text-muted);text-transform:uppercase;letter-spacing:.3px;z-index:1;border-bottom:1px solid var(--border-color);background:#f7f8f9;padding:8px 10px;font-size:11px;font-weight:600;position:sticky;top:0}.bcd-root .block-grid td{transition:var(--transition);border-bottom:1px solid #eeeff3;padding:8px 10px}.bcd-root .block-grid tr{cursor:pointer;transition:var(--transition)}.bcd-root .block-grid tr:hover td{background:#43b97f0d}.bcd-root .block-grid tr.selected td{background:#43b97f1a;border-color:#43b97f33}.bcd-root .block-grid .mono{font-family:JetBrains Mono,Consolas,monospace;font-size:11px}.bcd-root .block-grid .small{color:var(--text-muted);text-overflow:ellipsis;max-width:200px;font-size:10px;overflow:hidden}.bcd-root .empty-row{text-align:center;color:var(--text-muted);font-style:italic;padding:24px!important}.bcd-root .preview-panel{flex-direction:column;flex:1;display:flex;overflow:hidden}.bcd-root .preview-panel .panel-header{border-bottom:1px solid var(--border-color)}.bcd-root .canvas-container{background:repeating-linear-gradient(0deg,#0000,#0000 19px,#282b350a 20px),repeating-linear-gradient(90deg,#0000,#0000 19px,#282b350a 20px);flex:1;position:relative;overflow:hidden}.bcd-root canvas{border:1px solid var(--border-color);border-radius:var(--radius-sm);box-shadow:var(--shadow-md)}.bcd-root .template-panel .panel-body{flex-direction:column;gap:12px;display:flex}.bcd-root .template-dashboard{flex-direction:column;gap:10px;display:flex}.bcd-root .template-toolbar{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.bcd-root .template-list-block{border:1px solid var(--border-color);background:#f7f8f9;border-radius:10px;flex-direction:column;gap:8px;padding:10px;display:flex}.bcd-root .template-block-header{justify-content:space-between;align-items:center;gap:8px;display:flex}.bcd-root .template-block-header h4{color:var(--text-primary);font-size:12px;font-weight:600}.bcd-root .template-count{color:#359264;background:#43b97f1a;border:1px solid #43b97f59;border-radius:999px;justify-content:center;align-items:center;min-width:20px;height:20px;padding:0 6px;font-size:11px;display:inline-flex}.bcd-root .template-block-actions{flex-wrap:wrap;align-items:center;gap:6px;display:flex}.bcd-root .template-row{align-items:center;gap:6px;margin-bottom:0;display:flex}.bcd-root .template-row-inline{gap:8px}.bcd-root .template-select{flex:1}.bcd-root .template-type-select{appearance:none;border:1px solid var(--border-color);color:var(--text-primary);cursor:pointer;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e91a0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 6px center/14px 14px no-repeat;border-radius:8px;min-width:90px;height:28px;padding:4px 26px 4px 10px;font-size:12px}.bcd-root .template-type-select:focus{border-color:var(--accent);outline:none;box-shadow:0 0 0 2px #43b97f26}.bcd-root .template-actions{border-top:1px solid var(--border-color);flex-wrap:wrap;gap:6px;margin-top:0;padding-top:6px;display:flex}.bcd-root .template-actions.secondary-actions{border-top:none;padding-top:0}.bcd-root .template-list{flex-direction:column;gap:6px;display:flex}.bcd-root .template-row-card{margin-bottom:0}.bcd-root .template-row-main{flex-direction:column;min-width:0;display:flex}.bcd-root .template-row-main h4{color:var(--text-primary);font-size:14px;font-weight:600}.bcd-root .template-row-main p{color:var(--text-muted);font-size:12px}.bcd-root .template-inline-meta{color:var(--text-muted);font-size:10px}.bcd-root .template-row-actions{flex-wrap:wrap;flex-shrink:0;gap:6px;display:flex}.bcd-root .template-empty-hint,.bcd-root .template-hint{color:var(--text-muted);font-size:12px}.bcd-root .template-notice{border-radius:8px;margin-top:4px;padding:8px 10px;font-size:12px}.bcd-root .template-notice.success{color:#1bb172;background:#43b97f14;border:1px solid #43b97f40}.bcd-root .template-notice.error{color:#d12b2b;background:#fe484814;border:1px solid #fe484833}.bcd-root .template-modal{max-width:520px}.bcd-root .template-modal-body{flex-direction:column;gap:10px;display:flex}.bcd-root .modal-overlay{z-index:1000;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background:#282b3566;justify-content:center;align-items:center;animation:.2s bcd-fadeIn;display:flex;position:fixed;inset:0}.bcd-root .modal{border:1px solid var(--border-color);background:#fff;border-radius:16px;flex-direction:column;width:90vw;max-width:620px;max-height:90vh;animation:.3s cubic-bezier(.16,1,.3,1) bcd-slideUp;display:flex;overflow:hidden;box-shadow:0 24px 48px #282b3529,0 0 0 1px #282b350a}.bcd-root .xml-preview-modal{max-width:800px}.bcd-root .modal-header{border-bottom:1px solid var(--border-color);background:#f7f8f9;justify-content:space-between;align-items:center;padding:16px 24px;display:flex}.bcd-root .modal-header h3{color:var(--text-primary);font-size:16px;font-weight:600}.bcd-root .modal-header-actions{align-items:center;gap:6px;display:flex}.bcd-root .modal-body{flex:1;padding:24px;overflow-y:auto}.bcd-root .modal-footer{border-top:1px solid var(--border-color);background:#f7f8f9;justify-content:flex-end;gap:12px;padding:16px 24px;display:flex}.bcd-root .template-card{border:1px solid var(--border-color);cursor:pointer;background:#fff;border-radius:8px;justify-content:space-between;align-items:center;margin-bottom:8px;padding:12px 16px;transition:all .2s;display:flex}.bcd-root .template-card:hover{background:#f7f8f9;border-color:#b6b9c8}.bcd-root .template-card.selected{border-color:var(--accent);background:#43b97f0f}.bcd-root .template-card-info h4{color:var(--text-primary);margin-bottom:4px;font-size:14px;font-weight:600}.bcd-root .template-card-info p{color:var(--text-muted);font-size:12px}.bcd-root .template-list .template-card{margin-bottom:0}.bcd-root .modal-section{margin-bottom:16px}.bcd-root .modal-section h4{color:var(--text-muted);text-transform:uppercase;letter-spacing:.5px;border-bottom:1px solid var(--border-color);margin-bottom:8px;padding-bottom:4px;font-size:12px;font-weight:600}.bcd-root .modal-grid{grid-template-columns:1fr 1fr 1fr;gap:8px;display:grid}.bcd-root .full-width{width:100%}.bcd-root .font-settings-panel{flex-direction:column;gap:8px;display:flex}.bcd-root .font-row{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.bcd-root .font-row label{color:var(--text-muted);white-space:nowrap;font-size:11px}.bcd-root .font-row .font-select{max-width:160px}.bcd-root .font-row .align-select{max-width:100px}.bcd-root .font-row .bcd-select-trigger{height:30px;font-size:12px}.bcd-root .template-type-select .bcd-select-trigger{height:28px;font-size:12px}.bcd-root .font-row input[type=number]{max-width:70px}.bcd-root .xml-body{padding:0!important}.bcd-root .code-preview{white-space:pre;color:var(--text-primary);tab-size:2;background:#f7f8f9;min-height:300px;max-height:60vh;margin:0;padding:16px 20px;font-family:JetBrains Mono,Consolas,monospace;font-size:12px;line-height:1.6;overflow:auto}.bcd-root .code-preview code{color:inherit}.bcd-root .code-editor{width:100%;min-height:300px;max-height:60vh;color:var(--text-primary);resize:vertical;tab-size:2;background:#f7f8f9;border:none;outline:none;padding:16px 20px;font-family:JetBrains Mono,Consolas,monospace;font-size:12px;line-height:1.6}.bcd-root .properties-panel{background:#fff;flex-direction:column;height:100%;display:flex}.bcd-root .properties-panel.empty{color:var(--text-muted);text-align:center;justify-content:center;align-items:center;padding:40px}.bcd-root .properties-panel.empty .panel-icon{opacity:.5;margin-bottom:16px;font-size:32px}.bcd-root .properties-header{border-bottom:1px solid var(--border-color);background:#f7f8f9;justify-content:space-between;align-items:center;padding:10px 16px;display:flex}.bcd-root .header-title{align-items:center;gap:8px;display:flex}.bcd-root .header-title h3{text-transform:uppercase;color:var(--text-secondary);font-size:13px;font-weight:600}.bcd-root .properties-body{flex:1;padding:16px;overflow-y:auto}.bcd-root .props-row{flex-wrap:wrap;gap:24px;display:flex}.bcd-root .props-section{flex:1;min-width:250px}.bcd-root .props-section h4{color:var(--text-muted);text-transform:uppercase;border-bottom:1px solid var(--border-color);margin-bottom:12px;padding-bottom:6px;font-size:12px;font-weight:600}.bcd-root .props-grid{grid-template-columns:repeat(3,1fr);gap:8px 12px;display:grid}.bcd-root .context-menu{border:1px solid var(--border-color);border-radius:var(--radius-sm);box-shadow:var(--shadow-lg);z-index:1000;background:#fff;min-width:160px;padding:4px 0;animation:.15s bcd-fadeIn;position:absolute}.bcd-root .context-menu-item{color:var(--text-primary);cursor:pointer;align-items:center;gap:8px;padding:8px 16px;font-size:13px;transition:background .1s;display:flex}.bcd-root .context-menu-item:hover{background:var(--accent);color:#fff}.bcd-root .bcd-select-wrapper{width:100%;position:relative}.bcd-root .bcd-select-trigger{border:1px solid var(--border-color);border-radius:var(--radius-sm);width:100%;height:36px;color:var(--text-primary);cursor:pointer;transition:var(--transition);text-align:left;background:#fff;outline:none;justify-content:space-between;align-items:center;gap:8px;padding:0 10px 0 12px;font-family:Inter,sans-serif;font-size:13px;display:flex}.bcd-root .bcd-select-trigger:hover{border-color:#b6b9c8}.bcd-root .bcd-select-trigger.bcd-select-open{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow);border-width:2px}.bcd-root .bcd-select-trigger.bcd-select-placeholder .bcd-select-label{color:var(--text-muted)}.bcd-root .bcd-select-label{text-overflow:ellipsis;white-space:nowrap;flex:1;font-weight:500;overflow:hidden}.bcd-root .bcd-select-chevron{color:var(--text-muted);flex-shrink:0;align-items:center;display:flex}.bcd-root .bcd-select-menu{border:1px solid var(--border-color);border-radius:var(--radius-sm);background:#fff;max-height:240px;padding:4px;animation:.12s bcd-fadeIn;overflow-y:auto;box-shadow:0 12px 20px -4px #10182814,0 4px 8px -2px #1018280a}.bcd-root .bcd-select-item{color:var(--text-primary);cursor:pointer;border-radius:6px;align-items:center;gap:8px;padding:7px 10px;font-family:Inter,sans-serif;font-size:13px;font-weight:500;transition:background .1s;display:flex}.bcd-root .bcd-select-item:hover{background:#f7f8f9}.bcd-root .bcd-select-item.bcd-select-item-active{color:var(--accent);background:#43b97f0f}.bcd-root .bcd-select-check{color:var(--accent);flex-shrink:0}@keyframes bcd-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes bcd-fadeIn{0%{opacity:0}to{opacity:1}}@keyframes bcd-slideUp{0%{opacity:0;transform:translateY(20px)scale(.98)}to{opacity:1;transform:translateY(0)scale(1)}}.bcd-root .template-left-header{border-bottom:1px solid var(--border-color);flex-direction:column;gap:8px;padding:16px;display:flex}.bcd-root .template-left-title-row{justify-content:space-between;align-items:center;display:flex}.bcd-root .template-left-title-row h2{color:var(--text-primary);font-size:13px;font-weight:600}.bcd-root .btn-full{justify-content:center;width:100%}.bcd-root .canvas-toolbar{border-bottom:1px solid var(--border-color);background:#fff;flex-shrink:0;justify-content:space-between;align-items:center;gap:12px;height:48px;padding:0 16px;display:flex}.bcd-root .canvas-breadcrumb{color:var(--text-muted);align-items:center;gap:6px;font-size:13px;display:flex}.bcd-root .canvas-breadcrumb strong{color:var(--text-primary);font-weight:600}.bcd-root .canvas-toolbar-right{align-items:center;gap:12px;display:flex}.bcd-root .zoom-controls{background:#f1f3f5;border-radius:8px;align-items:center;gap:2px;padding:2px;display:flex}.bcd-root .zoom-controls button{cursor:pointer;color:var(--text-secondary);transition:var(--transition);background:0 0;border:none;border-radius:6px;align-items:center;padding:5px 6px;display:flex}.bcd-root .zoom-controls button:hover{color:var(--text-primary);background:#fff}.bcd-root .zoom-pct{color:var(--text-secondary);text-align:center;width:36px;font-size:12px;font-weight:500}.bcd-root .template-row-actions.hover-hidden{opacity:0;pointer-events:none;transition:opacity .15s}.bcd-root .template-card:hover .template-row-actions.hover-hidden{opacity:1;pointer-events:auto}.bcd-root .template-type-pill{appearance:none;color:var(--accent);cursor:pointer;background:#43b97f14 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2343b97f' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 6px center/11px 11px no-repeat;border:1px solid #43b97f4d;border-radius:999px;outline:none;height:22px;padding:2px 22px 2px 9px;font-family:Inter,sans-serif;font-size:11px;font-weight:500}.bcd-root .template-type-pill:focus{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-glow)}.bcd-root .delete-modal{max-width:400px;position:relative}.bcd-root .delete-modal-body{text-align:center;flex-direction:column;align-items:center;gap:24px;padding:32px 24px 24px;display:flex}.bcd-root .delete-modal-text{flex-direction:column;align-items:center;gap:8px;display:flex}.bcd-root .delete-modal-title{color:var(--text-primary);font-size:18px;font-weight:700;line-height:1.3}.bcd-root .delete-modal-subtitle{color:var(--text-secondary);font-size:13px}.bcd-root .delete-modal-footer{border-top:none;gap:12px;padding:0 24px 28px;display:flex}.bcd-root .delete-modal-btn{border-radius:8px;flex:1;justify-content:center;height:48px;font-size:14px;font-weight:600}.bcd-root .orientation-options{flex-flow:wrap;gap:4px 16px;margin-top:2px;display:flex}.bcd-root .radio-option{cursor:pointer;color:var(--text-primary);align-items:center;gap:6px;font-size:12px;display:flex}.bcd-root .radio-option input[type=radio]{accent-color:var(--accent);cursor:pointer}@media (width<=900px){.bcd-root .app-main{flex-direction:column}.bcd-root .left-column{border-right:none;border-bottom:1px solid var(--border-color);width:100%;min-width:auto;max-width:100%;max-height:50vh}.bcd-root .right-column{flex:1;min-height:200px}.bcd-root .settings-grid,.bcd-root .modal-grid{grid-template-columns:1fr 1fr}.bcd-root .resizer{display:none}}.bcd-root .bcd-toast{z-index:9999;pointer-events:none;white-space:nowrap;border-radius:8px;padding:10px 24px;font-size:14px;font-weight:500;animation:.2s bcd-toast-in;position:fixed;bottom:24px;left:50%;transform:translate(-50%);box-shadow:0 4px 12px #00000026}.bcd-root .bcd-toast--success{color:#fff;background:#22c55e}.bcd-root .bcd-toast--error{color:#fff;background:#ef4444}@keyframes bcd-toast-in{0%{opacity:0;transform:translate(-50%)translateY(8px)}to{opacity:1;transform:translate(-50%)translateY(0)}}
|
|
2
|
+
/*$vite$:1*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { AxiosInstance } from 'axios';
|
|
3
|
+
export interface BarcodeDesignerProps {
|
|
4
|
+
apiBaseUrl?: string;
|
|
5
|
+
printApiBaseUrl?: string;
|
|
6
|
+
axiosInstance?: AxiosInstance;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
declare const BarcodeDesigner: React.FC<BarcodeDesignerProps>;
|
|
11
|
+
export default BarcodeDesigner;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SelectOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
interface CustomSelectProps {
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (value: string) => void;
|
|
9
|
+
options: SelectOption[];
|
|
10
|
+
className?: string;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const CustomSelect: React.FC<CustomSelectProps>;
|
|
15
|
+
export default CustomSelect;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { FontSetting } from '../models/FontSetting';
|
|
3
|
+
interface Props {
|
|
4
|
+
value: FontSetting;
|
|
5
|
+
onChange: (fs: FontSetting) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const FontSettingsPanel: React.FC<Props>;
|
|
8
|
+
export default FontSettingsPanel;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createTemplateService } from '../services/templateService';
|
|
2
|
+
type TemplateService = ReturnType<typeof createTemplateService>;
|
|
3
|
+
export declare const TemplateServiceContext: import('react').Context<{
|
|
4
|
+
getPrinters: (searchText?: string) => Promise<import('..').PrinterInfo[]>;
|
|
5
|
+
createPrinter: (printer: {
|
|
6
|
+
code: string;
|
|
7
|
+
name: string;
|
|
8
|
+
}) => Promise<string | undefined>;
|
|
9
|
+
updatePrinter: (id: string, printer: {
|
|
10
|
+
code: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}) => Promise<string | undefined>;
|
|
13
|
+
deletePrinter: (id: string) => Promise<string | undefined>;
|
|
14
|
+
getTemplates: (params?: import('..').TemplateQueryParams) => Promise<import('..').BarcodeAgentTemplate[]>;
|
|
15
|
+
createTemplate: (request: import('..').UpsertBarcodeAgentTemplateRequest) => Promise<string | undefined>;
|
|
16
|
+
updateTemplate: (id: string, request: import('..').UpsertBarcodeAgentTemplateRequest) => Promise<string | undefined>;
|
|
17
|
+
deleteTemplate: (id: string) => Promise<string | undefined>;
|
|
18
|
+
} | null>;
|
|
19
|
+
export declare function useTemplateService(): TemplateService;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as BarcodeDesigner } from './BarcodeDesigner';
|
|
2
|
+
export type { BarcodeDesignerProps } from './BarcodeDesigner';
|
|
3
|
+
export type { BarcodeMultiZoneSetting } from './models/BarcodeMultiZoneSetting';
|
|
4
|
+
export type { BarcodeBlockSetting } from './models/BarcodeBlockSetting';
|
|
5
|
+
export type { FontSetting } from './models/FontSetting';
|
|
6
|
+
export { BarcodeBlockDataEnum } from './models/BarcodeBlockDataEnum';
|
|
7
|
+
export type { PrinterInfo, BarcodeAgentTemplate, TemplateQueryParams, UpsertBarcodeAgentTemplateRequest, } from './services/templateService';
|
|
8
|
+
export { PrintTemplateType } from './services/templateService';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare enum BarcodeBlockDataEnum {
|
|
2
|
+
Seq = "Seq",
|
|
3
|
+
SID = "SID",
|
|
4
|
+
PID = "PID",
|
|
5
|
+
PatientName = "PatientName",
|
|
6
|
+
OrderID = "OrderID",
|
|
7
|
+
Invoice = "Invoice",
|
|
8
|
+
DateOfBirth = "DateOfBirth",
|
|
9
|
+
NamSinh = "NamSinh",
|
|
10
|
+
Tuoi = "Tuoi",
|
|
11
|
+
Sex = "Sex",
|
|
12
|
+
SexDisplay = "SexDisplay",
|
|
13
|
+
Address = "Address",
|
|
14
|
+
ChanDoan = "ChanDoan",
|
|
15
|
+
LocationID = "LocationID",
|
|
16
|
+
LocationName = "LocationName",
|
|
17
|
+
ObjectID = "ObjectID",
|
|
18
|
+
ObjectName = "ObjectName",
|
|
19
|
+
DoctorID = "DoctorID",
|
|
20
|
+
DoctorName = "DoctorName",
|
|
21
|
+
GroupCategoryID = "GroupCategoryID",
|
|
22
|
+
DateIn = "DateIn",
|
|
23
|
+
InTime = "InTime",
|
|
24
|
+
Urgent = "Urgent",
|
|
25
|
+
PrintTime = "PrintTime",
|
|
26
|
+
TypeID = "TypeID",
|
|
27
|
+
TypeName = "TypeName",
|
|
28
|
+
TypeSampleSEQ = "TypeSampleSEQ",
|
|
29
|
+
STT = "STT",
|
|
30
|
+
Notice = "Notice",
|
|
31
|
+
UuTien = "UuTien",
|
|
32
|
+
DepartmentReception = "DepartmentReception",
|
|
33
|
+
SourceLocationID = "SourceLocationID",
|
|
34
|
+
SourceLocationName = "SourceLocationName"
|
|
35
|
+
}
|
|
36
|
+
export declare const BarcodeBlockDataDescriptions: Record<BarcodeBlockDataEnum, string>;
|
|
37
|
+
export declare function getEnumDisplayList(): {
|
|
38
|
+
id: BarcodeBlockDataEnum;
|
|
39
|
+
name: string;
|
|
40
|
+
}[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FontSetting } from './FontSetting';
|
|
2
|
+
import { BarcodeBlockDataEnum } from './BarcodeBlockDataEnum';
|
|
3
|
+
export interface BarcodeBlockSetting {
|
|
4
|
+
OffsetX: number;
|
|
5
|
+
OffsetY: number;
|
|
6
|
+
Width: number;
|
|
7
|
+
Height: number;
|
|
8
|
+
Angle: number;
|
|
9
|
+
Data: BarcodeBlockDataEnum | null;
|
|
10
|
+
ShowBorder: boolean;
|
|
11
|
+
FontSetting: FontSetting;
|
|
12
|
+
}
|
|
13
|
+
export declare function createDefaultBlockSetting(): BarcodeBlockSetting;
|
|
14
|
+
export declare function cloneBlockSetting(setting: BarcodeBlockSetting): BarcodeBlockSetting;
|
|
15
|
+
export declare function blockSettingToDisplayString(setting: BarcodeBlockSetting): string;
|
|
16
|
+
export declare function normalizeBlockSetting(input?: Partial<BarcodeBlockSetting> | null): BarcodeBlockSetting;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BarcodeBlockSetting } from './BarcodeBlockSetting';
|
|
2
|
+
export declare enum PageOrientation {
|
|
3
|
+
Normal = 0,
|
|
4
|
+
Rotate90 = 1,
|
|
5
|
+
Rotate180 = 2,
|
|
6
|
+
Rotate270 = 3
|
|
7
|
+
}
|
|
8
|
+
export interface BarcodeMultiZoneSetting {
|
|
9
|
+
PaperSizeW: number;
|
|
10
|
+
PaperSizeH: number;
|
|
11
|
+
DPI: number;
|
|
12
|
+
StampsPerPage: number;
|
|
13
|
+
MarginLeft: number;
|
|
14
|
+
MarginRight: number;
|
|
15
|
+
MarginTop: number;
|
|
16
|
+
MarginBottom: number;
|
|
17
|
+
BarCodeWidth: number;
|
|
18
|
+
BarCodeHeight: number;
|
|
19
|
+
BarcodeOffsetLeft: number;
|
|
20
|
+
BarcodeOffsetTop: number;
|
|
21
|
+
BarcodePrinterName: string;
|
|
22
|
+
SamplpeBarcode: string;
|
|
23
|
+
BarcodeBlockSettings: BarcodeBlockSetting[];
|
|
24
|
+
Orientation: PageOrientation;
|
|
25
|
+
}
|
|
26
|
+
export declare function createDefaultSettings(): BarcodeMultiZoneSetting;
|
|
27
|
+
export declare function normalizeSettings(input?: Partial<BarcodeMultiZoneSetting> | null): BarcodeMultiZoneSetting;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type StringAlignment = 'Near' | 'Center' | 'Far';
|
|
2
|
+
export interface FontSetting {
|
|
3
|
+
FontFamily: string;
|
|
4
|
+
FontSize: number;
|
|
5
|
+
LeftIndent: number;
|
|
6
|
+
RightIndent: number;
|
|
7
|
+
IsBold: boolean;
|
|
8
|
+
IsItalic: boolean;
|
|
9
|
+
Align: StringAlignment;
|
|
10
|
+
SampleText: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function createDefaultFontSetting(): FontSetting;
|
|
13
|
+
export declare function cloneFontSetting(setting: FontSetting): FontSetting;
|
|
14
|
+
export declare function fontSettingToString(setting: FontSetting): string;
|
|
15
|
+
/** Convert StringAlignment to CSS text-align */
|
|
16
|
+
export declare function alignToCanvasAlign(align: StringAlignment): CanvasTextAlign;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BarcodeMultiZoneSetting } from './BarcodeMultiZoneSetting';
|
|
2
|
+
export interface BarcodeBlockTemplateSettingDetail {
|
|
3
|
+
TemplateName: string;
|
|
4
|
+
TemplatePath: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BarcodeBlockTemplateSetting {
|
|
7
|
+
ListDetail: BarcodeBlockTemplateSettingDetail[];
|
|
8
|
+
}
|
|
9
|
+
/** Template stored in browser with full settings (instead of file paths) */
|
|
10
|
+
export interface StoredTemplate {
|
|
11
|
+
name: string;
|
|
12
|
+
settings: BarcodeMultiZoneSetting;
|
|
13
|
+
createdAt: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function createDefaultTemplateSetting(): BarcodeBlockTemplateSetting;
|
|
17
|
+
export declare function loadTemplatesFromStorage(): StoredTemplate[];
|
|
18
|
+
export declare function saveTemplatesToStorage(templates: StoredTemplate[]): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BarcodeMultiZoneSetting } from '../models/BarcodeMultiZoneSetting';
|
|
2
|
+
export declare function convertFromMmToPixelDot(valueMm: number, ratio: number): number;
|
|
3
|
+
export declare function draw(ctx: CanvasRenderingContext2D, s: BarcodeMultiZoneSetting, ratio: number, barcode: string, blockDisp: string[], showRect: boolean, selectedBlockIndex?: number): void;
|
|
4
|
+
export declare function renderPreview(canvas: HTMLCanvasElement, settings: BarcodeMultiZoneSetting, blockDisplayStrings: string[], showBorder: boolean, selectedBlockIndex?: number, zoom?: number): void;
|