tevrocsdk 0.1.46 → 0.1.47
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/package.json +1 -1
- package/tevroc-sdk.cjs.js +20 -3
- package/tevroc-sdk.cjs.js.map +2 -2
- package/tevroc-sdk.esm.js +11 -4
- package/tevroc-sdk.esm.js.map +2 -2
- package/tevroc-sdk.min.js +1 -1
- package/tevroc-sdk.umd.js +11 -4
package/tevroc-sdk.min.js
CHANGED
|
@@ -85,7 +85,7 @@ endbfchar
|
|
|
85
85
|
CMapName currentdict /CMap defineresource pop
|
|
86
86
|
end
|
|
87
87
|
end`};e.events.push(["putFont",function(i){(function(s){var a=s.font,o=s.out,c=s.newObject,g=s.putStream;if(a.metadata instanceof t.API.TTFFont&&a.encoding==="Identity-H"){for(var m=a.metadata.Unicode.widths,B=a.metadata.subset.encode(a.metadata.glyIdsUsed,1),w="",F=0;F<B.length;F++)w+=String.fromCharCode(B[F]);var U=c();g({data:w,addLength1:!0,objectId:U}),o("endobj");var _=c();g({data:r(a.metadata.toUnicode),addLength1:!0,objectId:_}),o("endobj");var E=c();o("<<"),o("/Type /FontDescriptor"),o("/FontName /"+Nu(a.fontName)),o("/FontFile2 "+U+" 0 R"),o("/FontBBox "+t.API.PDFObject.convert(a.metadata.bbox)),o("/Flags "+a.metadata.flags),o("/StemV "+a.metadata.stemV),o("/ItalicAngle "+a.metadata.italicAngle),o("/Ascent "+a.metadata.ascender),o("/Descent "+a.metadata.decender),o("/CapHeight "+a.metadata.capHeight),o(">>"),o("endobj");var q=c();o("<<"),o("/Type /Font"),o("/BaseFont /"+Nu(a.fontName)),o("/FontDescriptor "+E+" 0 R"),o("/W "+t.API.PDFObject.convert(m)),o("/CIDToGIDMap /Identity"),o("/DW 1000"),o("/Subtype /CIDFontType2"),o("/CIDSystemInfo"),o("<<"),o("/Supplement 0"),o("/Registry (Adobe)"),o("/Ordering ("+a.encoding+")"),o(">>"),o(">>"),o("endobj"),a.objectNumber=c(),o("<<"),o("/Type /Font"),o("/Subtype /Type0"),o("/ToUnicode "+_+" 0 R"),o("/BaseFont /"+Nu(a.fontName)),o("/Encoding /"+a.encoding),o("/DescendantFonts ["+q+" 0 R]"),o(">>"),o("endobj"),a.isAlreadyPutted=!0}})(i)}]),e.events.push(["putFont",function(i){(function(s){var a=s.font,o=s.out,c=s.newObject,g=s.putStream;if(a.metadata instanceof t.API.TTFFont&&a.encoding==="WinAnsiEncoding"){for(var m=a.metadata.rawData,B="",w=0;w<m.length;w++)B+=String.fromCharCode(m[w]);var F=c();g({data:B,addLength1:!0,objectId:F}),o("endobj");var U=c();g({data:r(a.metadata.toUnicode),addLength1:!0,objectId:U}),o("endobj");var _=c();o("<<"),o("/Descent "+a.metadata.decender),o("/CapHeight "+a.metadata.capHeight),o("/StemV "+a.metadata.stemV),o("/Type /FontDescriptor"),o("/FontFile2 "+F+" 0 R"),o("/Flags 96"),o("/FontBBox "+t.API.PDFObject.convert(a.metadata.bbox)),o("/FontName /"+Nu(a.fontName)),o("/ItalicAngle "+a.metadata.italicAngle),o("/Ascent "+a.metadata.ascender),o(">>"),o("endobj"),a.objectNumber=c();for(var E=0;E<a.metadata.hmtx.widths.length;E++)a.metadata.hmtx.widths[E]=parseInt(a.metadata.hmtx.widths[E]*(1e3/a.metadata.head.unitsPerEm));o("<</Subtype/TrueType/Type/Font/ToUnicode "+U+" 0 R/BaseFont/"+Nu(a.fontName)+"/FontDescriptor "+_+" 0 R/Encoding/"+a.encoding+" /FirstChar 29 /LastChar 255 /Widths "+t.API.PDFObject.convert(a.metadata.hmtx.widths)+">>"),o("endobj"),a.isAlreadyPutted=!0}})(i)}]);var n=function(i){var s,a=i.text||"",o=i.x,c=i.y,g=i.options||{},m=i.mutex||{},B=m.pdfEscape,w=m.activeFontKey,F=m.fonts,U=w,_="",E=0,q="",R=F[U].encoding;if(F[U].encoding!=="Identity-H")return{text:a,x:o,y:c,options:g,mutex:m};for(q=a,U=w,Array.isArray(a)&&(q=a[0]),E=0;E<q.length;E+=1)F[U].metadata.hasOwnProperty("cmap")&&(s=F[U].metadata.cmap.unicode.codeMap[q[E].charCodeAt(0)]),s||q[E].charCodeAt(0)<256&&F[U].metadata.hasOwnProperty("Unicode")?_+=q[E]:_+="";var P="";return parseInt(U.slice(1))<14||R==="WinAnsiEncoding"?P=B(_,U).split("").map(function(re){return re.charCodeAt(0).toString(16)}).join(""):R==="Identity-H"&&(P=A(_,F[U])),m.isHex=!0,{text:P,x:o,y:c,options:g,mutex:m}};e.events.push(["postProcessText",function(i){var s=i.text||"",a=[],o={text:s,x:i.x,y:i.y,options:i.options,mutex:i.mutex};if(Array.isArray(s)){var c=0;for(c=0;c<s.length;c+=1)Array.isArray(s[c])&&s[c].length===3?a.push([n(Object.assign({},o,{text:s[c][0]})).text,s[c][1],s[c][2]]):a.push(n(Object.assign({},o,{text:s[c]})).text);i.text=a}else i.text=n(Object.assign({},o,{text:s})).text}])})(Ct),(function(t){var e=function(){return this.internal.vFS===void 0&&(this.internal.vFS={}),!0};t.existsFileInVFS=function(A){return e.call(this),this.internal.vFS[A]!==void 0},t.addFileToVFS=function(A,r){return e.call(this),this.internal.vFS[A]=r,this},t.getFileFromVFS=function(A){return e.call(this),this.internal.vFS[A]!==void 0?this.internal.vFS[A]:null}})(Ct.API),(function(t){t.__bidiEngine__=t.prototype.__bidiEngine__=function(r){var n,i,s,a,o,c,g,m=e,B=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],w=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],F={L:0,R:1,EN:2,AN:3,N:4,B:5,S:6},U={0:0,5:1,6:2,7:3,32:4,251:5,254:6,255:7},_=["(",")","(","<",">","<","[","]","[","{","}","{","\xAB","\xBB","\xAB","\u2039","\u203A","\u2039","\u2045","\u2046","\u2045","\u207D","\u207E","\u207D","\u208D","\u208E","\u208D","\u2264","\u2265","\u2264","\u2329","\u232A","\u2329","\uFE59","\uFE5A","\uFE59","\uFE5B","\uFE5C","\uFE5B","\uFE5D","\uFE5E","\uFE5D","\uFE64","\uFE65","\uFE64"],E=new RegExp(/^([1-4|9]|1[0-9]|2[0-9]|3[0168]|4[04589]|5[012]|7[78]|159|16[0-9]|17[0-2]|21[569]|22[03489]|250)$/),q=!1,R=0;this.__bidiEngine__={};var P=function(O){var H=O.charCodeAt(),J=H>>8,Z=U[J];return Z!==void 0?m[256*Z+(255&H)]:J===252||J===253?"AL":E.test(J)?"L":J===8?"R":"N"},re=function(O){for(var H,J=0;J<O.length;J++){if((H=P(O.charAt(J)))==="L")return!1;if(H==="R")return!0}return!1},fe=function(O,H,J,Z){var ge,Ce,Ee,de,be=H[Z];switch(be){case"L":case"R":case"LRE":case"RLE":case"LRO":case"RLO":case"PDF":q=!1;break;case"N":case"AN":break;case"EN":q&&(be="AN");break;case"AL":q=!0,be="R";break;case"WS":case"BN":be="N";break;case"CS":Z<1||Z+1>=H.length||(ge=J[Z-1])!=="EN"&&ge!=="AN"||(Ce=H[Z+1])!=="EN"&&Ce!=="AN"?be="N":q&&(Ce="AN"),be=Ce===ge?Ce:"N";break;case"ES":be=(ge=Z>0?J[Z-1]:"B")==="EN"&&Z+1<H.length&&H[Z+1]==="EN"?"EN":"N";break;case"ET":if(Z>0&&J[Z-1]==="EN"){be="EN";break}if(q){be="N";break}for(Ee=Z+1,de=H.length;Ee<de&&H[Ee]==="ET";)Ee++;be=Ee<de&&H[Ee]==="EN"?"EN":"N";break;case"NSM":if(s&&!a){for(de=H.length,Ee=Z+1;Ee<de&&H[Ee]==="NSM";)Ee++;if(Ee<de){var Pe=O[Z],Fe=Pe>=1425&&Pe<=2303||Pe===64286;if(ge=H[Ee],Fe&&(ge==="R"||ge==="AL")){be="R";break}}}be=Z<1||(ge=H[Z-1])==="B"?"N":J[Z-1];break;case"B":q=!1,n=!0,be=R;break;case"S":i=!0,be="N"}return be},ne=function(O,H,J){var Z=O.split("");return J&&ee(Z,J,{hiLevel:R}),Z.reverse(),H&&H.reverse(),Z.join("")},ee=function(O,H,J){var Z,ge,Ce,Ee,de,be=-1,Pe=O.length,Fe=0,T=[],$=R?w:B,Y=[];for(q=!1,n=!1,i=!1,ge=0;ge<Pe;ge++)Y[ge]=P(O[ge]);for(Ce=0;Ce<Pe;Ce++){if(de=Fe,T[Ce]=fe(O,Y,T,Ce),Z=240&(Fe=$[de][F[T[Ce]]]),Fe&=15,H[Ce]=Ee=$[Fe][5],Z>0)if(Z===16){for(ge=be;ge<Ce;ge++)H[ge]=1;be=-1}else be=-1;if($[Fe][6])be===-1&&(be=Ce);else if(be>-1){for(ge=be;ge<Ce;ge++)H[ge]=Ee;be=-1}Y[Ce]==="B"&&(H[Ce]=0),J.hiLevel|=Ee}i&&(function(Ae,oe,we){for(var Ue=0;Ue<we;Ue++)if(Ae[Ue]==="S"){oe[Ue]=R;for(var _e=Ue-1;_e>=0&&Ae[_e]==="WS";_e--)oe[_e]=R}})(Y,H,Pe)},V=function(O,H,J,Z,ge){if(!(ge.hiLevel<O)){if(O===1&&R===1&&!n)return H.reverse(),void(J&&J.reverse());for(var Ce,Ee,de,be,Pe=H.length,Fe=0;Fe<Pe;){if(Z[Fe]>=O){for(de=Fe+1;de<Pe&&Z[de]>=O;)de++;for(be=Fe,Ee=de-1;be<Ee;be++,Ee--)Ce=H[be],H[be]=H[Ee],H[Ee]=Ce,J&&(Ce=J[be],J[be]=J[Ee],J[Ee]=Ce);Fe=de}Fe++}}},ie=function(O,H,J){var Z=O.split(""),ge={hiLevel:R};return J||(J=[]),ee(Z,J,ge),(function(Ce,Ee,de){if(de.hiLevel!==0&&g)for(var be,Pe=0;Pe<Ce.length;Pe++)Ee[Pe]===1&&(be=_.indexOf(Ce[Pe]))>=0&&(Ce[Pe]=_[be+1])})(Z,J,ge),V(2,Z,H,J,ge),V(1,Z,H,J,ge),Z.join("")};return this.__bidiEngine__.doBidiReorder=function(O,H,J){if((function(ge,Ce){if(Ce)for(var Ee=0;Ee<ge.length;Ee++)Ce[Ee]=Ee;a===void 0&&(a=re(ge)),c===void 0&&(c=re(ge))})(O,H),s||!o||c)if(s&&o&&a^c)R=a?1:0,O=ne(O,H,J);else if(!s&&o&&c)R=a?1:0,O=ie(O,H,J),O=ne(O,H);else if(!s||a||o||c){if(s&&!o&&a^c)O=ne(O,H),a?(R=0,O=ie(O,H,J)):(R=1,O=ie(O,H,J),O=ne(O,H));else if(s&&a&&!o&&c)R=1,O=ie(O,H,J),O=ne(O,H);else if(!s&&!o&&a^c){var Z=g;a?(R=1,O=ie(O,H,J),R=0,g=!1,O=ie(O,H,J),g=Z):(R=0,O=ie(O,H,J),O=ne(O,H),R=1,g=!1,O=ie(O,H,J),g=Z,O=ne(O,H))}}else R=0,O=ie(O,H,J);else R=a?1:0,O=ie(O,H,J);return O},this.__bidiEngine__.setOptions=function(O){O&&(s=O.isInputVisual,o=O.isOutputVisual,a=O.isInputRtl,c=O.isOutputRtl,g=O.isSymmetricSwapping)},this.__bidiEngine__.setOptions(r),this.__bidiEngine__};var e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","N","ET","ET","ET","ET","N","N","N","N","L","N","N","BN","N","N","ET","ET","EN","EN","N","L","N","N","N","EN","L","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","L","L","L","L","L","L","L","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","L","N","N","N","N","N","ET","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","NSM","R","NSM","NSM","R","NSM","NSM","R","NSM","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","N","N","N","N","N","R","R","R","R","R","N","N","N","N","N","N","N","N","N","N","N","AN","AN","AN","AN","AN","AN","N","N","AL","ET","ET","AL","CS","AL","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","AN","AN","AN","AN","AN","AN","AN","AN","AN","ET","AN","AN","AL","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AN","N","NSM","NSM","NSM","NSM","NSM","NSM","AL","AL","NSM","NSM","N","NSM","NSM","NSM","NSM","AL","AL","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","AL","AL","NSM","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","R","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","R","R","N","N","N","N","R","N","N","N","N","N","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","WS","BN","BN","BN","L","R","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","B","LRE","RLE","PDF","LRO","RLO","CS","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","WS","BN","BN","BN","BN","BN","N","LRI","RLI","FSI","PDI","BN","BN","BN","BN","BN","BN","EN","L","N","N","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","L","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","ES","ES","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","N","N","N","N","N","R","NSM","R","R","R","R","R","R","R","R","R","R","ES","R","R","R","R","R","R","R","R","R","R","R","R","R","N","R","R","R","R","R","N","R","N","R","R","N","R","R","N","R","R","R","R","R","R","R","R","R","R","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","NSM","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","CS","N","CS","N","N","CS","N","N","N","N","N","N","N","N","N","ET","N","N","ES","ES","N","N","N","N","N","ET","ET","N","N","N","N","N","AL","AL","AL","AL","AL","N","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","AL","N","N","BN","N","N","N","ET","ET","ET","N","N","N","N","N","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","N","N","N","N","N","N","N","N","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","N","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","L","L","L","N","N","L","L","L","N","N","N","ET","ET","N","N","N","ET","ET","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N","N"],A=new t.__bidiEngine__({isInputVisual:!0});t.API.events.push(["postProcessText",function(r){var n=r.text;r.x,r.y;var i=r.options||{};r.mutex,i.lang;var s=[];if(i.isInputVisual=typeof i.isInputVisual!="boolean"||i.isInputVisual,A.setOptions(i),Object.prototype.toString.call(n)==="[object Array]"){var a=0;for(s=[],a=0;a<n.length;a+=1)Object.prototype.toString.call(n[a])==="[object Array]"?s.push([A.doBidiReorder(n[a][0]),n[a][1],n[a][2]]):s.push([A.doBidiReorder(n[a])]);r.text=s}else r.text=A.doBidiReorder(n);A.setOptions({isInputVisual:!0})}])})(Ct),Ct.API.TTFFont=(function(){function t(e){var A;if(this.rawData=e,A=this.contents=new go(e),this.contents.pos=4,A.readString(4)==="ttcf")throw new Error("TTCF not supported.");A.pos=0,this.parse(),this.subset=new Zq(this),this.registerTTF()}return t.open=function(e){return new t(e)},t.prototype.parse=function(){return this.directory=new Hq(this.contents),this.head=new Mq(this),this.name=new Gq(this),this.cmap=new k_(this),this.toUnicode={},this.hhea=new qq(this),this.maxp=new zq(this),this.hmtx=new Wq(this),this.post=new jq(this),this.os2=new Kq(this),this.loca=new Jq(this),this.glyf=new Xq(this),this.ascender=this.os2.exists&&this.os2.ascender||this.hhea.ascender,this.decender=this.os2.exists&&this.os2.decender||this.hhea.decender,this.lineGap=this.os2.exists&&this.os2.lineGap||this.hhea.lineGap,this.bbox=[this.head.xMin,this.head.yMin,this.head.xMax,this.head.yMax]},t.prototype.registerTTF=function(){var e,A,r,n,i;if(this.scaleFactor=1e3/this.head.unitsPerEm,this.bbox=function(){var s,a,o,c;for(c=[],s=0,a=(o=this.bbox).length;s<a;s++)e=o[s],c.push(Math.round(e*this.scaleFactor));return c}.call(this),this.stemV=0,this.post.exists?(r=255&(n=this.post.italic_angle),32768&(A=n>>16)&&(A=-(1+(65535^A))),this.italicAngle=+(A+"."+r)):this.italicAngle=0,this.ascender=Math.round(this.ascender*this.scaleFactor),this.decender=Math.round(this.decender*this.scaleFactor),this.lineGap=Math.round(this.lineGap*this.scaleFactor),this.capHeight=this.os2.exists&&this.os2.capHeight||this.ascender,this.xHeight=this.os2.exists&&this.os2.xHeight||0,this.familyClass=(this.os2.exists&&this.os2.familyClass||0)>>8,this.isSerif=(i=this.familyClass)===1||i===2||i===3||i===4||i===5||i===7,this.isScript=this.familyClass===10,this.flags=0,this.post.isFixedPitch&&(this.flags|=1),this.isSerif&&(this.flags|=2),this.isScript&&(this.flags|=8),this.italicAngle!==0&&(this.flags|=64),this.flags|=32,!this.cmap.unicode)throw new Error("No unicode cmap for font")},t.prototype.characterToGlyph=function(e){var A;return((A=this.cmap.unicode)!=null?A.codeMap[e]:void 0)||0},t.prototype.widthOfGlyph=function(e){var A;return A=1e3/this.head.unitsPerEm,this.hmtx.forGlyph(e).advance*A},t.prototype.widthOfString=function(e,A,r){var n,i,s,a;for(s=0,i=0,a=(e=""+e).length;0<=a?i<a:i>a;i=0<=a?++i:--i)n=e.charCodeAt(i),s+=this.widthOfGlyph(this.characterToGlyph(n))+r*(1e3/A)||0;return s*(A/1e3)},t.prototype.lineHeight=function(e,A){var r;return A==null&&(A=!1),r=A?this.lineGap:0,(this.ascender+r-this.decender)/1e3*e},t})();var ya,go=(function(){function t(e){this.data=e??[],this.pos=0,this.length=this.data.length}return t.prototype.readByte=function(){return this.data[this.pos++]},t.prototype.writeByte=function(e){return this.data[this.pos++]=e},t.prototype.readUInt32=function(){return 16777216*this.readByte()+(this.readByte()<<16)+(this.readByte()<<8)+this.readByte()},t.prototype.writeUInt32=function(e){return this.writeByte(e>>>24&255),this.writeByte(e>>16&255),this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt32=function(){var e;return(e=this.readUInt32())>=2147483648?e-4294967296:e},t.prototype.writeInt32=function(e){return e<0&&(e+=4294967296),this.writeUInt32(e)},t.prototype.readUInt16=function(){return this.readByte()<<8|this.readByte()},t.prototype.writeUInt16=function(e){return this.writeByte(e>>8&255),this.writeByte(255&e)},t.prototype.readInt16=function(){var e;return(e=this.readUInt16())>=32768?e-65536:e},t.prototype.writeInt16=function(e){return e<0&&(e+=65536),this.writeUInt16(e)},t.prototype.readString=function(e){var A,r;for(r=[],A=0;0<=e?A<e:A>e;A=0<=e?++A:--A)r[A]=String.fromCharCode(this.readByte());return r.join("")},t.prototype.writeString=function(e){var A,r,n;for(n=[],A=0,r=e.length;0<=r?A<r:A>r;A=0<=r?++A:--A)n.push(this.writeByte(e.charCodeAt(A)));return n},t.prototype.readShort=function(){return this.readInt16()},t.prototype.writeShort=function(e){return this.writeInt16(e)},t.prototype.readLongLong=function(){var e,A,r,n,i,s,a,o;return e=this.readByte(),A=this.readByte(),r=this.readByte(),n=this.readByte(),i=this.readByte(),s=this.readByte(),a=this.readByte(),o=this.readByte(),128&e?-1*(72057594037927940*(255^e)+281474976710656*(255^A)+1099511627776*(255^r)+4294967296*(255^n)+16777216*(255^i)+65536*(255^s)+256*(255^a)+(255^o)+1):72057594037927940*e+281474976710656*A+1099511627776*r+4294967296*n+16777216*i+65536*s+256*a+o},t.prototype.writeLongLong=function(e){var A,r;return A=Math.floor(e/4294967296),r=4294967295&e,this.writeByte(A>>24&255),this.writeByte(A>>16&255),this.writeByte(A>>8&255),this.writeByte(255&A),this.writeByte(r>>24&255),this.writeByte(r>>16&255),this.writeByte(r>>8&255),this.writeByte(255&r)},t.prototype.readInt=function(){return this.readInt32()},t.prototype.writeInt=function(e){return this.writeInt32(e)},t.prototype.read=function(e){var A,r;for(A=[],r=0;0<=e?r<e:r>e;r=0<=e?++r:--r)A.push(this.readByte());return A},t.prototype.write=function(e){var A,r,n,i;for(i=[],r=0,n=e.length;r<n;r++)A=e[r],i.push(this.writeByte(A));return i},t})(),Hq=(function(){var t;function e(A){var r,n,i;for(this.scalarType=A.readInt(),this.tableCount=A.readShort(),this.searchRange=A.readShort(),this.entrySelector=A.readShort(),this.rangeShift=A.readShort(),this.tables={},n=0,i=this.tableCount;0<=i?n<i:n>i;n=0<=i?++n:--n)r={tag:A.readString(4),checksum:A.readInt(),offset:A.readInt(),length:A.readInt()},this.tables[r.tag]=r}return e.prototype.encode=function(A){var r,n,i,s,a,o,c,g,m,B,w,F,U;for(U in w=Object.keys(A).length,o=Math.log(2),m=16*Math.floor(Math.log(w)/o),s=Math.floor(m/o),g=16*w-m,(n=new go).writeInt(this.scalarType),n.writeShort(w),n.writeShort(m),n.writeShort(s),n.writeShort(g),i=16*w,c=n.pos+i,a=null,F=[],A)for(B=A[U],n.writeString(U),n.writeInt(t(B)),n.writeInt(c),n.writeInt(B.length),F=F.concat(B),U==="head"&&(a=c),c+=B.length;c%4;)F.push(0),c++;return n.write(F),r=2981146554-t(n.data),n.pos=a+8,n.writeUInt32(r),n.data},t=function(A){var r,n,i,s;for(A=M_.call(A);A.length%4;)A.push(0);for(i=new go(A),n=0,r=0,s=A.length;r<s;r=r+=4)n+=i.readUInt32();return 4294967295&n},e})(),kq={}.hasOwnProperty,Ya=function(t,e){for(var A in e)kq.call(e,A)&&(t[A]=e[A]);function r(){this.constructor=t}return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t};ya=(function(){function t(e){var A;this.file=e,A=this.file.directory.tables[this.tag],this.exists=!!A,A&&(this.offset=A.offset,this.length=A.length,this.parse(this.file.contents))}return t.prototype.parse=function(){},t.prototype.encode=function(){},t.prototype.raw=function(){return this.exists?(this.file.contents.pos=this.offset,this.file.contents.read(this.length)):null},t})();var Mq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="head",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.revision=e.readInt(),this.checkSumAdjustment=e.readInt(),this.magicNumber=e.readInt(),this.flags=e.readShort(),this.unitsPerEm=e.readShort(),this.created=e.readLongLong(),this.modified=e.readLongLong(),this.xMin=e.readShort(),this.yMin=e.readShort(),this.xMax=e.readShort(),this.yMax=e.readShort(),this.macStyle=e.readShort(),this.lowestRecPPEM=e.readShort(),this.fontDirectionHint=e.readShort(),this.indexToLocFormat=e.readShort(),this.glyphDataFormat=e.readShort()},t.prototype.encode=function(e){var A;return(A=new go).writeInt(this.version),A.writeInt(this.revision),A.writeInt(this.checkSumAdjustment),A.writeInt(this.magicNumber),A.writeShort(this.flags),A.writeShort(this.unitsPerEm),A.writeLongLong(this.created),A.writeLongLong(this.modified),A.writeShort(this.xMin),A.writeShort(this.yMin),A.writeShort(this.xMax),A.writeShort(this.yMax),A.writeShort(this.macStyle),A.writeShort(this.lowestRecPPEM),A.writeShort(this.fontDirectionHint),A.writeShort(e),A.writeShort(this.glyphDataFormat),A.data},t})(),__=(function(){function t(e,A){var r,n,i,s,a,o,c,g,m,B,w,F,U,_,E,q,R;switch(this.platformID=e.readUInt16(),this.encodingID=e.readShort(),this.offset=A+e.readInt(),m=e.pos,e.pos=this.offset,this.format=e.readUInt16(),this.length=e.readUInt16(),this.language=e.readUInt16(),this.isUnicode=this.platformID===3&&this.encodingID===1&&this.format===4||this.platformID===0&&this.format===4,this.codeMap={},this.format){case 0:for(o=0;o<256;++o)this.codeMap[o]=e.readByte();break;case 4:for(w=e.readUInt16(),B=w/2,e.pos+=6,i=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),e.pos+=2,U=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),c=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),g=(function(){var P,re;for(re=[],o=P=0;0<=B?P<B:P>B;o=0<=B?++P:--P)re.push(e.readUInt16());return re})(),n=(this.length-e.pos+this.offset)/2,a=(function(){var P,re;for(re=[],o=P=0;0<=n?P<n:P>n;o=0<=n?++P:--P)re.push(e.readUInt16());return re})(),o=E=0,R=i.length;E<R;o=++E)for(_=i[o],r=q=F=U[o];F<=_?q<=_:q>=_;r=F<=_?++q:--q)g[o]===0?s=r+c[o]:(s=a[g[o]/2+(r-F)-(B-o)]||0)!==0&&(s+=c[o]),this.codeMap[r]=65535&s}e.pos=m}return t.encode=function(e,A){var r,n,i,s,a,o,c,g,m,B,w,F,U,_,E,q,R,P,re,fe,ne,ee,V,ie,O,H,J,Z,ge,Ce,Ee,de,be,Pe,Fe,T,$,Y,Ae,oe,we,Ue,_e,Le,Oe,Ye;switch(Z=new go,s=Object.keys(e).sort(function(qe,it){return qe-it}),A){case"macroman":for(U=0,_=(function(){var qe=[];for(F=0;F<256;++F)qe.push(0);return qe})(),q={0:0},i={},ge=0,be=s.length;ge<be;ge++)q[_e=e[n=s[ge]]]==null&&(q[_e]=++U),i[n]={old:e[n],new:q[e[n]]},_[n]=q[e[n]];return Z.writeUInt16(1),Z.writeUInt16(0),Z.writeUInt32(12),Z.writeUInt16(0),Z.writeUInt16(262),Z.writeUInt16(0),Z.write(_),{charMap:i,subtable:Z.data,maxGlyphID:U+1};case"unicode":for(H=[],m=[],R=0,q={},r={},E=c=null,Ce=0,Pe=s.length;Ce<Pe;Ce++)q[re=e[n=s[Ce]]]==null&&(q[re]=++R),r[n]={old:re,new:q[re]},a=q[re]-n,E!=null&&a===c||(E&&m.push(E),H.push(n),c=a),E=n;for(E&&m.push(E),m.push(65535),H.push(65535),ie=2*(V=H.length),ee=2*Math.pow(Math.log(V)/Math.LN2,2),B=Math.log(ee/2)/Math.LN2,ne=2*V-ee,o=[],fe=[],w=[],F=Ee=0,Fe=H.length;Ee<Fe;F=++Ee){if(O=H[F],g=m[F],O===65535){o.push(0),fe.push(0);break}if(O-(J=r[O].new)>=32768)for(o.push(0),fe.push(2*(w.length+V-F)),n=de=O;O<=g?de<=g:de>=g;n=O<=g?++de:--de)w.push(r[n].new);else o.push(J-O),fe.push(0)}for(Z.writeUInt16(3),Z.writeUInt16(1),Z.writeUInt32(12),Z.writeUInt16(4),Z.writeUInt16(16+8*V+2*w.length),Z.writeUInt16(0),Z.writeUInt16(ie),Z.writeUInt16(ee),Z.writeUInt16(B),Z.writeUInt16(ne),we=0,T=m.length;we<T;we++)n=m[we],Z.writeUInt16(n);for(Z.writeUInt16(0),Ue=0,$=H.length;Ue<$;Ue++)n=H[Ue],Z.writeUInt16(n);for(Le=0,Y=o.length;Le<Y;Le++)a=o[Le],Z.writeUInt16(a);for(Oe=0,Ae=fe.length;Oe<Ae;Oe++)P=fe[Oe],Z.writeUInt16(P);for(Ye=0,oe=w.length;Ye<oe;Ye++)U=w[Ye],Z.writeUInt16(U);return{charMap:r,subtable:Z.data,maxGlyphID:R+1}}},t})(),k_=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="cmap",t.prototype.parse=function(e){var A,r,n;for(e.pos=this.offset,this.version=e.readUInt16(),n=e.readUInt16(),this.tables=[],this.unicode=null,r=0;0<=n?r<n:r>n;r=0<=n?++r:--r)A=new __(e,this.offset),this.tables.push(A),A.isUnicode&&this.unicode==null&&(this.unicode=A);return!0},t.encode=function(e,A){var r,n;return A==null&&(A="macroman"),r=__.encode(e,A),(n=new go).writeUInt16(0),n.writeUInt16(1),r.table=n.data.concat(r.subtable),r},t})(),qq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="hhea",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.ascender=e.readShort(),this.decender=e.readShort(),this.lineGap=e.readShort(),this.advanceWidthMax=e.readShort(),this.minLeftSideBearing=e.readShort(),this.minRightSideBearing=e.readShort(),this.xMaxExtent=e.readShort(),this.caretSlopeRise=e.readShort(),this.caretSlopeRun=e.readShort(),this.caretOffset=e.readShort(),e.pos+=8,this.metricDataFormat=e.readShort(),this.numberOfMetrics=e.readUInt16()},t})(),Kq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="OS/2",t.prototype.parse=function(e){if(e.pos=this.offset,this.version=e.readUInt16(),this.averageCharWidth=e.readShort(),this.weightClass=e.readUInt16(),this.widthClass=e.readUInt16(),this.type=e.readShort(),this.ySubscriptXSize=e.readShort(),this.ySubscriptYSize=e.readShort(),this.ySubscriptXOffset=e.readShort(),this.ySubscriptYOffset=e.readShort(),this.ySuperscriptXSize=e.readShort(),this.ySuperscriptYSize=e.readShort(),this.ySuperscriptXOffset=e.readShort(),this.ySuperscriptYOffset=e.readShort(),this.yStrikeoutSize=e.readShort(),this.yStrikeoutPosition=e.readShort(),this.familyClass=e.readShort(),this.panose=(function(){var A,r;for(r=[],A=0;A<10;++A)r.push(e.readByte());return r})(),this.charRange=(function(){var A,r;for(r=[],A=0;A<4;++A)r.push(e.readInt());return r})(),this.vendorID=e.readString(4),this.selection=e.readShort(),this.firstCharIndex=e.readShort(),this.lastCharIndex=e.readShort(),this.version>0&&(this.ascent=e.readShort(),this.descent=e.readShort(),this.lineGap=e.readShort(),this.winAscent=e.readShort(),this.winDescent=e.readShort(),this.codePageRange=(function(){var A,r;for(r=[],A=0;A<2;A=++A)r.push(e.readInt());return r})(),this.version>1))return this.xHeight=e.readShort(),this.capHeight=e.readShort(),this.defaultChar=e.readShort(),this.breakChar=e.readShort(),this.maxContext=e.readShort()},t})(),jq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="post",t.prototype.parse=function(e){var A,r,n;switch(e.pos=this.offset,this.format=e.readInt(),this.italicAngle=e.readInt(),this.underlinePosition=e.readShort(),this.underlineThickness=e.readShort(),this.isFixedPitch=e.readInt(),this.minMemType42=e.readInt(),this.maxMemType42=e.readInt(),this.minMemType1=e.readInt(),this.maxMemType1=e.readInt(),this.format){case 65536:case 196608:break;case 131072:var i;for(r=e.readUInt16(),this.glyphNameIndex=[],i=0;0<=r?i<r:i>r;i=0<=r?++i:--i)this.glyphNameIndex.push(e.readUInt16());for(this.names=[],n=[];e.pos<this.offset+this.length;)A=e.readByte(),n.push(this.names.push(e.readString(A)));return n;case 151552:return r=e.readUInt16(),this.offsets=e.read(r);case 262144:return this.map=function(){var s,a,o;for(o=[],i=s=0,a=this.file.maxp.numGlyphs;0<=a?s<a:s>a;i=0<=a?++s:--s)o.push(e.readUInt32());return o}.call(this)}},t})(),Vq=function(t,e){this.raw=t,this.length=t.length,this.platformID=e.platformID,this.encodingID=e.encodingID,this.languageID=e.languageID},Gq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="name",t.prototype.parse=function(e){var A,r,n,i,s,a,o,c,g,m,B;for(e.pos=this.offset,e.readShort(),A=e.readShort(),a=e.readShort(),r=[],i=0;0<=A?i<A:i>A;i=0<=A?++i:--i)r.push({platformID:e.readShort(),encodingID:e.readShort(),languageID:e.readShort(),nameID:e.readShort(),length:e.readShort(),offset:this.offset+a+e.readShort()});for(o={},i=g=0,m=r.length;g<m;i=++g)n=r[i],e.pos=n.offset,c=e.readString(n.length),s=new Vq(c,n),o[B=n.nameID]==null&&(o[B]=[]),o[n.nameID].push(s);this.strings=o,this.copyright=o[0],this.fontFamily=o[1],this.fontSubfamily=o[2],this.uniqueSubfamily=o[3],this.fontName=o[4],this.version=o[5];try{this.postscriptName=o[6][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}catch{this.postscriptName=o[4][0].raw.replace(/[\x00-\x19\x80-\xff]/g,"")}return this.trademark=o[7],this.manufacturer=o[8],this.designer=o[9],this.description=o[10],this.vendorUrl=o[11],this.designerUrl=o[12],this.license=o[13],this.licenseUrl=o[14],this.preferredFamily=o[15],this.preferredSubfamily=o[17],this.compatibleFull=o[18],this.sampleText=o[19]},t})(),zq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="maxp",t.prototype.parse=function(e){return e.pos=this.offset,this.version=e.readInt(),this.numGlyphs=e.readUInt16(),this.maxPoints=e.readUInt16(),this.maxContours=e.readUInt16(),this.maxCompositePoints=e.readUInt16(),this.maxComponentContours=e.readUInt16(),this.maxZones=e.readUInt16(),this.maxTwilightPoints=e.readUInt16(),this.maxStorage=e.readUInt16(),this.maxFunctionDefs=e.readUInt16(),this.maxInstructionDefs=e.readUInt16(),this.maxStackElements=e.readUInt16(),this.maxSizeOfInstructions=e.readUInt16(),this.maxComponentElements=e.readUInt16(),this.maxComponentDepth=e.readUInt16()},t})(),Wq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="hmtx",t.prototype.parse=function(e){var A,r,n,i,s,a,o;for(e.pos=this.offset,this.metrics=[],A=0,a=this.file.hhea.numberOfMetrics;0<=a?A<a:A>a;A=0<=a?++A:--A)this.metrics.push({advance:e.readUInt16(),lsb:e.readInt16()});for(n=this.file.maxp.numGlyphs-this.file.hhea.numberOfMetrics,this.leftSideBearings=(function(){var c,g;for(g=[],A=c=0;0<=n?c<n:c>n;A=0<=n?++c:--c)g.push(e.readInt16());return g})(),this.widths=function(){var c,g,m,B;for(B=[],c=0,g=(m=this.metrics).length;c<g;c++)i=m[c],B.push(i.advance);return B}.call(this),r=this.widths[this.widths.length-1],o=[],A=s=0;0<=n?s<n:s>n;A=0<=n?++s:--s)o.push(this.widths.push(r));return o},t.prototype.forGlyph=function(e){return e in this.metrics?this.metrics[e]:{advance:this.metrics[this.metrics.length-1].advance,lsb:this.leftSideBearings[e-this.metrics.length]}},t})(),M_=[].slice,Xq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="glyf",t.prototype.parse=function(){return this.cache={}},t.prototype.glyphFor=function(e){var A,r,n,i,s,a,o,c,g,m;return e in this.cache?this.cache[e]:(i=this.file.loca,A=this.file.contents,r=i.indexOf(e),(n=i.lengthOf(e))===0?this.cache[e]=null:(A.pos=this.offset+r,s=(a=new go(A.read(n))).readShort(),c=a.readShort(),m=a.readShort(),o=a.readShort(),g=a.readShort(),this.cache[e]=s===-1?new Yq(a,c,m,o,g):new $q(a,s,c,m,o,g),this.cache[e]))},t.prototype.encode=function(e,A,r){var n,i,s,a,o;for(s=[],i=[],a=0,o=A.length;a<o;a++)n=e[A[a]],i.push(s.length),n&&(s=s.concat(n.encode(r)));return i.push(s.length),{table:s,offsets:i}},t})(),$q=(function(){function t(e,A,r,n,i,s){this.raw=e,this.numberOfContours=A,this.xMin=r,this.yMin=n,this.xMax=i,this.yMax=s,this.compound=!1}return t.prototype.encode=function(){return this.raw.data},t})(),Yq=(function(){function t(e,A,r,n,i){var s,a;for(this.raw=e,this.xMin=A,this.yMin=r,this.xMax=n,this.yMax=i,this.compound=!0,this.glyphIDs=[],this.glyphOffsets=[],s=this.raw;a=s.readShort(),this.glyphOffsets.push(s.pos),this.glyphIDs.push(s.readUInt16()),32&a;)s.pos+=1&a?4:2,128&a?s.pos+=8:64&a?s.pos+=4:8&a&&(s.pos+=2)}return t.prototype.encode=function(){var e,A,r;for(A=new go(M_.call(this.raw.data)),e=0,r=this.glyphIDs.length;e<r;++e)A.pos=this.glyphOffsets[e];return A.data},t})(),Jq=(function(){function t(){return t.__super__.constructor.apply(this,arguments)}return Ya(t,ya),t.prototype.tag="loca",t.prototype.parse=function(e){var A,r;return e.pos=this.offset,A=this.file.head.indexToLocFormat,this.offsets=A===0?function(){var n,i;for(i=[],r=0,n=this.length;r<n;r+=2)i.push(2*e.readUInt16());return i}.call(this):function(){var n,i;for(i=[],r=0,n=this.length;r<n;r+=4)i.push(e.readUInt32());return i}.call(this)},t.prototype.indexOf=function(e){return this.offsets[e]},t.prototype.lengthOf=function(e){return this.offsets[e+1]-this.offsets[e]},t.prototype.encode=function(e,A){for(var r=new Uint32Array(this.offsets.length),n=0,i=0,s=0;s<r.length;++s)if(r[s]=n,i<A.length&&A[i]==s){++i,r[s]=n;var a=this.offsets[s],o=this.offsets[s+1]-a;o>0&&(n+=o)}for(var c=new Array(4*r.length),g=0;g<r.length;++g)c[4*g+3]=255&r[g],c[4*g+2]=(65280&r[g])>>8,c[4*g+1]=(16711680&r[g])>>16,c[4*g]=(4278190080&r[g])>>24;return c},t})(),Zq=(function(){function t(e){this.font=e,this.subset={},this.unicodes={},this.next=33}return t.prototype.generateCmap=function(){var e,A,r,n,i;for(A in n=this.font.cmap.tables[0].codeMap,e={},i=this.subset)r=i[A],e[A]=n[r];return e},t.prototype.glyphsFor=function(e){var A,r,n,i,s,a,o;for(n={},s=0,a=e.length;s<a;s++)n[i=e[s]]=this.font.glyf.glyphFor(i);for(i in A=[],n)(r=n[i])!=null&&r.compound&&A.push.apply(A,r.glyphIDs);if(A.length>0)for(i in o=this.glyphsFor(A))r=o[i],n[i]=r;return n},t.prototype.encode=function(e,A){var r,n,i,s,a,o,c,g,m,B,w,F,U,_,E;for(n in r=k_.encode(this.generateCmap(),"unicode"),s=this.glyphsFor(e),w={0:0},E=r.charMap)w[(o=E[n]).old]=o.new;for(F in B=r.maxGlyphID,s)F in w||(w[F]=B++);return g=(function(q){var R,P;for(R in P={},q)P[q[R]]=R;return P})(w),m=Object.keys(g).sort(function(q,R){return q-R}),U=(function(){var q,R,P;for(P=[],q=0,R=m.length;q<R;q++)a=m[q],P.push(g[a]);return P})(),i=this.font.glyf.encode(s,U,w),c=this.font.loca.encode(i.offsets,U),_={cmap:this.font.cmap.raw(),glyf:i.table,loca:c,hmtx:this.font.hmtx.raw(),hhea:this.font.hhea.raw(),maxp:this.font.maxp.raw(),post:this.font.post.raw(),name:this.font.name.raw(),head:this.font.head.encode(A)},this.font.os2.exists&&(_["OS/2"]=this.font.os2.raw()),this.font.directory.encode(_)},t})();Ct.API.PDFObject=(function(){var t;function e(){}return t=function(A,r){return(Array(r+1).join("0")+A).slice(-r)},e.convert=function(A){var r,n,i,s;if(Array.isArray(A))return"["+(function(){var a,o,c;for(c=[],a=0,o=A.length;a<o;a++)r=A[a],c.push(e.convert(r));return c})().join(" ")+"]";if(typeof A=="string")return"/"+A;if(A?.isString)return"("+A+")";if(A instanceof Date)return"(D:"+t(A.getUTCFullYear(),4)+t(A.getUTCMonth(),2)+t(A.getUTCDate(),2)+t(A.getUTCHours(),2)+t(A.getUTCMinutes(),2)+t(A.getUTCSeconds(),2)+"Z)";if({}.toString.call(A)==="[object Object]"){for(n in i=["<<"],A)s=A[n],i.push("/"+n+" "+e.convert(s));return i.push(">>"),i.join(`
|
|
88
|
-
`)}return""+A},e})();zl();var c3=t=>new Promise((e,A)=>{let r=new FileReader;r.onloadend=()=>{let n=r.result;typeof n=="string"?e(n.split(",")[1]):A(new Error("Unable to encode PDF blob to base64"))},r.onerror=A,r.readAsDataURL(t)}),S2=async t=>{if(!t)throw new Error("PDF source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}throw new Error("Unsupported PDF source. Pass a Blob or a jsPDF document instance.")},N9=async t=>{if(!t)throw new Error("File source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}if(t instanceof ArrayBuffer)return new Blob([t]);if(t instanceof Uint8Array)return new Blob([t]);if(t&&typeof t.arrayBuffer=="function"){let e=await t.arrayBuffer();return new Blob([e])}throw new Error("Unsupported file source. Pass a Blob, ArrayBuffer, Uint8Array, or a jsPDF document instance.")},Q2=t=>URL.createObjectURL(t),s3=async(t,e)=>{let A=Q2(t),r=document.createElement("a");r.href=A,r.download=e,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(A)},f3=t=>{if(!t)return"";let e=String(t).trim().split(".");return e.length>1?e.pop().toLowerCase():""},O9=t=>{let e=f3(t);return e?[{name:e.toUpperCase(),extensions:[e]}]:[]},Vf=(t,e="pdf")=>t?String(t).includes(".")?t:`${t}.${e}`:`document.${e}`,o3=async(t,e,A="pdf")=>{let{Filesystem:r,Directory:n}=await Promise.resolve().then(()=>(W_(),z_)),{Toast:i}=await Promise.resolve().then(()=>(Z_(),J_)),s=Vf(e,A),a=await c3(t);await r.writeFile({path:s,data:a,directory:n.Documents,recursive:!0});let o=await r.getUri({directory:n.Documents,path:s});try{await i.show({text:`Saved to Documents/${s}`,duration:"short"})}catch{}return o?.uri??s},l3=async(t,e,A="pdf")=>{let{save:r}=await Promise.resolve().then(()=>(t3(),e3)),{writeFile:n}=await Promise.resolve().then(()=>(a3(),i3)),i=Vf(e,A),s=O9(i),a=await r({defaultPath:i,filters:s});if(!a)return;let o=await t.arrayBuffer(),c=new Uint8Array(o);return await n(a,c),a},h3=async(t,e,A="preview")=>{let r=typeof window<"u"?window.__TAURI__?.core?.invoke:void 0;if(typeof r!="function")return;let n=await c3(t),i=Vf(e||"document.pdf");return await r("open_pdf_file",{fileName:i,action:A,payload:n})},P9=async(t,e)=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let n=await h3(t,e,"preview");if(n)return n}catch{}let A=Q2(t),r=null;if(typeof window<"u"&&typeof window.open=="function")try{if(r=window.open("","_blank","noopener,noreferrer"),r){r.location.href=A;try{r.focus?.()}catch{}return setTimeout(()=>{try{URL.revokeObjectURL(A)}catch{}},1500),A}}catch{}if(typeof document<"u"){let n=document.createElement("a");n.href=A,n.target="_blank",n.rel="noopener noreferrer",n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}return A},R9=async t=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let i=await h3(t,"document.pdf","print");if(i)return i}catch{}let e=Q2(t),A=null;if(typeof window<"u"&&typeof window.open=="function")try{if(A=window.open("","_blank","noopener,noreferrer"),A){A.location.href=e;try{A.focus?.()}catch{}setTimeout(()=>{try{A.print?.()}catch{}try{A.close?.()}catch{}try{URL.revokeObjectURL(e)}catch{}},600);return}}catch{}if(typeof document>"u")throw new Error("PDF printing requires a browser document context.");let r=document.createElement("iframe");r.style.position="fixed",r.style.right="0",r.style.bottom="0",r.style.width="0",r.style.height="0",r.style.border="0",r.src=e;let n=()=>{r.parentNode&&r.parentNode.removeChild(r);try{URL.revokeObjectURL(e)}catch{}};return new Promise((i,s)=>{r.onload=()=>{try{r.contentWindow.focus(),r.contentWindow.print(),setTimeout(n,1e3),i()}catch(a){n(),s(a)}},document.body.appendChild(r)})};function d3(){return{async generatePdfFromElement(t,e={}){if(!t)throw new Error("Element is required to generate PDF.");let A=await(0,u3.default)(t,{scale:e.scale??2,useCORS:!0,backgroundColor:e.backgroundColor??"#ffffff",...e.html2canvas}),r=A.toDataURL("image/png"),n=new Ct(e.jsPDF||{orientation:"p",unit:"mm",format:"a4"}),i=e.pageWidth??210,s=e.pageHeight??297,a=A.height*i/A.width,o=0;n.addImage(r,"PNG",0,o,i,a);let c=a-s;for(;c>0;)o=c-a,n.addPage(),n.addImage(r,"PNG",0,o,i,a),c-=s;return n},async downloadPdf(t,e){let A=await S2(t),r=Vf(e,"pdf");return Ki&&li!=="web"?await o3(A,r,"pdf"):Kn?await l3(A,r,"pdf"):(await s3(A,r),r)},async downloadFile(t,e){let A=await N9(t),r=Vf(e,"bin"),n=f3(r)||"bin";return Ki&&li!=="web"?await o3(A,r,n):Kn?await l3(A,r,n):(await s3(A,r),r)},async previewPdf(t,e="preview.pdf"){let A=await S2(t);return await P9(A,e)},async printPdf(t){let e=await S2(t);return await R9(e)}}}G2();D3();var K9=3e4,W2=null;async function j9(){return W2||(W2=await Promise.resolve().then(()=>(zl(),Im))),W2}var X2=null;async function V9(){return X2||(X2=await Promise.resolve().then(()=>(G2(),T3))),X2}var wl=class extends Error{constructor(e,A={}){super(e),this.name="TevrocError",this.status=A.status,this.code=A.code,this.details=A.details,this.response=A.response}};function G9(t,e=""){if(!t)return"";let A=String(e||"tevrocdev"),r=String(t),n="";for(let i=0;i<r.length;i+=1){let s=r.charCodeAt(i),a=A.charCodeAt(i%A.length);n+=(s^a+i+1).toString(16).padStart(2,"0")}return`chat:${n}`}function z9(t={}){return new Lp(t)}var Lp=class{constructor(e={}){let A=e.baseUrl??e.url,r=e.serviceUrl??e.url;if(!A)throw new TypeError("createClient requires a baseUrl");if(this.baseUrl=k3(A),this.serviceUrl=k3(r),this.appId=e.appId,this.appName=e.appName,this.payAccount=e.payAccount??"default",this.isNative=e.isNative??!1,this.fetch=(e.fetch??globalThis.fetch).bind(globalThis),typeof this.fetch!="function")throw new TypeError("No fetch implementation available");this.timeoutMs=e.timeoutMs??K9,this.defaultHeaders=hK(e.headers),this.token=e.token??null,this.auth=Z9(this),this.entities=this.isNative?Zm(this.appId):tK(this),this.functions=AK(this),this.integrations=rK(this),this.agents=nK(this),this.logs=aK(this),this.connectors=sK(this),this.customIntegrations=oK(this),this.sso=lK(this),this.files=this.isNative?Xh(this.appId):uK(this),this.native={store:Mo(this.appId),files:Xh(this.appId),googleDrive:eB(this.appId),projects:tB(this.appId)},this.offline=fB(this),this.payments=J9(this),this.commerce=$9(this),this.realtime=X9(this),this.shiplogic=W9(this),this.platform=Y9(this),this.pdf=d3(this)}setToken(e){return this.token=e||null,this.token?Ip()?.setItem("tevroc_access_token",this.token):Ip()?.removeItem("tevroc_access_token"),this}clearToken(){return this.token=null,Ip()?.removeItem("tevroc_access_token"),this}async request(e,A={}){let r=(A.method??"GET").toUpperCase(),n=new Headers(this.defaultHeaders),i=A.query?fK(A.query):"",s=`${this.baseUrl}${e.startsWith("/")?e:`/${e}`}${i}`,a=new AbortController,o=setTimeout(()=>a.abort(),A.timeoutMs??this.timeoutMs),c=this.token||dK();console.log(c,A),c&&A.auth!==!1&&n.set("authorization",`Bearer ${c}`),this.appId&&n.set("x-app-id",this.appId);let g=A.body;if(g!=null&&pK(g)&&(n.set("content-type","application/json"),g=JSON.stringify(g)),A.headers)for(let[m,B]of Object.entries(A.headers))B!=null&&n.set(m,String(B));try{let m=await this.fetch(s,{method:r,headers:n,body:g,signal:A.signal??a.signal}),B=await cK(m,A.parseAs);return console.log("Response from request:",B),B}catch(m){throw m?.name==="AbortError"?new wl("Request timed out",{code:"timeout"}):m instanceof wl?m:new wl(m?.message??"Network request failed",{code:"network_error",details:m})}finally{clearTimeout(o)}}};function W9(t){return{getRates:(e={})=>t.request("/shiplogic/rates",{method:"POST",body:e}),createShipment:(e={})=>t.request("/shiplogic/shipments",{method:"POST",body:e}),cancelShipment:e=>t.request(`/shiplogic/shipments/${encodeURIComponent(e)}`,{method:"DELETE"}),trackShipment:e=>t.request(`/shiplogic/track/${encodeURIComponent(e)}`),printLabel:e=>t.request(`/shiplogic/labels/${encodeURIComponent(e)}`,{parseAs:"response"}),validateAddress:(e={})=>t.request("/shiplogic/address/validate",{method:"POST",body:e}),getBranches:(e={})=>t.request("/shiplogic/branches",{query:e}),getCollectionSlots:(e={})=>t.request("/shiplogic/collections/slots",{method:"POST",body:e}),bookCollection:(e={})=>t.request("/shiplogic/collections",{method:"POST",body:e})}}function X9(t){let e=n=>n.replace(/^http:/,"ws:").replace(/^https:/,"wss:"),A=n=>G9(n,t.appId),r=(n,i={},s={})=>{let a=A(n||s.room||"default"),o=`${e(t.baseUrl)}/realtime/${encodeURIComponent(a||"default")}`,c=s.reconnectMs??3e3,g=s.maxReconnects??5,m=null,B=null,w=0,F=!1,U=()=>{B&&(clearTimeout(B),B=null)},_=()=>{U(),!F&&(console.log("[tevrocsdk] opening realtime socket",{room:n,roomName:a,url:o,appId:t.appId}),m=new WebSocket(o),m.addEventListener("open",E=>{w=0,console.log("[tevrocsdk] realtime socket open",{room:n,roomName:a,readyState:m.readyState}),i.open?.(E)}),m.addEventListener("message",E=>{let q=E.data;try{q=JSON.parse(E.data)}catch{}console.log("[tevrocsdk] realtime socket message",{room:n,roomName:a,data:q}),i.message?.(q,E)}),m.addEventListener("close",E=>{console.log("[tevrocsdk] realtime socket close",{room:n,roomName:a,code:E.code,reason:E.reason,wasClean:E.wasClean}),i.close?.(E),!(F||w>=g)&&(B=setTimeout(()=>{w+=1,console.log("[tevrocsdk] realtime retry",{room:n,roomName:a,attempt:w,delayMs:c}),_()},c))}),m.addEventListener("error",E=>{console.log("[tevrocsdk] realtime socket error",{room:n,roomName:a,event:E}),i.error?.(E)}))};return _(),{socket:()=>m,send:E=>{let q=typeof E=="string"?E:JSON.stringify(E);return console.log("[tevrocsdk] realtime socket send",{room:n,roomName:a,payload:E,serialized:q}),m?.readyState===WebSocket.OPEN&&m.send(q)},close:()=>{F=!0,U(),console.log("[tevrocsdk] realtime socket close requested",{room:n,roomName:a}),m?.close()},reconnect:()=>{F=!1,_()}}};return{encryptRoomName:A,roomName:A,connect:r,room:(n,i={},s={})=>{let a=r(n,i,s);return{...a,publish:o=>a.send(o)}},iceServers:(n={})=>{let i=[],s=String(n.stun_urls||n.stunUrls||"stun:stun.l.google.com:19302").split(",").map(a=>a.trim()).filter(Boolean);return s.length&&i.push({urls:s}),(n.turn_url||n.turnUrl)&&i.push({urls:n.turn_url||n.turnUrl,username:n.turn_username||n.turnUsername,credential:n.turn_credential||n.turnCredential}),i}}}function $9(t){let e=A=>({list:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{query:r}),query:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}/query`,{method:"POST",body:r}),create:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{method:"POST",body:r}),update:(r,n={})=>t.request(`/commerce/${encodeURIComponent(A)}/${encodeURIComponent(r)}`,{method:"PATCH",body:n})});return{orders:e("CustomerOrder"),deliveries:e("Delivery"),deliveryMessages:e("DeliveryMessage"),availability:e("AvailabilitySlot"),bookings:e("Booking"),appointmentMessages:e("AppointmentMessage"),appointmentSignals:e("AppointmentSignal")}}function Y9(t){return(async function(){let{isNative:e,isCapacitor:A,isTauri:r,platform:n}=await j9();return{platform:n,isCapacitor:A,isTauri:r,isNative:e}})()}function J9(t){return{create:async({amountZAR:e,appId:A="tevrocsoft",mode:r="web",account:n="default",externalCallback:i=void 0}={})=>await R3(e,{appId:A,serviceUrl:t.serviceUrl,mode:r,payAccount:n,externalCallback:i}),createCheckout:async(e={})=>await t.request("/create-checkout",{method:"POST",body:e,auth:!1}),onstatus:e=>{if(typeof e!="function")throw new Error("onstatus requires a function");return P3(e)}}}function Z9(t){return{async register(e){let A=Ss(e,t),r=await t.request("/auth/register",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},loginWithProvider:async(e,A,r=async()=>{})=>{if(e==="google"){let{createGoogleLogin:n,subscribeGoogleLogin:i}=await V9();if(console.log({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),n({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),A){let s=i(async(a,o)=>{if(console.log("Google callback:",a,o),s(),!a)return;let c=await t.request("/auth/google",{method:"POST",body:Ss({accessToken:a.accessToken},t),auth:!1});console.log(c),await r(c.token,c.user),console.log("Redirecting to:",A),window.location.href=A})}}},googleLogin:e=>V2(e),onGoogleLogin:e=>j2(e),async login(e){let A=Ss(e,t),r=await t.request("/auth/login",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},async logout(){let e=await t.request("/auth/logout",{method:"POST",body:Ss({},t)});return t.clearToken(),e},inviteUser:e=>t.request("/users/invite",{method:"POST",body:Ss(e,t)}),acceptInvite:e=>t.request("/auth/accept-invite",{method:"POST",body:Ss(e,t),auth:!1}),me:()=>t.request("/auth/me",{headers:eK(t)}),verifyOtp:e=>t.request("/auth/verify-otp",{method:"POST",body:Ss(e,t),auth:!1}),changePassword:e=>t.request("/auth/change-password",{method:"POST",body:Ss(e,t)}),resetPassword:e=>t.request("/auth/reset-password",{method:"POST",body:Ss(e,t),auth:!1}),loginUrl:e=>t.request("/auth/login-url",{query:e?{redirectTo:e,appId:t.appId||void 0}:{appId:t.appId||void 0},auth:!1})}}function Ss(t={},e){let A={...t||{}};return e?.appId&&A.appId==null&&(A.appId=e.appId),A}function eK(t){return t?.appId?{"x-app-id":t.appId}:{}}function tK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return M3(t,A)}})}function M3(t,e){let A=`/entities/${encodeURIComponent(e)}`;function r(n,i={}){return Object.entries(i).every(([s,a])=>a&&typeof a=="object"?"$eq"in a?n?.[s]===a.$eq:!0:n?.[s]===a)}return{list:async n=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}),limit:n?.limit,offset:n?.offset||0}}return t.request(A,{query:n})},get:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`):{data:(await t.native.store.get(`${e}/${n}`)).val()},create:async n=>t.offline?.isOnline()?t.request(A,{method:"POST",body:n}):t.offline.queueOperation(e,"create",n?.id,n),update:async(n,i)=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"PATCH",body:i}):t.offline.queueOperation(e,"update",n,i),delete:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"DELETE"}):t.offline.queueOperation(e,"delete",n),query:async(n={})=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}).filter(a=>r(a,n.filter||n.where||n.filters||{})).slice(0,n.limit||200),limit:n.limit}}return t.request(`${A}/query`,{method:"POST",body:n})},filter:async(n={},i,s)=>t.offline?.isOnline()?t.request(`${A}/query`,{method:"POST",body:gK(n,i,s)}):M3(t,e).query({filter:n,limit:s}),bulkCreate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{inserted:i}}return t.request(`${A}/bulk`,{method:"POST",body:{records:n}})},bulkUpdate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)s?.id&&(await t.offline.queueOperation(e,"update",s.id,s),i+=1);return{updated:i}}return t.request(`${A}/bulk`,{method:"PATCH",body:{records:n}})},bulkDelete:async n=>{if(!t.offline?.isOnline()){for(let i of n)await t.offline.queueOperation(e,"delete",i);return{deleted:n.length}}return t.request(`${A}/bulk`,{method:"DELETE",body:{ids:n}})},import:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{imported:i}}return t.request(`${A}/import`,{method:"POST",body:{records:n}})}}}function AK(t){return new Proxy({invoke:(e,A)=>t.request(`/functions/${encodeURIComponent(e)}`,{method:"POST",body:A})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return r=>e.invoke(A,r)}})}function rK(t){return{Core:{InvokeLLM:e=>t.request("/integrations/core/invoke-llm",{method:"POST",body:e}),GenerateImage:e=>t.request("/integrations/core/generate-image",{method:"POST",body:e}),UploadFile:(e,A={})=>H3(t,"/integrations/core/upload-file",e,A),UploadPrivateFile:(e,A={})=>H3(t,"/integrations/core/upload-private-file",e,A),CreateFileSignedUrl:e=>t.request("/integrations/core/create-file-signed-url",{method:"POST",body:e}),SendEmail:e=>t.request("/integrations/core/send-email",{method:"POST",body:e}),ExtractDataFromUploadedFile:e=>t.request("/integrations/core/extract-data-from-uploaded-file",{method:"POST",body:e})}}}function nK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return iK(t,A)}})}function iK(t,e){let A=`/agents/${encodeURIComponent(e)}/conversations`;return{createConversation:(r={})=>t.request(A,{method:"POST",body:r}),listConversations:()=>t.request(A),getConversation:r=>t.request(`${A}/${encodeURIComponent(r)}`),deleteConversation:r=>t.request(`${A}/${encodeURIComponent(r)}`,{method:"DELETE"}),addMessage:(r,n)=>t.request(`${A}/${encodeURIComponent(r)}/messages`,{method:"POST",body:n}),listMessages:r=>t.request(`${A}/${encodeURIComponent(r)}/messages`)}}function aK(t){return{list:e=>t.request("/app-logs",{query:e}),create:e=>t.request("/app-logs",{method:"POST",body:e}),get:e=>t.request(`/app-logs/${encodeURIComponent(e)}`)}}function sK(t){return{list:()=>t.request("/connectors"),get:e=>t.request(`/connectors/${encodeURIComponent(e)}`),connect:(e,A={})=>t.request(`/connectors/${encodeURIComponent(e)}/connect`,{method:"POST",body:A}),disconnect:e=>t.request(`/connectors/${encodeURIComponent(e)}/disconnect`,{method:"POST"}),status:e=>t.request(`/connectors/${encodeURIComponent(e)}/status`),user:{list:()=>t.request("/user-connectors"),get:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`),refresh:e=>t.request(`/user-connectors/${encodeURIComponent(e)}/refresh`,{method:"POST"}),delete:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`,{method:"DELETE"})}}}function oK(t){return new Proxy({invoke:(e,A,r)=>t.request(`/custom-integrations/${encodeURIComponent(e)}/${encodeURIComponent(A)}`,{method:"POST",body:r})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return new Proxy({},{get(r,n){if(typeof n=="string")return i=>e.invoke(A,n,i)}})}})}function lK(t){return{accessToken:e=>t.request("/sso/access-token",{method:"POST",body:e,auth:!1}),callback:e=>t.request("/sso/callback",{query:e,auth:!1})}}function uK(t){return{url:e=>`${t.baseUrl}/files/${encodeURIComponent(e)}`,privateUrl:e=>`${t.baseUrl}/private-files/${encodeURIComponent(e)}`,get:e=>t.request(`/files/${encodeURIComponent(e)}`,{parseAs:"response",auth:!1}),getPrivate:e=>t.request(`/private-files/${encodeURIComponent(e)}`,{parseAs:"response"})}}function H3(t,e,A,r){let n={};return r.filename&&(n["x-filename"]=r.filename),r.contentType&&(n["content-type"]=r.contentType),t.request(e,{method:"POST",body:A,headers:n})}async function cK(t,e){if(e==="response")return t;let r=(t.headers.get("content-type")??"").includes("application/json"),n=r?await t.json():await t.text();if(!t.ok){let i=r&&n?.error?n.error:{};throw new wl(i.message??t.statusText,{status:t.status,code:i.code??"api_error",details:i.details??n,response:t})}return n}function fK(t){let e=new URLSearchParams;for(let[r,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let i of n)e.append(r,String(i));else e.set(r,String(n));let A=e.toString();return A?`?${A}`:""}function k3(t){return String(t).replace(/\/+$/,"")}function hK(t={}){return Object.fromEntries(new Headers(t).entries())}function Ip(){return typeof globalThis<"u"?globalThis.localStorage:void 0}function dK(){return Ip()?.getItem("tevroc_access_token")??null}function gK(t={},e,A){let r={filter:t};return typeof e=="string"?r.sort=e:e&&typeof e=="object"&&Object.assign(r,e),A!==void 0&&(r.limit=A),r}function pK(t){let e=typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer,A=typeof Blob<"u"&&t instanceof Blob,r=typeof FormData<"u"&&t instanceof FormData;return typeof t=="object"&&!e&&!A&&!r}return iQ(wK);})();
|
|
88
|
+
`)}return""+A},e})();zl();var c3=t=>new Promise((e,A)=>{let r=new FileReader;r.onloadend=()=>{let n=r.result;typeof n=="string"?e(n.split(",")[1]):A(new Error("Unable to encode PDF blob to base64"))},r.onerror=A,r.readAsDataURL(t)}),S2=async t=>{if(!t)throw new Error("PDF source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}throw new Error("Unsupported PDF source. Pass a Blob or a jsPDF document instance.")},N9=async t=>{if(!t)throw new Error("File source is required");if(t instanceof Blob)return t;if(typeof t.output=="function"){let e=t.output("blob");return e instanceof Promise?await e:e}if(t instanceof ArrayBuffer)return new Blob([t]);if(t instanceof Uint8Array)return new Blob([t]);if(t&&typeof t.arrayBuffer=="function"){let e=await t.arrayBuffer();return new Blob([e])}throw new Error("Unsupported file source. Pass a Blob, ArrayBuffer, Uint8Array, or a jsPDF document instance.")},Q2=t=>URL.createObjectURL(t),s3=async(t,e)=>{let A=Q2(t),r=document.createElement("a");r.href=A,r.download=e,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(A)},f3=t=>{if(!t)return"";let e=String(t).trim().split(".");return e.length>1?e.pop().toLowerCase():""},O9=t=>{let e=f3(t);return e?[{name:e.toUpperCase(),extensions:[e]}]:[]},Vf=(t,e="pdf")=>t?String(t).includes(".")?t:`${t}.${e}`:`document.${e}`,o3=async(t,e,A="pdf")=>{let{Filesystem:r,Directory:n}=await Promise.resolve().then(()=>(W_(),z_)),{Toast:i}=await Promise.resolve().then(()=>(Z_(),J_)),s=Vf(e,A),a=await c3(t);await r.writeFile({path:s,data:a,directory:n.Documents,recursive:!0});let o=await r.getUri({directory:n.Documents,path:s});try{await i.show({text:`Saved to Documents/${s}`,duration:"short"})}catch{}return o?.uri??s},l3=async(t,e,A="pdf")=>{let{save:r}=await Promise.resolve().then(()=>(t3(),e3)),{writeFile:n}=await Promise.resolve().then(()=>(a3(),i3)),i=Vf(e,A),s=O9(i),a=await r({defaultPath:i,filters:s});if(!a)return;let o=await t.arrayBuffer(),c=new Uint8Array(o);return await n(a,c),a},h3=async(t,e,A="preview")=>{let r=typeof window<"u"?window.__TAURI__?.core?.invoke:void 0;if(typeof r!="function")return;let n=await c3(t),i=Vf(e||"document.pdf");return await r("open_pdf_file",{fileName:i,action:A,payload:n})},P9=async(t,e)=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let n=await h3(t,e,"preview");if(n)return n}catch{}let A=Q2(t),r=null;if(typeof window<"u"&&typeof window.open=="function")try{if(r=window.open("","_blank","noopener,noreferrer"),r){r.location.href=A;try{r.focus?.()}catch{}return setTimeout(()=>{try{URL.revokeObjectURL(A)}catch{}},1500),A}}catch{}if(typeof document<"u"){let n=document.createElement("a");n.href=A,n.target="_blank",n.rel="noopener noreferrer",n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}return A},R9=async t=>{if(Kn&&typeof window<"u"&&window.__TAURI__?.core?.invoke)try{let i=await h3(t,"document.pdf","print");if(i)return i}catch{}let e=Q2(t),A=null;if(typeof window<"u"&&typeof window.open=="function")try{if(A=window.open("","_blank","noopener,noreferrer"),A){A.location.href=e;try{A.focus?.()}catch{}setTimeout(()=>{try{A.print?.()}catch{}try{A.close?.()}catch{}try{URL.revokeObjectURL(e)}catch{}},600);return}}catch{}if(typeof document>"u")throw new Error("PDF printing requires a browser document context.");let r=document.createElement("iframe");r.style.position="fixed",r.style.right="0",r.style.bottom="0",r.style.width="0",r.style.height="0",r.style.border="0",r.src=e;let n=()=>{r.parentNode&&r.parentNode.removeChild(r);try{URL.revokeObjectURL(e)}catch{}};return new Promise((i,s)=>{r.onload=()=>{try{r.contentWindow.focus(),r.contentWindow.print(),setTimeout(n,1e3),i()}catch(a){n(),s(a)}},document.body.appendChild(r)})};function d3(){return{async generatePdfFromElement(t,e={}){if(!t)throw new Error("Element is required to generate PDF.");let A=await(0,u3.default)(t,{scale:e.scale??2,useCORS:!0,backgroundColor:e.backgroundColor??"#ffffff",...e.html2canvas}),r=A.toDataURL("image/png"),n=new Ct(e.jsPDF||{orientation:"p",unit:"mm",format:"a4"}),i=e.pageWidth??210,s=e.pageHeight??297,a=A.height*i/A.width,o=0;n.addImage(r,"PNG",0,o,i,a);let c=a-s;for(;c>0;)o=c-a,n.addPage(),n.addImage(r,"PNG",0,o,i,a),c-=s;return n},async downloadPdf(t,e){let A=await S2(t),r=Vf(e,"pdf");return Ki&&li!=="web"?await o3(A,r,"pdf"):Kn?await l3(A,r,"pdf"):(await s3(A,r),r)},async downloadFile(t,e){let A=await N9(t),r=Vf(e,"bin"),n=f3(r)||"bin";return Ki&&li!=="web"?await o3(A,r,n):Kn?await l3(A,r,n):(await s3(A,r),r)},async previewPdf(t,e="preview.pdf"){let A=await S2(t);return await P9(A,e)},async printPdf(t){let e=await S2(t);return await R9(e)}}}G2();D3();var K9=3e4,W2=null;async function j9(){return W2||(W2=await Promise.resolve().then(()=>(zl(),Im))),W2}var X2=null;async function V9(){return X2||(X2=await Promise.resolve().then(()=>(G2(),T3))),X2}var wl=class extends Error{constructor(e,A={}){super(e),this.name="TevrocError",this.status=A.status,this.code=A.code,this.details=A.details,this.response=A.response}};function G9(t,e=""){if(!t)return"";let A=String(e||"tevrocdev"),r=String(t),n="";for(let i=0;i<r.length;i+=1){let s=r.charCodeAt(i),a=A.charCodeAt(i%A.length);n+=(s^a+i+1).toString(16).padStart(2,"0")}return`chat:${n}`}function z9(t={}){return new Lp(t)}var Lp=class{constructor(e={}){let A=e.baseUrl??e.url,r=e.serviceUrl??e.url;if(!A)throw new TypeError("createClient requires a baseUrl");if(this.baseUrl=k3(A),this.serviceUrl=k3(r),this.appId=e.appId,this.appName=e.appName,this.payAccount=e.payAccount??"default",this.isNative=e.isNative??!1,this.fetch=(e.fetch??globalThis.fetch).bind(globalThis),typeof this.fetch!="function")throw new TypeError("No fetch implementation available");this.timeoutMs=e.timeoutMs??K9,this.defaultHeaders=hK(e.headers),this.token=e.token??null,this.auth=Z9(this),this.entities=this.isNative?Zm(this.appId):tK(this),this.functions=AK(this),this.integrations=rK(this),this.agents=nK(this),this.logs=aK(this),this.connectors=sK(this),this.customIntegrations=oK(this),this.sso=lK(this),this.files=this.isNative?Xh(this.appId):uK(this),this.native={store:Mo(this.appId),files:Xh(this.appId),googleDrive:eB(this.appId),projects:tB(this.appId)},this.offline=fB(this),this.payments=J9(this),this.commerce=$9(this),this.realtime=X9(this),this.shiplogic=W9(this),this.platform=Y9(this),this.pdf=d3(this)}setToken(e){return this.token=e||null,this.token?Ip()?.setItem("tevroc_access_token",this.token):Ip()?.removeItem("tevroc_access_token"),this}clearToken(){return this.token=null,Ip()?.removeItem("tevroc_access_token"),this}async request(e,A={}){let r=(A.method??"GET").toUpperCase(),n=new Headers(this.defaultHeaders),i=A.query?fK(A.query):"",s=`${this.baseUrl}${e.startsWith("/")?e:`/${e}`}${i}`,a=new AbortController,o=setTimeout(()=>a.abort(),A.timeoutMs??this.timeoutMs),c=this.token||dK();console.log(c,A),c&&A.auth!==!1&&n.set("authorization",`Bearer ${c}`),this.appId&&n.set("x-app-id",this.appId);let g=A.body;if(g!=null&&pK(g)&&(n.set("content-type","application/json"),g=JSON.stringify(g)),A.headers)for(let[m,B]of Object.entries(A.headers))B!=null&&n.set(m,String(B));try{let m=await this.fetch(s,{method:r,headers:n,body:g,signal:A.signal??a.signal}),B=await cK(m,A.parseAs);return console.log("Response from request:",B),B}catch(m){throw m?.name==="AbortError"?new wl("Request timed out",{code:"timeout"}):m instanceof wl?m:new wl(m?.message??"Network request failed",{code:"network_error",details:m})}finally{clearTimeout(o)}}};function W9(t){return{getRates:(e={})=>t.request("/shiplogic/rates",{method:"POST",body:e}),createShipment:(e={})=>t.request("/shiplogic/shipments",{method:"POST",body:e}),cancelShipment:e=>t.request(`/shiplogic/shipments/${encodeURIComponent(e)}`,{method:"DELETE"}),trackShipment:e=>t.request(`/shiplogic/track/${encodeURIComponent(e)}`),printLabel:e=>t.request(`/shiplogic/labels/${encodeURIComponent(e)}`,{parseAs:"response"}),validateAddress:(e={})=>t.request("/shiplogic/address/validate",{method:"POST",body:e}),getBranches:(e={})=>t.request("/shiplogic/branches",{query:e}),getCollectionSlots:(e={})=>t.request("/shiplogic/collections/slots",{method:"POST",body:e}),bookCollection:(e={})=>t.request("/shiplogic/collections",{method:"POST",body:e})}}function X9(t){let e=n=>n.replace(/^http:/,"ws:").replace(/^https:/,"wss:"),A=n=>G9(n,t.appId),r=(n,i={},s={})=>{let a=A(n||s.room||"default"),o=`${e(t.baseUrl)}/realtime/${encodeURIComponent(a||"default")}`,c=s.reconnectMs??3e3,g=s.maxReconnects??5;console.log("[tevrocsdk] realtime connect requested",{room:n,roomName:a,url:o,appId:t.appId,reconnectMs:c,maxReconnects:g});let m=null,B=null,w=0,F=!1,U=()=>{B&&(clearTimeout(B),B=null)},_=()=>{U(),!F&&(console.log("[tevrocsdk] opening realtime socket",{room:n,roomName:a,url:o,appId:t.appId}),m=new WebSocket(o),m.addEventListener("open",E=>{w=0,console.log("[tevrocsdk] realtime socket open",{room:n,roomName:a,readyState:m.readyState,url:o}),i.open?.(E)}),m.addEventListener("message",E=>{let q=E.data;try{q=JSON.parse(E.data)}catch{}console.log("[tevrocsdk] realtime socket message",{room:n,roomName:a,data:q}),i.message?.(q,E)}),m.addEventListener("close",E=>{console.log("[tevrocsdk] realtime socket close",{room:n,roomName:a,code:E.code,reason:E.reason,wasClean:E.wasClean}),i.close?.(E),!(F||w>=g)&&(B=setTimeout(()=>{w+=1,console.log("[tevrocsdk] realtime retry",{room:n,roomName:a,attempt:w,delayMs:c}),_()},c))}),m.addEventListener("error",E=>{console.log("[tevrocsdk] realtime socket error",{room:n,roomName:a,event:E}),i.error?.(E)}))};return _(),{socket:()=>m,send:E=>{let q=typeof E=="string"?E:JSON.stringify(E);console.log("[tevrocsdk] realtime socket send",{room:n,roomName:a,payload:E,serialized:q,readyState:m?.readyState});let R=m?.readyState===WebSocket.OPEN?m.send(q):!1;return console.log("[tevrocsdk] realtime socket send result",{room:n,roomName:a,result:R,readyState:m?.readyState}),R},close:()=>{F=!0,U(),console.log("[tevrocsdk] realtime socket close requested",{room:n,roomName:a}),m?.close()},reconnect:()=>{F=!1,_()}}};return{encryptRoomName:A,roomName:A,connect:r,room:(n,i={},s={})=>{let a=r(n,i,s);return console.log("[tevrocsdk] realtime room created",{room:n,options:s}),{...a,publish:o=>(console.log("[tevrocsdk] realtime publish requested",{room:n,payload:o}),a.send(o))}},iceServers:(n={})=>{let i=[],s=String(n.stun_urls||n.stunUrls||"stun:stun.l.google.com:19302").split(",").map(a=>a.trim()).filter(Boolean);return s.length&&i.push({urls:s}),(n.turn_url||n.turnUrl)&&i.push({urls:n.turn_url||n.turnUrl,username:n.turn_username||n.turnUsername,credential:n.turn_credential||n.turnCredential}),i}}}function $9(t){let e=A=>({list:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{query:r}),query:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}/query`,{method:"POST",body:r}),create:(r={})=>t.request(`/commerce/${encodeURIComponent(A)}`,{method:"POST",body:r}),update:(r,n={})=>t.request(`/commerce/${encodeURIComponent(A)}/${encodeURIComponent(r)}`,{method:"PATCH",body:n})});return{orders:e("CustomerOrder"),deliveries:e("Delivery"),deliveryMessages:e("DeliveryMessage"),availability:e("AvailabilitySlot"),bookings:e("Booking"),appointmentMessages:e("AppointmentMessage"),appointmentSignals:e("AppointmentSignal")}}function Y9(t){return(async function(){let{isNative:e,isCapacitor:A,isTauri:r,platform:n}=await j9();return{platform:n,isCapacitor:A,isTauri:r,isNative:e}})()}function J9(t){return{create:async({amountZAR:e,appId:A="tevrocsoft",mode:r="web",account:n="default",externalCallback:i=void 0}={})=>await R3(e,{appId:A,serviceUrl:t.serviceUrl,mode:r,payAccount:n,externalCallback:i}),createCheckout:async(e={})=>await t.request("/create-checkout",{method:"POST",body:e,auth:!1}),onstatus:e=>{if(typeof e!="function")throw new Error("onstatus requires a function");return P3(e)}}}function Z9(t){return{async register(e){let A=Ss(e,t),r=await t.request("/auth/register",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},loginWithProvider:async(e,A,r=async()=>{})=>{if(e==="google"){let{createGoogleLogin:n,subscribeGoogleLogin:i}=await V9();if(console.log({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),n({serviceUrl:t.serviceUrl,appId:t.appId,appName:t.appName}),A){let s=i(async(a,o)=>{if(console.log("Google callback:",a,o),s(),!a)return;let c=await t.request("/auth/google",{method:"POST",body:Ss({accessToken:a.accessToken},t),auth:!1});console.log(c),await r(c.token,c.user),console.log("Redirecting to:",A),window.location.href=A})}}},googleLogin:e=>V2(e),onGoogleLogin:e=>j2(e),async login(e){let A=Ss(e,t),r=await t.request("/auth/login",{method:"POST",body:A,auth:!1});return r.token&&t.setToken(r.token),r},async logout(){let e=await t.request("/auth/logout",{method:"POST",body:Ss({},t)});return t.clearToken(),e},inviteUser:e=>t.request("/users/invite",{method:"POST",body:Ss(e,t)}),acceptInvite:e=>t.request("/auth/accept-invite",{method:"POST",body:Ss(e,t),auth:!1}),me:()=>t.request("/auth/me",{headers:eK(t)}),verifyOtp:e=>t.request("/auth/verify-otp",{method:"POST",body:Ss(e,t),auth:!1}),changePassword:e=>t.request("/auth/change-password",{method:"POST",body:Ss(e,t)}),resetPassword:e=>t.request("/auth/reset-password",{method:"POST",body:Ss(e,t),auth:!1}),loginUrl:e=>t.request("/auth/login-url",{query:e?{redirectTo:e,appId:t.appId||void 0}:{appId:t.appId||void 0},auth:!1})}}function Ss(t={},e){let A={...t||{}};return e?.appId&&A.appId==null&&(A.appId=e.appId),A}function eK(t){return t?.appId?{"x-app-id":t.appId}:{}}function tK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return M3(t,A)}})}function M3(t,e){let A=`/entities/${encodeURIComponent(e)}`;function r(n,i={}){return Object.entries(i).every(([s,a])=>a&&typeof a=="object"?"$eq"in a?n?.[s]===a.$eq:!0:n?.[s]===a)}return{list:async n=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}),limit:n?.limit,offset:n?.offset||0}}return t.request(A,{query:n})},get:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`):{data:(await t.native.store.get(`${e}/${n}`)).val()},create:async n=>t.offline?.isOnline()?t.request(A,{method:"POST",body:n}):t.offline.queueOperation(e,"create",n?.id,n),update:async(n,i)=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"PATCH",body:i}):t.offline.queueOperation(e,"update",n,i),delete:async n=>t.offline?.isOnline()?t.request(`${A}/${encodeURIComponent(n)}`,{method:"DELETE"}):t.offline.queueOperation(e,"delete",n),query:async(n={})=>{if(!t.offline?.isOnline()){let i=await t.native.store.get(`entities/${e}`);return{data:Object.values(i.val()||{}).filter(a=>r(a,n.filter||n.where||n.filters||{})).slice(0,n.limit||200),limit:n.limit}}return t.request(`${A}/query`,{method:"POST",body:n})},filter:async(n={},i,s)=>t.offline?.isOnline()?t.request(`${A}/query`,{method:"POST",body:gK(n,i,s)}):M3(t,e).query({filter:n,limit:s}),bulkCreate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{inserted:i}}return t.request(`${A}/bulk`,{method:"POST",body:{records:n}})},bulkUpdate:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)s?.id&&(await t.offline.queueOperation(e,"update",s.id,s),i+=1);return{updated:i}}return t.request(`${A}/bulk`,{method:"PATCH",body:{records:n}})},bulkDelete:async n=>{if(!t.offline?.isOnline()){for(let i of n)await t.offline.queueOperation(e,"delete",i);return{deleted:n.length}}return t.request(`${A}/bulk`,{method:"DELETE",body:{ids:n}})},import:async n=>{if(!t.offline?.isOnline()){let i=0;for(let s of n)await t.offline.queueOperation(e,"create",s?.id,s),i+=1;return{imported:i}}return t.request(`${A}/import`,{method:"POST",body:{records:n}})}}}function AK(t){return new Proxy({invoke:(e,A)=>t.request(`/functions/${encodeURIComponent(e)}`,{method:"POST",body:A})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return r=>e.invoke(A,r)}})}function rK(t){return{Core:{InvokeLLM:e=>t.request("/integrations/core/invoke-llm",{method:"POST",body:e}),GenerateImage:e=>t.request("/integrations/core/generate-image",{method:"POST",body:e}),UploadFile:(e,A={})=>H3(t,"/integrations/core/upload-file",e,A),UploadPrivateFile:(e,A={})=>H3(t,"/integrations/core/upload-private-file",e,A),CreateFileSignedUrl:e=>t.request("/integrations/core/create-file-signed-url",{method:"POST",body:e}),SendEmail:e=>t.request("/integrations/core/send-email",{method:"POST",body:e}),ExtractDataFromUploadedFile:e=>t.request("/integrations/core/extract-data-from-uploaded-file",{method:"POST",body:e})}}}function nK(t){return new Proxy({},{get(e,A){if(typeof A=="string")return iK(t,A)}})}function iK(t,e){let A=`/agents/${encodeURIComponent(e)}/conversations`;return{createConversation:(r={})=>t.request(A,{method:"POST",body:r}),listConversations:()=>t.request(A),getConversation:r=>t.request(`${A}/${encodeURIComponent(r)}`),deleteConversation:r=>t.request(`${A}/${encodeURIComponent(r)}`,{method:"DELETE"}),addMessage:(r,n)=>t.request(`${A}/${encodeURIComponent(r)}/messages`,{method:"POST",body:n}),listMessages:r=>t.request(`${A}/${encodeURIComponent(r)}/messages`)}}function aK(t){return{list:e=>t.request("/app-logs",{query:e}),create:e=>t.request("/app-logs",{method:"POST",body:e}),get:e=>t.request(`/app-logs/${encodeURIComponent(e)}`)}}function sK(t){return{list:()=>t.request("/connectors"),get:e=>t.request(`/connectors/${encodeURIComponent(e)}`),connect:(e,A={})=>t.request(`/connectors/${encodeURIComponent(e)}/connect`,{method:"POST",body:A}),disconnect:e=>t.request(`/connectors/${encodeURIComponent(e)}/disconnect`,{method:"POST"}),status:e=>t.request(`/connectors/${encodeURIComponent(e)}/status`),user:{list:()=>t.request("/user-connectors"),get:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`),refresh:e=>t.request(`/user-connectors/${encodeURIComponent(e)}/refresh`,{method:"POST"}),delete:e=>t.request(`/user-connectors/${encodeURIComponent(e)}`,{method:"DELETE"})}}}function oK(t){return new Proxy({invoke:(e,A,r)=>t.request(`/custom-integrations/${encodeURIComponent(e)}/${encodeURIComponent(A)}`,{method:"POST",body:r})},{get(e,A){if(A in e)return e[A];if(typeof A=="string")return new Proxy({},{get(r,n){if(typeof n=="string")return i=>e.invoke(A,n,i)}})}})}function lK(t){return{accessToken:e=>t.request("/sso/access-token",{method:"POST",body:e,auth:!1}),callback:e=>t.request("/sso/callback",{query:e,auth:!1})}}function uK(t){return{url:e=>`${t.baseUrl}/files/${encodeURIComponent(e)}`,privateUrl:e=>`${t.baseUrl}/private-files/${encodeURIComponent(e)}`,get:e=>t.request(`/files/${encodeURIComponent(e)}`,{parseAs:"response",auth:!1}),getPrivate:e=>t.request(`/private-files/${encodeURIComponent(e)}`,{parseAs:"response"})}}function H3(t,e,A,r){let n={};return r.filename&&(n["x-filename"]=r.filename),r.contentType&&(n["content-type"]=r.contentType),t.request(e,{method:"POST",body:A,headers:n})}async function cK(t,e){if(e==="response")return t;let r=(t.headers.get("content-type")??"").includes("application/json"),n=r?await t.json():await t.text();if(!t.ok){let i=r&&n?.error?n.error:{};throw new wl(i.message??t.statusText,{status:t.status,code:i.code??"api_error",details:i.details??n,response:t})}return n}function fK(t){let e=new URLSearchParams;for(let[r,n]of Object.entries(t))if(n!=null)if(Array.isArray(n))for(let i of n)e.append(r,String(i));else e.set(r,String(n));let A=e.toString();return A?`?${A}`:""}function k3(t){return String(t).replace(/\/+$/,"")}function hK(t={}){return Object.fromEntries(new Headers(t).entries())}function Ip(){return typeof globalThis<"u"?globalThis.localStorage:void 0}function dK(){return Ip()?.getItem("tevroc_access_token")??null}function gK(t={},e,A){let r={filter:t};return typeof e=="string"?r.sort=e:e&&typeof e=="object"&&Object.assign(r,e),A!==void 0&&(r.limit=A),r}function pK(t){let e=typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer,A=typeof Blob<"u"&&t instanceof Blob,r=typeof FormData<"u"&&t instanceof FormData;return typeof t=="object"&&!e&&!A&&!r}return iQ(wK);})();
|
|
89
89
|
/*! Bundled license information:
|
|
90
90
|
|
|
91
91
|
@capacitor/core/dist/index.js:
|
package/tevroc-sdk.umd.js
CHANGED
|
@@ -41414,6 +41414,7 @@ var Tevroc = (() => {
|
|
|
41414
41414
|
const url = `${toWebSocketUrl(client.baseUrl)}/realtime/${encodeURIComponent(roomName || "default")}`;
|
|
41415
41415
|
const reconnectMs = options.reconnectMs ?? 3e3;
|
|
41416
41416
|
const maxReconnects = options.maxReconnects ?? 5;
|
|
41417
|
+
console.log("[tevrocsdk] realtime connect requested", { room, roomName, url, appId: client.appId, reconnectMs, maxReconnects });
|
|
41417
41418
|
let socket = null;
|
|
41418
41419
|
let reconnectTimer = null;
|
|
41419
41420
|
let reconnectCount = 0;
|
|
@@ -41431,7 +41432,7 @@ var Tevroc = (() => {
|
|
|
41431
41432
|
socket = new WebSocket(url);
|
|
41432
41433
|
socket.addEventListener("open", (event) => {
|
|
41433
41434
|
reconnectCount = 0;
|
|
41434
|
-
console.log("[tevrocsdk] realtime socket open", { room, roomName, readyState: socket.readyState });
|
|
41435
|
+
console.log("[tevrocsdk] realtime socket open", { room, roomName, readyState: socket.readyState, url });
|
|
41435
41436
|
handlers.open?.(event);
|
|
41436
41437
|
});
|
|
41437
41438
|
socket.addEventListener("message", (event) => {
|
|
@@ -41463,8 +41464,10 @@ var Tevroc = (() => {
|
|
|
41463
41464
|
socket: () => socket,
|
|
41464
41465
|
send: (payload) => {
|
|
41465
41466
|
const serialized = typeof payload === "string" ? payload : JSON.stringify(payload);
|
|
41466
|
-
console.log("[tevrocsdk] realtime socket send", { room, roomName, payload, serialized });
|
|
41467
|
-
|
|
41467
|
+
console.log("[tevrocsdk] realtime socket send", { room, roomName, payload, serialized, readyState: socket?.readyState });
|
|
41468
|
+
const result = socket?.readyState === WebSocket.OPEN ? socket.send(serialized) : false;
|
|
41469
|
+
console.log("[tevrocsdk] realtime socket send result", { room, roomName, result, readyState: socket?.readyState });
|
|
41470
|
+
return result;
|
|
41468
41471
|
},
|
|
41469
41472
|
close: () => {
|
|
41470
41473
|
closedByUser = true;
|
|
@@ -41484,9 +41487,13 @@ var Tevroc = (() => {
|
|
|
41484
41487
|
connect,
|
|
41485
41488
|
room: (room, handlers = {}, options = {}) => {
|
|
41486
41489
|
const connection = connect(room, handlers, options);
|
|
41490
|
+
console.log("[tevrocsdk] realtime room created", { room, options });
|
|
41487
41491
|
return {
|
|
41488
41492
|
...connection,
|
|
41489
|
-
publish: (payload) =>
|
|
41493
|
+
publish: (payload) => {
|
|
41494
|
+
console.log("[tevrocsdk] realtime publish requested", { room, payload });
|
|
41495
|
+
return connection.send(payload);
|
|
41496
|
+
}
|
|
41490
41497
|
};
|
|
41491
41498
|
},
|
|
41492
41499
|
iceServers: (config = {}) => {
|