@tokshare/pick 0.1.0 → 0.1.1
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/LICENSE +1 -1
- package/README.md +28 -3
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/picker.global.js +1 -1
- package/package.json +12 -3
package/dist/picker.global.js
CHANGED
|
@@ -139,7 +139,7 @@ button:focus-visible, .link:focus-visible { outline: 3px solid color-mix(in srgb
|
|
|
139
139
|
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
|
|
140
140
|
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
|
|
141
141
|
@media (prefers-reduced-motion: reduce) { .zone, .tile, .qr, .bar i, .item { transition: none; animation: none; } .qr-loading, .status.live i { animation: none; } }
|
|
142
|
-
`;var dt={title:"Pick files from your phone",titleOne:"Pick a file from your phone",scan:"Scan with your phone's camera",orType:"No camera? Open {host} on your phone and type",loading:"Getting a code\u2026",waiting:"Waiting for your phone\u2026",connected:"Connected: {label}",connectedDirect:"Connected over Wi-Fi: {label}",disconnect:"Not you? Disconnect",phoneLeft:"Your phone disconnected. It reconnects by itself when the page is open.",approveTitle:"Approve this phone?",approveMatch:"Your phone should show {match}.",approve:"Approve",reject:"Reject",sending:"Sending from phone {percent}%",receiving:"Receiving {percent}%",received:"Received",failed:"Not received",cancel:"Cancel",done:"Done",useFiles:"Use {count} files",useFile:"Use this file",expired:"This code expired.",newCode:"Get a new code",error:"Couldn't start: {message}",tryAgain:"Try again",close:"Close",privacy:"Files go straight to this site and are deleted from TokShare once received.",dropTitle:"Drag & drop files here",dropTitleOne:"Drag & drop a file here",dropActive:"Drop to add",or:"or",browse:"Browse files",usePhone:"Use your phone",hintTypes:"{types} \xB7 up to {size}",hintAny:"Any file \xB7 up to {size}",hintCount:"Up to {count} files",phoneTitle:"Scan with your phone",phoneStep1:"Open your phone's camera and scan the code",phoneStep2:"Pick photos or files on your phone",phoneStep3:"They appear here as they arrive",phoneCode:"No camera? Open {host} and type",back:"Back",doneWithPhone:"Done",sourcePhone:"From phone",sourceDevice:"This device",remove:"Remove {name}",tooLarge:"{name} is larger than {size}.",wrongType:"{name} isn't an accepted file type.",tooMany:"You can add up to {count} files.",fileCount:"{count} files",clearAll:"Remove all",announceText:"Move photos between your phone and your own PC anytime, over Wi-Fi.",announceLink:"Get TokShare for desktop",announceHide:"Hide"},pt={title:"\u0627\u062E\u062A\u0631 \u0645\u0644\u0641\u0627\u062A \u0645\u0646 \u0647\u0627\u062A\u0641\u0643",titleOne:"\u0627\u062E\u062A\u0631 \u0645\u0644\u0641\u064B\u0627 \u0645\u0646 \u0647\u0627\u062A\u0641\u0643",scan:"\u0627\u0645\u0633\u062D \u0627\u0644\u0631\u0645\u0632 \u0628\u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0627\u062A\u0641\u0643",orType:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0643\u0627\u0645\u064A\u0631\u0627\u061F \u0627\u0641\u062A\u062D {host} \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643 \u0648\u0627\u0643\u062A\u0628",loading:"\u062C\u0627\u0631\u064D \u062A\u062C\u0647\u064A\u0632 \u0627\u0644\u0631\u0645\u0632\u2026",waiting:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0647\u0627\u062A\u0641\u0643\u2026",connected:"\u0645\u062A\u0635\u0644: {label}",connectedDirect:"\u0645\u062A\u0635\u0644 \u0639\u0628\u0631 Wi-Fi: {label}",disconnect:"\u0644\u064A\u0633 \u0647\u0627\u062A\u0641\u0643\u061F \u0627\u0641\u0635\u0644\u0647",phoneLeft:"\u0627\u0646\u0642\u0637\u0639 \u0627\u062A\u0635\u0627\u0644 \u0647\u0627\u062A\u0641\u0643. \u0633\u064A\u0639\u0648\u062F \u062A\u0644\u0642\u0627\u0626\u064A\u064B\u0627 \u0645\u0627 \u062F\u0627\u0645\u062A \u0627\u0644\u0635\u0641\u062D\u0629 \u0645\u0641\u062A\u0648\u062D\u0629 \u0639\u0644\u064A\u0647.",approveTitle:"\u0647\u0644 \u062A\u0648\u0627\u0641\u0642 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0647\u0627\u062A\u0641\u061F",approveMatch:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0639\u0631\u0636 \u0647\u0627\u062A\u0641\u0643 \u0627\u0644\u0631\u0642\u0645 {match}.",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u0645\u0646 \u0627\u0644\u0647\u0627\u062A\u0641 {percent}%",receiving:"\u062C\u0627\u0631\u064D \u0627\u0644\u0627\u0633\u062A\u0644\u0627\u0645 {percent}%",received:"\u062A\u0645 \u0627\u0644\u0627\u0633\u062A\u0644\u0627\u0645",failed:"\u0644\u0645 \u064A\u064F\u0633\u062A\u0644\u0645",cancel:"\u0625\u0644\u063A\u0627\u0621",done:"\u062A\u0645",useFiles:"\u0627\u0633\u062A\u062E\u062F\u0645 {count} \u0645\u0644\u0641\u0627\u062A",useFile:"\u0627\u0633\u062A\u062E\u062F\u0645 \u0647\u0630\u0627 \u0627\u0644\u0645\u0644\u0641",expired:"\u0627\u0646\u062A\u0647\u062A \u0635\u0644\u0627\u062D\u064A\u0629 \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632.",newCode:"\u0627\u062D\u0635\u0644 \u0639\u0644\u0649 \u0631\u0645\u0632 \u062C\u062F\u064A\u062F",error:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0628\u062F\u0621: {message}",tryAgain:"\u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649",close:"\u0625\u063A\u0644\u0627\u0642",privacy:"\u062A\u0635\u0644 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0645\u0628\u0627\u0634\u0631\u0629 \u0625\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639\u060C \u0648\u064A\u062D\u0630\u0641\u0647\u0627 TokShare \u0641\u0648\u0631 \u0627\u0633\u062A\u0644\u0627\u0645\u0647\u0627.",dropTitle:"\u0627\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0648\u0623\u0641\u0644\u062A\u0647\u0627 \u0647\u0646\u0627",dropTitleOne:"\u0627\u0633\u062D\u0628 \u0645\u0644\u0641\u064B\u0627 \u0648\u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",dropActive:"\u0623\u0641\u0644\u062A \u0644\u0644\u0625\u0636\u0627\u0641\u0629",or:"\u0623\u0648",browse:"\u062A\u0635\u0641\u0651\u062D \u0627\u0644\u0645\u0644\u0641\u0627\u062A",usePhone:"\u0627\u0633\u062A\u062E\u062F\u0645 \u0647\u0627\u062A\u0641\u0643",hintTypes:"{types} \xB7 \u062D\u062A\u0649 {size}",hintAny:"\u0623\u064A \u0645\u0644\u0641 \xB7 \u062D\u062A\u0649 {size}",hintCount:"\u062D\u062A\u0649 {count} \u0645\u0644\u0641\u0627\u062A",phoneTitle:"\u0627\u0645\u0633\u062D \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643",phoneStep1:"\u0627\u0641\u062A\u062D \u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0627\u062A\u0641\u0643 \u0648\u0627\u0645\u0633\u062D \u0627\u0644\u0631\u0645\u0632",phoneStep2:"\u0627\u062E\u062A\u0631 \u0627\u0644\u0635\u0648\u0631 \u0623\u0648 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643",phoneStep3:"\u062A\u0638\u0647\u0631 \u0647\u0646\u0627 \u0641\u0648\u0631 \u0648\u0635\u0648\u0644\u0647\u0627",phoneCode:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0643\u0627\u0645\u064A\u0631\u0627\u061F \u0627\u0641\u062A\u062D {host} \u0648\u0627\u0643\u062A\u0628",back:"\u0631\u062C\u0648\u0639",doneWithPhone:"\u062A\u0645",sourcePhone:"\u0645\u0646 \u0627\u0644\u0647\u0627\u062A\u0641",sourceDevice:"\u0647\u0630\u0627 \u0627\u0644\u062C\u0647\u0627\u0632",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",tooLarge:"{name} \u0623\u0643\u0628\u0631 \u0645\u0646 {size}.",wrongType:"{name} \u0644\u064A\u0633 \u0645\u0646 \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0627\u0644\u0645\u0642\u0628\u0648\u0644\u0629.",tooMany:"\u064A\u0645\u0643\u0646\u0643 \u0625\u0636\u0627\u0641\u0629 {count} \u0645\u0644\u0641\u0627\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649.",fileCount:"{count} \u0645\u0644\u0641\u0627\u062A",clearAll:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0643\u0644",announceText:"\u0627\u0646\u0642\u0644 \u0627\u0644\u0635\u0648\u0631 \u0628\u064A\u0646 \u0647\u0627\u062A\u0641\u0643 \u0648\u0643\u0645\u0628\u064A\u0648\u062A\u0631\u0643 \u0641\u064A \u0623\u064A \u0648\u0642\u062A \u0639\u0628\u0631 Wi-Fi.",announceLink:"\u062D\u0645\u0651\u0644 TokShare \u0644\u0644\u0643\u0645\u0628\u064A\u0648\u062A\u0631",announceHide:"\u0625\u062E\u0641\u0627\u0621"},ut={en:dt,ar:pt};function he(n){if(n==="en"||n==="ar")return n;let r=(typeof document<"u"?document.documentElement.lang:"")||(typeof navigator<"u"?navigator.language:"en");return/^ar\b/i.test(r)?"ar":"en"}function me(n,t={}){return(r,e={})=>(t[r]??ut[n][r]).replace(/\{(\w+)\}/g,(i,o)=>String(e[o]??""))}function ne(n,t){let r=t==="ar"?["\u0628\u0627\u064A\u062A","\u0643.\u0628","\u0645.\u0628","\u062C.\u0628"]:["B","KB","MB","GB"],e=n,i=0;for(;e>=1e3&&i<r.length-1;)e/=1e3,i++;return`${(e>=100||i===0?Math.round(e):Math.round(e*10)/10).toLocaleString(t)} ${r[i]}`}var He="https://tokshare-pick.pjturki.workers.dev",Ne="0.1.0";function $e(n,t,r,e,i){if(r!==n.size||r>i)return{ok:!1,code:"size_mismatch"};let o=new Uint8Array(Math.min(r,te.sniffBytes)),a=0;for(let f of t){if(a>=o.length)break;let v=f.subarray(0,o.length-a);o.set(v,a),a+=v.length}let s=Be(o);return Oe(e,n.name,n.type,s)?{ok:!0,file:new File(t,n.name,{type:n.type||s||"",lastModified:n.lastModified}),sniffed:s}:{ok:!1,code:"type_rejected"}}var le=class n{constructor(t,r){M(this,"signal",t);M(this,"handlers",r);M(this,"pc",null);M(this,"channel",null);M(this,"id","");M(this,"isOpen",!1);M(this,"current",null)}static supported(){return typeof RTCPeerConnection=="function"}onSignal(t){if(t.kind==="offer"&&t.sdp){this.answer(t.pc,t.sdp);return}t.pc!==this.id||!this.pc||(t.kind==="ice"&&t.candidate?this.pc.addIceCandidate(t.candidate).catch(()=>{}):t.kind==="bye"&&this.close())}answer(t,r){if(!n.supported())return;this.close(),this.id=t;let e=new RTCPeerConnection({iceServers:[]});this.pc=e,e.onicecandidate=i=>{this.id===t&&this.signal({pc:t,kind:"ice",candidate:i.candidate?i.candidate.toJSON():null})},e.onconnectionstatechange=()=>{this.id===t&&(e.connectionState==="failed"||e.connectionState==="closed")&&this.close()},e.ondatachannel=i=>{if(this.id!==t)return;let o=i.channel;o.binaryType="arraybuffer",this.channel=o;let a=()=>{this.channel===o&&!this.isOpen&&(this.isOpen=!0,this.handlers.state(!0))};o.onopen=a,o.onclose=()=>{this.channel===o&&this.close()},o.onmessage=s=>this.onMessage(o,s.data),o.readyState==="open"&&a()},e.setRemoteDescription({type:"offer",sdp:r}).then(()=>e.createAnswer()).then(i=>e.setLocalDescription(i)).then(()=>{this.id===t&&this.signal({pc:t,kind:"answer",sdp:e.localDescription.sdp})}).catch(()=>this.close())}onMessage(t,r){if(typeof r!="string"){let i=this.current;if(!i||!(r instanceof ArrayBuffer))return;if(i.chunks.push(new Uint8Array(r)),i.received+=r.byteLength,i.received>i.size){i.chunks=[];return}this.handlers.progress(i.id,i.received,i.size);return}let e;try{e=JSON.parse(r)}catch{return}if(e.t==="file"&&typeof e.id=="string"&&Number.isSafeInteger(e.size))this.current={id:e.id,size:e.size,chunks:[],received:0};else if(e.t==="end"&&this.current?.id===e.id){let{id:i,chunks:o,received:a}=this.current;this.current=null,this.handlers.complete(i,o,a).then(s=>s,()=>({ok:!1,code:"failed"})).then(s=>{let p=s.ok?{t:"got",id:i}:{t:"bad",id:i,code:s.code};try{t.send(JSON.stringify(p))}catch{}})}}close(){let t=this.isOpen;this.isOpen=!1;let{pc:r,channel:e}=this;this.pc=null,this.channel=null,this.current=null;try{e?.close()}catch{}try{r?.close()}catch{}t&&this.handlers.state(!1)}};var re=(n=>(n[n.Border=-1]="Border",n[n.Data=0]="Data",n[n.Function=1]="Function",n[n.Position=2]="Position",n[n.Timing=3]="Timing",n[n.Alignment=4]="Alignment",n))(re||{}),ft=[0,1],qe=[1,0],je=[2,3],We=[3,2],ht={L:ft,M:qe,Q:je,H:We},mt=/^\d*$/,gt=/^[A-Z0-9 $%*+./:-]*$/,Ee="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ce=1,Te=40,Ue=3,xt=3,ge=40,bt=10,Ke=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Ye=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],Me=class{constructor(t,r,e,i){M(this,"size");M(this,"mask");M(this,"modules",[]);M(this,"types",[]);if(this.version=t,this.ecc=r,t<Ce||t>Te)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;let o=Array.from({length:this.size}).fill(!1);for(let s=0;s<this.size;s++)this.modules.push(o.slice()),this.types.push(o.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(e);if(this.drawCodewords(a),i===-1){let s=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);let f=this.getPenaltyScore();f<s&&(i=p,s=f),this.applyMask(p)}}this.mask=i,this.applyMask(i),this.drawFormatBits(i)}getModule(t,r){return t>=0&&t<this.size&&r>=0&&r<this.size&&this.modules[r][t]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2===0,re.Timing),this.setFunctionModule(e,6,e%2===0,re.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let t=this.getAlignmentPatternPositions(),r=t.length;for(let e=0;e<r;e++)for(let i=0;i<r;i++)e===0&&i===0||e===0&&i===r-1||e===r-1&&i===0||this.drawAlignmentPattern(t[e],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){let r=this.ecc[1]<<3|t,e=r;for(let o=0;o<10;o++)e=e<<1^(e>>>9)*1335;let i=(r<<10|e)^21522;for(let o=0;o<=5;o++)this.setFunctionModule(8,o,Y(i,o));this.setFunctionModule(8,7,Y(i,6)),this.setFunctionModule(8,8,Y(i,7)),this.setFunctionModule(7,8,Y(i,8));for(let o=9;o<15;o++)this.setFunctionModule(14-o,8,Y(i,o));for(let o=0;o<8;o++)this.setFunctionModule(this.size-1-o,8,Y(i,o));for(let o=8;o<15;o++)this.setFunctionModule(8,this.size-15+o,Y(i,o));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let e=0;e<12;e++)t=t<<1^(t>>>11)*7973;let r=this.version<<12|t;for(let e=0;e<18;e++){let i=Y(r,e),o=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(o,a,i),this.setFunctionModule(a,o,i)}}drawFinderPattern(t,r){for(let e=-4;e<=4;e++)for(let i=-4;i<=4;i++){let o=Math.max(Math.abs(i),Math.abs(e)),a=t+i,s=r+e;a>=0&&a<this.size&&s>=0&&s<this.size&&this.setFunctionModule(a,s,o!==2&&o!==4,re.Position)}}drawAlignmentPattern(t,r){for(let e=-2;e<=2;e++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,r+e,Math.max(Math.abs(i),Math.abs(e))!==1,re.Alignment)}setFunctionModule(t,r,e,i=re.Function){this.modules[r][t]=e,this.types[r][t]=i}addEccAndInterleave(t){let r=this.version,e=this.ecc;if(t.length!==xe(r,e))throw new RangeError("Invalid argument");let i=Ye[e[0]][r],o=Ke[e[0]][r],a=Math.floor(Se(r)/8),s=i-a%i,p=Math.floor(a/i),f=[],v=Ct(o);for(let y=0,S=0;y<i;y++){let z=t.slice(S,S+p-o+(y<s?0:1));S+=z.length;let P=Tt(z,v);y<s&&z.push(0),f.push(z.concat(P))}let g=[];for(let y=0;y<f[0].length;y++)f.forEach((S,z)=>{(y!==p-o||z>=s)&&g.push(S[y])});return g}drawCodewords(t){if(t.length!==Math.floor(Se(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let e=this.size-1;e>=1;e-=2){e===6&&(e=5);for(let i=0;i<this.size;i++)for(let o=0;o<2;o++){let a=e-o,p=(e+1&2)===0?this.size-1-i:i;!this.types[p][a]&&r<t.length*8&&(this.modules[p][a]=Y(t[r>>>3],7-(r&7)),r++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let e=0;e<this.size;e++){let i;switch(t){case 0:i=(e+r)%2===0;break;case 1:i=r%2===0;break;case 2:i=e%3===0;break;case 3:i=(e+r)%3===0;break;case 4:i=(Math.floor(e/3)+Math.floor(r/2))%2===0;break;case 5:i=e*r%2+e*r%3===0;break;case 6:i=(e*r%2+e*r%3)%2===0;break;case 7:i=((e+r)%2+e*r%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[r][e]&&i&&(this.modules[r][e]=!this.modules[r][e])}}getPenaltyScore(){let t=0;for(let o=0;o<this.size;o++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[o][f]===a?(s++,s===5?t+=Ue:s>5&&t++):(this.finderPenaltyAddHistory(s,p),a||(t+=this.finderPenaltyCountPatterns(p)*ge),a=this.modules[o][f],s=1);t+=this.finderPenaltyTerminateAndCount(a,s,p)*ge}for(let o=0;o<this.size;o++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][o]===a?(s++,s===5?t+=Ue:s>5&&t++):(this.finderPenaltyAddHistory(s,p),a||(t+=this.finderPenaltyCountPatterns(p)*ge),a=this.modules[f][o],s=1);t+=this.finderPenaltyTerminateAndCount(a,s,p)*ge}for(let o=0;o<this.size-1;o++)for(let a=0;a<this.size-1;a++){let s=this.modules[o][a];s===this.modules[o][a+1]&&s===this.modules[o+1][a]&&s===this.modules[o+1][a+1]&&(t+=xt)}let r=0;for(let o of this.modules)r=o.reduce((a,s)=>a+(s?1:0),r);let e=this.size*this.size,i=Math.ceil(Math.abs(r*20-e*10)/e)-1;return t+=i*bt,t}getAlignmentPatternPositions(){if(this.version===1)return[];{let t=Math.floor(this.version/7)+2,r=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,e=[6];for(let i=this.size-7;e.length<t;i-=r)e.splice(1,0,i);return e}}finderPenaltyCountPatterns(t){let r=t[1],e=r>0&&t[2]===r&&t[3]===r*3&&t[4]===r&&t[5]===r;return(e&&t[0]>=r*4&&t[6]>=r?1:0)+(e&&t[6]>=r*4&&t[0]>=r?1:0)}finderPenaltyTerminateAndCount(t,r,e){return t&&(this.finderPenaltyAddHistory(r,e),r=0),r+=this.size,this.finderPenaltyAddHistory(r,e),this.finderPenaltyCountPatterns(e)}finderPenaltyAddHistory(t,r){r[0]===0&&(t+=this.size),r.pop(),r.unshift(t)}};function V(n,t,r){if(t<0||t>31||n>>>t)throw new RangeError("Value out of range");for(let e=t-1;e>=0;e--)r.push(n>>>e&1)}function Y(n,t){return(n>>>t&1)!==0}var ce=class{constructor(t,r,e){if(this.mode=t,this.numChars=r,this.bitData=e,r<0)throw new RangeError("Invalid argument");this.bitData=e.slice()}getData(){return this.bitData.slice()}},vt=[1,10,12,14],yt=[2,9,11,13],kt=[4,8,16,16];function Ve(n,t){return n[Math.floor((t+7)/17)+1]}function Ge(n){let t=[];for(let r of n)V(r,8,t);return new ce(kt,n.length,t)}function wt(n){if(!Je(n))throw new RangeError("String contains non-numeric characters");let t=[];for(let r=0;r<n.length;){let e=Math.min(n.length-r,3);V(Number.parseInt(n.substring(r,r+e),10),e*3+1,t),r+=e}return new ce(vt,n.length,t)}function Et(n){if(!Ze(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let t=[],r;for(r=0;r+2<=n.length;r+=2){let e=Ee.indexOf(n.charAt(r))*45;e+=Ee.indexOf(n.charAt(r+1)),V(e,11,t)}return r<n.length&&V(Ee.indexOf(n.charAt(r)),6,t),new ce(yt,n.length,t)}function Mt(n){return n===""?[]:Je(n)?[wt(n)]:Ze(n)?[Et(n)]:[Ge(Lt(n))]}function Je(n){return mt.test(n)}function Ze(n){return gt.test(n)}function St(n,t){let r=0;for(let e of n){let i=Ve(e.mode,t);if(e.numChars>=1<<i)return Number.POSITIVE_INFINITY;r+=4+i+e.bitData.length}return r}function Lt(n){n=encodeURI(n);let t=[];for(let r=0;r<n.length;r++)n.charAt(r)!=="%"?t.push(n.charCodeAt(r)):(t.push(Number.parseInt(n.substring(r+1,r+3),16)),r+=2);return t}function Se(n){if(n<Ce||n>Te)throw new RangeError("Version number out of range");let t=(16*n+128)*n+64;if(n>=2){let r=Math.floor(n/7)+2;t-=(25*r-10)*r-55,n>=7&&(t-=36)}return t}function xe(n,t){return Math.floor(Se(n)/8)-Ke[t[0]][n]*Ye[t[0]][n]}function Ct(n){if(n<1||n>255)throw new RangeError("Degree out of range");let t=[];for(let e=0;e<n-1;e++)t.push(0);t.push(1);let r=1;for(let e=0;e<n;e++){for(let i=0;i<t.length;i++)t[i]=Le(t[i],r),i+1<t.length&&(t[i]^=t[i+1]);r=Le(r,2)}return t}function Tt(n,t){let r=t.map(e=>0);for(let e of n){let i=e^r.shift();r.push(0),t.forEach((o,a)=>r[a]^=Le(o,i))}return r}function Le(n,t){if(n>>>8||t>>>8)throw new RangeError("Byte out of range");let r=0;for(let e=7;e>=0;e--)r=r<<1^(r>>>7)*285,r^=(t>>>e&1)*n;return r}function Pt(n,t,r=1,e=40,i=-1,o=!0){if(!(Ce<=r&&r<=e&&e<=Te)||i<-1||i>7)throw new RangeError("Invalid value");let a,s;for(a=r;;a++){let g=xe(a,t)*8,y=St(n,a);if(y<=g){s=y;break}if(a>=e)throw new RangeError("Data too long")}for(let g of[qe,je,We])o&&s<=xe(a,g)*8&&(t=g);let p=[];for(let g of n){V(g.mode[0],4,p),V(g.numChars,Ve(g.mode,a),p);for(let y of g.getData())p.push(y)}let f=xe(a,t)*8;V(0,Math.min(4,f-p.length),p),V(0,(8-p.length%8)%8,p);for(let g=236;p.length<f;g^=253)V(g,8,p);let v=Array.from({length:Math.ceil(p.length/8)},()=>0);return p.forEach((g,y)=>v[y>>>3]|=g<<7-(y&7)),new Me(a,t,v,i)}function Xe(n,t){let{ecc:r="L",boostEcc:e=!1,minVersion:i=1,maxVersion:o=40,maskPattern:a=-1,border:s=1}=t||{},p=typeof n=="string"?Mt(n):Array.isArray(n)?[Ge(n)]:void 0;if(!p)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof n}`);let f=Pt(p,ht[r],i,o,a,e),v=At({version:f.version,maskPattern:f.mask,size:f.size,data:f.modules,types:f.types},s);return t?.invert&&(v.data=v.data.map(g=>g.map(y=>!y))),t?.onEncoded?.(v),v}function At(n,t=1){if(!t)return n;let{size:r}=n,e=r+t*2;n.size=e,n.data.forEach(o=>{for(let a=0;a<t;a++)o.unshift(!1),o.push(!1)});for(let o=0;o<t;o++)n.data.unshift(Array.from({length:e},a=>!1)),n.data.push(Array.from({length:e},a=>!1));let i=re.Border;n.types.forEach(o=>{for(let a=0;a<t;a++)o.unshift(i),o.push(i)});for(let o=0;o<t;o++)n.types.unshift(Array.from({length:e},a=>i)),n.types.push(Array.from({length:e},a=>i));return n}function be(n,t,r){let e=Xe(t,{ecc:"M",border:2}),i=Math.max(1,Math.min(window.devicePixelRatio||1,3));n.width=n.height=Math.round(r*i);let o=n.getContext("2d");if(!o)return;let a=n.width/e.size;o.fillStyle="#fff",o.fillRect(0,0,n.width,n.height),o.fillStyle="#000",e.data.forEach((s,p)=>s.forEach((f,v)=>{f&&o.fillRect(Math.floor(v*a),Math.floor(p*a),Math.ceil(a),Math.ceil(a))}))}var Qe=n=>`${n.slice(0,4)}-${n.slice(4)}`;function Ft(n){let t=/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?\)/.exec(n);if(!t||(t[4]===void 0?1:t[4].endsWith("%")?Number.parseFloat(t[4])/100:Number(t[4]))<.5)return null;let[e,i,o]=[t[1],t[2],t[3]].map(a=>{let s=Number(a)/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4});return .2126*e+.7152*i+.0722*o}function zt(n){for(let r=n;r;r=r.parentElement){let e=Ft(getComputedStyle(r).backgroundColor);if(e!==null)return e<.3?"dark":"light"}let t=getComputedStyle(document.documentElement).colorScheme||"";return/\bdark\b/.test(t)&&!/\blight\b/.test(t)||/\blight\b/.test(t)&&/\bdark\b/.test(t)&&matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function ve(n,t){return n==="light"||n==="dark"?n:zt(t)}var Pe=`
|
|
142
|
+
`;var dt={title:"Pick files from your phone",titleOne:"Pick a file from your phone",scan:"Scan with your phone's camera",orType:"No camera? Open {host} on your phone and type",loading:"Getting a code\u2026",waiting:"Waiting for your phone\u2026",connected:"Connected: {label}",connectedDirect:"Connected over Wi-Fi: {label}",disconnect:"Not you? Disconnect",phoneLeft:"Your phone disconnected. It reconnects by itself when the page is open.",approveTitle:"Approve this phone?",approveMatch:"Your phone should show {match}.",approve:"Approve",reject:"Reject",sending:"Sending from phone {percent}%",receiving:"Receiving {percent}%",received:"Received",failed:"Not received",cancel:"Cancel",done:"Done",useFiles:"Use {count} files",useFile:"Use this file",expired:"This code expired.",newCode:"Get a new code",error:"Couldn't start: {message}",tryAgain:"Try again",close:"Close",privacy:"Files go straight to this site and are deleted from TokShare once received.",dropTitle:"Drag & drop files here",dropTitleOne:"Drag & drop a file here",dropActive:"Drop to add",or:"or",browse:"Browse files",usePhone:"Use your phone",hintTypes:"{types} \xB7 up to {size}",hintAny:"Any file \xB7 up to {size}",hintCount:"Up to {count} files",phoneTitle:"Scan with your phone",phoneStep1:"Open your phone's camera and scan the code",phoneStep2:"Pick photos or files on your phone",phoneStep3:"They appear here as they arrive",phoneCode:"No camera? Open {host} and type",back:"Back",doneWithPhone:"Done",sourcePhone:"From phone",sourceDevice:"This device",remove:"Remove {name}",tooLarge:"{name} is larger than {size}.",wrongType:"{name} isn't an accepted file type.",tooMany:"You can add up to {count} files.",fileCount:"{count} files",clearAll:"Remove all",announceText:"Move photos between your phone and your own PC anytime, over Wi-Fi.",announceLink:"Get TokShare for desktop",announceHide:"Hide"},pt={title:"\u0627\u062E\u062A\u0631 \u0645\u0644\u0641\u0627\u062A \u0645\u0646 \u0647\u0627\u062A\u0641\u0643",titleOne:"\u0627\u062E\u062A\u0631 \u0645\u0644\u0641\u064B\u0627 \u0645\u0646 \u0647\u0627\u062A\u0641\u0643",scan:"\u0627\u0645\u0633\u062D \u0627\u0644\u0631\u0645\u0632 \u0628\u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0627\u062A\u0641\u0643",orType:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0643\u0627\u0645\u064A\u0631\u0627\u061F \u0627\u0641\u062A\u062D {host} \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643 \u0648\u0627\u0643\u062A\u0628",loading:"\u062C\u0627\u0631\u064D \u062A\u062C\u0647\u064A\u0632 \u0627\u0644\u0631\u0645\u0632\u2026",waiting:"\u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631 \u0647\u0627\u062A\u0641\u0643\u2026",connected:"\u0645\u062A\u0635\u0644: {label}",connectedDirect:"\u0645\u062A\u0635\u0644 \u0639\u0628\u0631 Wi-Fi: {label}",disconnect:"\u0644\u064A\u0633 \u0647\u0627\u062A\u0641\u0643\u061F \u0627\u0641\u0635\u0644\u0647",phoneLeft:"\u0627\u0646\u0642\u0637\u0639 \u0627\u062A\u0635\u0627\u0644 \u0647\u0627\u062A\u0641\u0643. \u0633\u064A\u0639\u0648\u062F \u062A\u0644\u0642\u0627\u0626\u064A\u064B\u0627 \u0645\u0627 \u062F\u0627\u0645\u062A \u0627\u0644\u0635\u0641\u062D\u0629 \u0645\u0641\u062A\u0648\u062D\u0629 \u0639\u0644\u064A\u0647.",approveTitle:"\u0647\u0644 \u062A\u0648\u0627\u0641\u0642 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0647\u0627\u062A\u0641\u061F",approveMatch:"\u064A\u062C\u0628 \u0623\u0646 \u064A\u0639\u0631\u0636 \u0647\u0627\u062A\u0641\u0643 \u0627\u0644\u0631\u0642\u0645 {match}.",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644 \u0645\u0646 \u0627\u0644\u0647\u0627\u062A\u0641 {percent}%",receiving:"\u062C\u0627\u0631\u064D \u0627\u0644\u0627\u0633\u062A\u0644\u0627\u0645 {percent}%",received:"\u062A\u0645 \u0627\u0644\u0627\u0633\u062A\u0644\u0627\u0645",failed:"\u0644\u0645 \u064A\u064F\u0633\u062A\u0644\u0645",cancel:"\u0625\u0644\u063A\u0627\u0621",done:"\u062A\u0645",useFiles:"\u0627\u0633\u062A\u062E\u062F\u0645 {count} \u0645\u0644\u0641\u0627\u062A",useFile:"\u0627\u0633\u062A\u062E\u062F\u0645 \u0647\u0630\u0627 \u0627\u0644\u0645\u0644\u0641",expired:"\u0627\u0646\u062A\u0647\u062A \u0635\u0644\u0627\u062D\u064A\u0629 \u0647\u0630\u0627 \u0627\u0644\u0631\u0645\u0632.",newCode:"\u0627\u062D\u0635\u0644 \u0639\u0644\u0649 \u0631\u0645\u0632 \u062C\u062F\u064A\u062F",error:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0628\u062F\u0621: {message}",tryAgain:"\u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649",close:"\u0625\u063A\u0644\u0627\u0642",privacy:"\u062A\u0635\u0644 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0645\u0628\u0627\u0634\u0631\u0629 \u0625\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639\u060C \u0648\u064A\u062D\u0630\u0641\u0647\u0627 TokShare \u0641\u0648\u0631 \u0627\u0633\u062A\u0644\u0627\u0645\u0647\u0627.",dropTitle:"\u0627\u0633\u062D\u0628 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0648\u0623\u0641\u0644\u062A\u0647\u0627 \u0647\u0646\u0627",dropTitleOne:"\u0627\u0633\u062D\u0628 \u0645\u0644\u0641\u064B\u0627 \u0648\u0623\u0641\u0644\u062A\u0647 \u0647\u0646\u0627",dropActive:"\u0623\u0641\u0644\u062A \u0644\u0644\u0625\u0636\u0627\u0641\u0629",or:"\u0623\u0648",browse:"\u062A\u0635\u0641\u0651\u062D \u0627\u0644\u0645\u0644\u0641\u0627\u062A",usePhone:"\u0627\u0633\u062A\u062E\u062F\u0645 \u0647\u0627\u062A\u0641\u0643",hintTypes:"{types} \xB7 \u062D\u062A\u0649 {size}",hintAny:"\u0623\u064A \u0645\u0644\u0641 \xB7 \u062D\u062A\u0649 {size}",hintCount:"\u062D\u062A\u0649 {count} \u0645\u0644\u0641\u0627\u062A",phoneTitle:"\u0627\u0645\u0633\u062D \u0627\u0644\u0631\u0645\u0632 \u0628\u0647\u0627\u062A\u0641\u0643",phoneStep1:"\u0627\u0641\u062A\u062D \u0643\u0627\u0645\u064A\u0631\u0627 \u0647\u0627\u062A\u0641\u0643 \u0648\u0627\u0645\u0633\u062D \u0627\u0644\u0631\u0645\u0632",phoneStep2:"\u0627\u062E\u062A\u0631 \u0627\u0644\u0635\u0648\u0631 \u0623\u0648 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0639\u0644\u0649 \u0647\u0627\u062A\u0641\u0643",phoneStep3:"\u062A\u0638\u0647\u0631 \u0647\u0646\u0627 \u0641\u0648\u0631 \u0648\u0635\u0648\u0644\u0647\u0627",phoneCode:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0643\u0627\u0645\u064A\u0631\u0627\u061F \u0627\u0641\u062A\u062D {host} \u0648\u0627\u0643\u062A\u0628",back:"\u0631\u062C\u0648\u0639",doneWithPhone:"\u062A\u0645",sourcePhone:"\u0645\u0646 \u0627\u0644\u0647\u0627\u062A\u0641",sourceDevice:"\u0647\u0630\u0627 \u0627\u0644\u062C\u0647\u0627\u0632",remove:"\u0625\u0632\u0627\u0644\u0629 {name}",tooLarge:"{name} \u0623\u0643\u0628\u0631 \u0645\u0646 {size}.",wrongType:"{name} \u0644\u064A\u0633 \u0645\u0646 \u0623\u0646\u0648\u0627\u0639 \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0627\u0644\u0645\u0642\u0628\u0648\u0644\u0629.",tooMany:"\u064A\u0645\u0643\u0646\u0643 \u0625\u0636\u0627\u0641\u0629 {count} \u0645\u0644\u0641\u0627\u062A \u0643\u062D\u062F \u0623\u0642\u0635\u0649.",fileCount:"{count} \u0645\u0644\u0641\u0627\u062A",clearAll:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0643\u0644",announceText:"\u0627\u0646\u0642\u0644 \u0627\u0644\u0635\u0648\u0631 \u0628\u064A\u0646 \u0647\u0627\u062A\u0641\u0643 \u0648\u0643\u0645\u0628\u064A\u0648\u062A\u0631\u0643 \u0641\u064A \u0623\u064A \u0648\u0642\u062A \u0639\u0628\u0631 Wi-Fi.",announceLink:"\u062D\u0645\u0651\u0644 TokShare \u0644\u0644\u0643\u0645\u0628\u064A\u0648\u062A\u0631",announceHide:"\u0625\u062E\u0641\u0627\u0621"},ut={en:dt,ar:pt};function he(n){if(n==="en"||n==="ar")return n;let r=(typeof document<"u"?document.documentElement.lang:"")||(typeof navigator<"u"?navigator.language:"en");return/^ar\b/i.test(r)?"ar":"en"}function me(n,t={}){return(r,e={})=>(t[r]??ut[n][r]).replace(/\{(\w+)\}/g,(i,o)=>String(e[o]??""))}function ne(n,t){let r=t==="ar"?["\u0628\u0627\u064A\u062A","\u0643.\u0628","\u0645.\u0628","\u062C.\u0628"]:["B","KB","MB","GB"],e=n,i=0;for(;e>=1e3&&i<r.length-1;)e/=1e3,i++;return`${(e>=100||i===0?Math.round(e):Math.round(e*10)/10).toLocaleString(t)} ${r[i]}`}var He="https://tokshare-pick.pjturki.workers.dev",Ne="0.1.1";function $e(n,t,r,e,i){if(r!==n.size||r>i)return{ok:!1,code:"size_mismatch"};let o=new Uint8Array(Math.min(r,te.sniffBytes)),a=0;for(let f of t){if(a>=o.length)break;let v=f.subarray(0,o.length-a);o.set(v,a),a+=v.length}let s=Be(o);return Oe(e,n.name,n.type,s)?{ok:!0,file:new File(t,n.name,{type:n.type||s||"",lastModified:n.lastModified}),sniffed:s}:{ok:!1,code:"type_rejected"}}var le=class n{constructor(t,r){M(this,"signal",t);M(this,"handlers",r);M(this,"pc",null);M(this,"channel",null);M(this,"id","");M(this,"isOpen",!1);M(this,"current",null)}static supported(){return typeof RTCPeerConnection=="function"}onSignal(t){if(t.kind==="offer"&&t.sdp){this.answer(t.pc,t.sdp);return}t.pc!==this.id||!this.pc||(t.kind==="ice"&&t.candidate?this.pc.addIceCandidate(t.candidate).catch(()=>{}):t.kind==="bye"&&this.close())}answer(t,r){if(!n.supported())return;this.close(),this.id=t;let e=new RTCPeerConnection({iceServers:[]});this.pc=e,e.onicecandidate=i=>{this.id===t&&this.signal({pc:t,kind:"ice",candidate:i.candidate?i.candidate.toJSON():null})},e.onconnectionstatechange=()=>{this.id===t&&(e.connectionState==="failed"||e.connectionState==="closed")&&this.close()},e.ondatachannel=i=>{if(this.id!==t)return;let o=i.channel;o.binaryType="arraybuffer",this.channel=o;let a=()=>{this.channel===o&&!this.isOpen&&(this.isOpen=!0,this.handlers.state(!0))};o.onopen=a,o.onclose=()=>{this.channel===o&&this.close()},o.onmessage=s=>this.onMessage(o,s.data),o.readyState==="open"&&a()},e.setRemoteDescription({type:"offer",sdp:r}).then(()=>e.createAnswer()).then(i=>e.setLocalDescription(i)).then(()=>{this.id===t&&this.signal({pc:t,kind:"answer",sdp:e.localDescription.sdp})}).catch(()=>this.close())}onMessage(t,r){if(typeof r!="string"){let i=this.current;if(!i||!(r instanceof ArrayBuffer))return;if(i.chunks.push(new Uint8Array(r)),i.received+=r.byteLength,i.received>i.size){i.chunks=[];return}this.handlers.progress(i.id,i.received,i.size);return}let e;try{e=JSON.parse(r)}catch{return}if(e.t==="file"&&typeof e.id=="string"&&Number.isSafeInteger(e.size))this.current={id:e.id,size:e.size,chunks:[],received:0};else if(e.t==="end"&&this.current?.id===e.id){let{id:i,chunks:o,received:a}=this.current;this.current=null,this.handlers.complete(i,o,a).then(s=>s,()=>({ok:!1,code:"failed"})).then(s=>{let p=s.ok?{t:"got",id:i}:{t:"bad",id:i,code:s.code};try{t.send(JSON.stringify(p))}catch{}})}}close(){let t=this.isOpen;this.isOpen=!1;let{pc:r,channel:e}=this;this.pc=null,this.channel=null,this.current=null;try{e?.close()}catch{}try{r?.close()}catch{}t&&this.handlers.state(!1)}};var re=(n=>(n[n.Border=-1]="Border",n[n.Data=0]="Data",n[n.Function=1]="Function",n[n.Position=2]="Position",n[n.Timing=3]="Timing",n[n.Alignment=4]="Alignment",n))(re||{}),ft=[0,1],qe=[1,0],je=[2,3],We=[3,2],ht={L:ft,M:qe,Q:je,H:We},mt=/^\d*$/,gt=/^[A-Z0-9 $%*+./:-]*$/,Ee="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Ce=1,Te=40,Ue=3,xt=3,ge=40,bt=10,Ke=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],Ye=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],Me=class{constructor(t,r,e,i){M(this,"size");M(this,"mask");M(this,"modules",[]);M(this,"types",[]);if(this.version=t,this.ecc=r,t<Ce||t>Te)throw new RangeError("Version value out of range");if(i<-1||i>7)throw new RangeError("Mask value out of range");this.size=t*4+17;let o=Array.from({length:this.size}).fill(!1);for(let s=0;s<this.size;s++)this.modules.push(o.slice()),this.types.push(o.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(e);if(this.drawCodewords(a),i===-1){let s=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);let f=this.getPenaltyScore();f<s&&(i=p,s=f),this.applyMask(p)}}this.mask=i,this.applyMask(i),this.drawFormatBits(i)}getModule(t,r){return t>=0&&t<this.size&&r>=0&&r<this.size&&this.modules[r][t]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2===0,re.Timing),this.setFunctionModule(e,6,e%2===0,re.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let t=this.getAlignmentPatternPositions(),r=t.length;for(let e=0;e<r;e++)for(let i=0;i<r;i++)e===0&&i===0||e===0&&i===r-1||e===r-1&&i===0||this.drawAlignmentPattern(t[e],t[i]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(t){let r=this.ecc[1]<<3|t,e=r;for(let o=0;o<10;o++)e=e<<1^(e>>>9)*1335;let i=(r<<10|e)^21522;for(let o=0;o<=5;o++)this.setFunctionModule(8,o,Y(i,o));this.setFunctionModule(8,7,Y(i,6)),this.setFunctionModule(8,8,Y(i,7)),this.setFunctionModule(7,8,Y(i,8));for(let o=9;o<15;o++)this.setFunctionModule(14-o,8,Y(i,o));for(let o=0;o<8;o++)this.setFunctionModule(this.size-1-o,8,Y(i,o));for(let o=8;o<15;o++)this.setFunctionModule(8,this.size-15+o,Y(i,o));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let t=this.version;for(let e=0;e<12;e++)t=t<<1^(t>>>11)*7973;let r=this.version<<12|t;for(let e=0;e<18;e++){let i=Y(r,e),o=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(o,a,i),this.setFunctionModule(a,o,i)}}drawFinderPattern(t,r){for(let e=-4;e<=4;e++)for(let i=-4;i<=4;i++){let o=Math.max(Math.abs(i),Math.abs(e)),a=t+i,s=r+e;a>=0&&a<this.size&&s>=0&&s<this.size&&this.setFunctionModule(a,s,o!==2&&o!==4,re.Position)}}drawAlignmentPattern(t,r){for(let e=-2;e<=2;e++)for(let i=-2;i<=2;i++)this.setFunctionModule(t+i,r+e,Math.max(Math.abs(i),Math.abs(e))!==1,re.Alignment)}setFunctionModule(t,r,e,i=re.Function){this.modules[r][t]=e,this.types[r][t]=i}addEccAndInterleave(t){let r=this.version,e=this.ecc;if(t.length!==xe(r,e))throw new RangeError("Invalid argument");let i=Ye[e[0]][r],o=Ke[e[0]][r],a=Math.floor(Se(r)/8),s=i-a%i,p=Math.floor(a/i),f=[],v=Ct(o);for(let y=0,S=0;y<i;y++){let z=t.slice(S,S+p-o+(y<s?0:1));S+=z.length;let P=Tt(z,v);y<s&&z.push(0),f.push(z.concat(P))}let g=[];for(let y=0;y<f[0].length;y++)f.forEach((S,z)=>{(y!==p-o||z>=s)&&g.push(S[y])});return g}drawCodewords(t){if(t.length!==Math.floor(Se(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let e=this.size-1;e>=1;e-=2){e===6&&(e=5);for(let i=0;i<this.size;i++)for(let o=0;o<2;o++){let a=e-o,p=(e+1&2)===0?this.size-1-i:i;!this.types[p][a]&&r<t.length*8&&(this.modules[p][a]=Y(t[r>>>3],7-(r&7)),r++)}}}applyMask(t){if(t<0||t>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let e=0;e<this.size;e++){let i;switch(t){case 0:i=(e+r)%2===0;break;case 1:i=r%2===0;break;case 2:i=e%3===0;break;case 3:i=(e+r)%3===0;break;case 4:i=(Math.floor(e/3)+Math.floor(r/2))%2===0;break;case 5:i=e*r%2+e*r%3===0;break;case 6:i=(e*r%2+e*r%3)%2===0;break;case 7:i=((e+r)%2+e*r%3)%2===0;break;default:throw new Error("Unreachable")}!this.types[r][e]&&i&&(this.modules[r][e]=!this.modules[r][e])}}getPenaltyScore(){let t=0;for(let o=0;o<this.size;o++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[o][f]===a?(s++,s===5?t+=Ue:s>5&&t++):(this.finderPenaltyAddHistory(s,p),a||(t+=this.finderPenaltyCountPatterns(p)*ge),a=this.modules[o][f],s=1);t+=this.finderPenaltyTerminateAndCount(a,s,p)*ge}for(let o=0;o<this.size;o++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][o]===a?(s++,s===5?t+=Ue:s>5&&t++):(this.finderPenaltyAddHistory(s,p),a||(t+=this.finderPenaltyCountPatterns(p)*ge),a=this.modules[f][o],s=1);t+=this.finderPenaltyTerminateAndCount(a,s,p)*ge}for(let o=0;o<this.size-1;o++)for(let a=0;a<this.size-1;a++){let s=this.modules[o][a];s===this.modules[o][a+1]&&s===this.modules[o+1][a]&&s===this.modules[o+1][a+1]&&(t+=xt)}let r=0;for(let o of this.modules)r=o.reduce((a,s)=>a+(s?1:0),r);let e=this.size*this.size,i=Math.ceil(Math.abs(r*20-e*10)/e)-1;return t+=i*bt,t}getAlignmentPatternPositions(){if(this.version===1)return[];{let t=Math.floor(this.version/7)+2,r=this.version===32?26:Math.ceil((this.version*4+4)/(t*2-2))*2,e=[6];for(let i=this.size-7;e.length<t;i-=r)e.splice(1,0,i);return e}}finderPenaltyCountPatterns(t){let r=t[1],e=r>0&&t[2]===r&&t[3]===r*3&&t[4]===r&&t[5]===r;return(e&&t[0]>=r*4&&t[6]>=r?1:0)+(e&&t[6]>=r*4&&t[0]>=r?1:0)}finderPenaltyTerminateAndCount(t,r,e){return t&&(this.finderPenaltyAddHistory(r,e),r=0),r+=this.size,this.finderPenaltyAddHistory(r,e),this.finderPenaltyCountPatterns(e)}finderPenaltyAddHistory(t,r){r[0]===0&&(t+=this.size),r.pop(),r.unshift(t)}};function V(n,t,r){if(t<0||t>31||n>>>t)throw new RangeError("Value out of range");for(let e=t-1;e>=0;e--)r.push(n>>>e&1)}function Y(n,t){return(n>>>t&1)!==0}var ce=class{constructor(t,r,e){if(this.mode=t,this.numChars=r,this.bitData=e,r<0)throw new RangeError("Invalid argument");this.bitData=e.slice()}getData(){return this.bitData.slice()}},vt=[1,10,12,14],yt=[2,9,11,13],kt=[4,8,16,16];function Ve(n,t){return n[Math.floor((t+7)/17)+1]}function Ge(n){let t=[];for(let r of n)V(r,8,t);return new ce(kt,n.length,t)}function wt(n){if(!Je(n))throw new RangeError("String contains non-numeric characters");let t=[];for(let r=0;r<n.length;){let e=Math.min(n.length-r,3);V(Number.parseInt(n.substring(r,r+e),10),e*3+1,t),r+=e}return new ce(vt,n.length,t)}function Et(n){if(!Ze(n))throw new RangeError("String contains unencodable characters in alphanumeric mode");let t=[],r;for(r=0;r+2<=n.length;r+=2){let e=Ee.indexOf(n.charAt(r))*45;e+=Ee.indexOf(n.charAt(r+1)),V(e,11,t)}return r<n.length&&V(Ee.indexOf(n.charAt(r)),6,t),new ce(yt,n.length,t)}function Mt(n){return n===""?[]:Je(n)?[wt(n)]:Ze(n)?[Et(n)]:[Ge(Lt(n))]}function Je(n){return mt.test(n)}function Ze(n){return gt.test(n)}function St(n,t){let r=0;for(let e of n){let i=Ve(e.mode,t);if(e.numChars>=1<<i)return Number.POSITIVE_INFINITY;r+=4+i+e.bitData.length}return r}function Lt(n){n=encodeURI(n);let t=[];for(let r=0;r<n.length;r++)n.charAt(r)!=="%"?t.push(n.charCodeAt(r)):(t.push(Number.parseInt(n.substring(r+1,r+3),16)),r+=2);return t}function Se(n){if(n<Ce||n>Te)throw new RangeError("Version number out of range");let t=(16*n+128)*n+64;if(n>=2){let r=Math.floor(n/7)+2;t-=(25*r-10)*r-55,n>=7&&(t-=36)}return t}function xe(n,t){return Math.floor(Se(n)/8)-Ke[t[0]][n]*Ye[t[0]][n]}function Ct(n){if(n<1||n>255)throw new RangeError("Degree out of range");let t=[];for(let e=0;e<n-1;e++)t.push(0);t.push(1);let r=1;for(let e=0;e<n;e++){for(let i=0;i<t.length;i++)t[i]=Le(t[i],r),i+1<t.length&&(t[i]^=t[i+1]);r=Le(r,2)}return t}function Tt(n,t){let r=t.map(e=>0);for(let e of n){let i=e^r.shift();r.push(0),t.forEach((o,a)=>r[a]^=Le(o,i))}return r}function Le(n,t){if(n>>>8||t>>>8)throw new RangeError("Byte out of range");let r=0;for(let e=7;e>=0;e--)r=r<<1^(r>>>7)*285,r^=(t>>>e&1)*n;return r}function Pt(n,t,r=1,e=40,i=-1,o=!0){if(!(Ce<=r&&r<=e&&e<=Te)||i<-1||i>7)throw new RangeError("Invalid value");let a,s;for(a=r;;a++){let g=xe(a,t)*8,y=St(n,a);if(y<=g){s=y;break}if(a>=e)throw new RangeError("Data too long")}for(let g of[qe,je,We])o&&s<=xe(a,g)*8&&(t=g);let p=[];for(let g of n){V(g.mode[0],4,p),V(g.numChars,Ve(g.mode,a),p);for(let y of g.getData())p.push(y)}let f=xe(a,t)*8;V(0,Math.min(4,f-p.length),p),V(0,(8-p.length%8)%8,p);for(let g=236;p.length<f;g^=253)V(g,8,p);let v=Array.from({length:Math.ceil(p.length/8)},()=>0);return p.forEach((g,y)=>v[y>>>3]|=g<<7-(y&7)),new Me(a,t,v,i)}function Xe(n,t){let{ecc:r="L",boostEcc:e=!1,minVersion:i=1,maxVersion:o=40,maskPattern:a=-1,border:s=1}=t||{},p=typeof n=="string"?Mt(n):Array.isArray(n)?[Ge(n)]:void 0;if(!p)throw new Error(`uqr only supports encoding string and binary data, but got: ${typeof n}`);let f=Pt(p,ht[r],i,o,a,e),v=At({version:f.version,maskPattern:f.mask,size:f.size,data:f.modules,types:f.types},s);return t?.invert&&(v.data=v.data.map(g=>g.map(y=>!y))),t?.onEncoded?.(v),v}function At(n,t=1){if(!t)return n;let{size:r}=n,e=r+t*2;n.size=e,n.data.forEach(o=>{for(let a=0;a<t;a++)o.unshift(!1),o.push(!1)});for(let o=0;o<t;o++)n.data.unshift(Array.from({length:e},a=>!1)),n.data.push(Array.from({length:e},a=>!1));let i=re.Border;n.types.forEach(o=>{for(let a=0;a<t;a++)o.unshift(i),o.push(i)});for(let o=0;o<t;o++)n.types.unshift(Array.from({length:e},a=>i)),n.types.push(Array.from({length:e},a=>i));return n}function be(n,t,r){let e=Xe(t,{ecc:"M",border:2}),i=Math.max(1,Math.min(window.devicePixelRatio||1,3));n.width=n.height=Math.round(r*i);let o=n.getContext("2d");if(!o)return;let a=n.width/e.size;o.fillStyle="#fff",o.fillRect(0,0,n.width,n.height),o.fillStyle="#000",e.data.forEach((s,p)=>s.forEach((f,v)=>{f&&o.fillRect(Math.floor(v*a),Math.floor(p*a),Math.ceil(a),Math.ceil(a))}))}var Qe=n=>`${n.slice(0,4)}-${n.slice(4)}`;function Ft(n){let t=/rgba?\(([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?\)/.exec(n);if(!t||(t[4]===void 0?1:t[4].endsWith("%")?Number.parseFloat(t[4])/100:Number(t[4]))<.5)return null;let[e,i,o]=[t[1],t[2],t[3]].map(a=>{let s=Number(a)/255;return s<=.03928?s/12.92:((s+.055)/1.055)**2.4});return .2126*e+.7152*i+.0722*o}function zt(n){for(let r=n;r;r=r.parentElement){let e=Ft(getComputedStyle(r).backgroundColor);if(e!==null)return e<.3?"dark":"light"}let t=getComputedStyle(document.documentElement).colorScheme||"";return/\bdark\b/.test(t)&&!/\blight\b/.test(t)||/\blight\b/.test(t)&&/\bdark\b/.test(t)&&matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"}function ve(n,t){return n==="light"||n==="dark"?n:zt(t)}var Pe=`
|
|
143
143
|
:host { all: initial; }
|
|
144
144
|
.overlay {
|
|
145
145
|
/* Light. Lime is unreadable as text on white, so links and focus rings use a deeper violet. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokshare/pick",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Let visitors send files from their phone to your website: a button, a QR code, and File objects in your page.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"file upload",
|
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
"camera upload",
|
|
12
12
|
"react"
|
|
13
13
|
],
|
|
14
|
-
"author":
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Peter Torki",
|
|
16
|
+
"url": "https://petertorki.tech"
|
|
17
|
+
},
|
|
15
18
|
"license": "MIT",
|
|
16
19
|
"homepage": "https://tokshare.vercel.app",
|
|
17
20
|
"type": "module",
|
|
@@ -69,5 +72,11 @@
|
|
|
69
72
|
"typescript": "^5.8.3",
|
|
70
73
|
"uqr": "^0.1.3",
|
|
71
74
|
"vitest": "^3.2.4"
|
|
72
|
-
}
|
|
75
|
+
},
|
|
76
|
+
"contributors": [
|
|
77
|
+
{
|
|
78
|
+
"name": "Peter Torki",
|
|
79
|
+
"url": "https://instagram.com/peter_torki"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
73
82
|
}
|